[ansible-project] Ansible + Packer = nothing?

2016-06-28 Thread Foster, Rilindo
I am currently experimenting with deploying using Packer’s Ansible local 
provisioning and for some odd reason, it doesn’t appear to be executing the 
tasks in the playbook. Packer, after installing  the pre-requiresites for 
Ansible, uploads the following

Inventory file (“hosts”)

[localhost]
localhost ansible_connection=local

The playbook file (“local.yml”):

---
- hosts: localhost
  connection: local
  become: yes
  become_method: sudo
  tasks:
  - name: Making sure that ansible is actually executing this playbook
shell: echo "hello world"
  - name: install packages
package: name={{ item }} state=present
with_items:
  - nginx
  - git
  - curl
  - libmysqlclient-dev
  - libmysqlclient18
  - mysql-common
  - nodejs
  - tcpdump

The output is as follows (running Ansible against a Ubuntu 14.04 instance):

amazon-ebs: Executing Ansible: cd /tmp/packer-provisioner-ansible-local && 
ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook 
/tmp/packer-provisioner-ansible-local/local.yml -c local -i 
/tmp/packer-provisioner-ansible-local/hosts
==> amazon-ebs: Stopping the source instance...
==> amazon-ebs: Waiting for the instance to stop.

As you can see, there is no Ansible output, which I assume I should get 
(somebody correct me if I am wrong).

I did manual run of the playbook, which worked successfully.  At this point, I 
am not sure if I missing something or not.


-  Rilindo


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9328C4A6-C947-428D-AC98-D763B6921A2F%40connecture.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Docker container fails to reload

2016-06-28 Thread Guy Knights
Hmm, no that didn't fix it for me unfortunately. I updated the
docker-engine package to the latest and also pulled the latest ansible
stable-2.1 commits, but it still fails with the same error. I'll try
changing over to the new docker_container module instead and see if that
fixes it for me.

Thanks anyway!
Guy

On Wed, Jun 22, 2016 at 11:42 AM, Henrique Santos Fernandes <
sf.ri...@gmail.com> wrote:

> Hello Guy,
>
> Have you updated you docker server?
> I am not sure, but i had the same problem now! and I just updated some one
> else pull requets that should solve it:
> https://github.com/ansible/ansible-modules-core/pull/4015
>
> But with older ansible, it did not showed an error, it just reloaded the
> container, i havent looked into it. I know it reloads when it should not,
> like it is reloading for a container that did not change, eitherway, the PR
> make it run again.
> If you have Labels at the Dockerfile, the container will restart if you
> did not add them to the ansible task. Not sure if this should be the
> behavior, but it is.
>
> Also i think ansible 2.2 will not have this issue, as it is deprecating
> the docker module and using a newer one.
>
> Hope that helps!
>
>
> Em terça-feira, 21 de junho de 2016 21:20:40 UTC-3, Guy Knights escreveu:
>>
>> Hi Johannes,
>>
>> It's a git clone of the stable-2.1 branch. I recently (like, today) did a
>> 'git pull' in addition to 'git submodule update --recursive' and tried
>> again, still got the same error.
>>
>> I just tried switching back to the stable-2.0.0.1 branch and it seems to
>> be working fine, so it appears to be a specific 2.1 issue.
>>
>> Thanks,
>> Guy
>>
>> On Thursday, June 2, 2016 at 1:31:56 AM UTC-7, Johannes Kastl wrote:
>>>
>>> On 31.05.16 21:23 Guy Knights wrote:
>>>
>>> > I only started getting this recently after I started using ansible
>>> 2.1. The
>>> > docker task in question hasn't been modified in a long time, and if I
>>> > manually remove the container from the host and re-run the playbook,
>>> it
>>> > starts the container ok.
>>>
>>> How did you install ansible 2.1? Recently there was an error because
>>> some git submodules were not up to date and caused problems...
>>>
>>> Johannes
>>>
>>>
>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/1UTB7O5ZvpE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/35c5b979-55e5-497f-8ec2-188890a2346a%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CANNH9mu8W4Kza%3DVWCpAgLDs5uh-D9J%3DUtaV2mo_BzNWTmhG%3DsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows - Ansible freezes when network connection disrupted

2016-06-28 Thread Matt Davis
Great- sorry we had to go so far afield there, but I'll make sure I try 
this test on the Windows async stuff so you can hopefully throw it away 
soon. :)

On Tuesday, June 28, 2016 at 3:44:59 PM UTC-7, Rahul Garg wrote:
>
> Thank you for all the help Matt, I was finally able to solve this today :)
> I did it using scheduled job as you had mentioned, basically deferring the 
> install action on the host to a later time so I don't lose the connection.
>
> Fun times!
>
> On Monday, 27 June 2016 17:57:41 UTC-7, Matt Davis wrote:
>>
>> The closest thing I've been able to approximate what you're doing is 
>> using devmanview /disable_enable to bounce my WinRM connection's NIC- it 
>> definitely hangs on the Receive in that case, as I expected. Regardless, 
>> it's a race, so without deferring the action on the Windows side, it's 
>> possible that the NIC could bounce even before you've gotten the response 
>> from the WinRM Command POST, much less the actual process results via the 
>> next WinRM Receive call. 
>>
>> Unless you want to start working with things at the winrm level (trust 
>> me, you probably don't), the trick is going to be deferring the device 
>> bounce until *after* the WinRM session has completed (where I was going 
>> with the sleep before the command in a separate process). This is further 
>> complicated by WinRM's aggressive nuking of child processes once the parent 
>> shell has exited, so it's also possible you're running into that (eg, WinRM 
>> call completes, while Powershell subprocess is still sleeping, WinRM 
>> helpfully nukes the process for you before/during the action you want). 
>>
>> You might also want to look into doing this in a scheduled job- that 
>> would at least let you escape the constraints of the WinRM environment, 
>> though it brings a whole host of other problems, too...
>>
>> Or just wait for async in 2.2. :)
>>
>>
>>
>>
>>
>> On Monday, June 27, 2016 at 3:03:20 PM UTC-7, Rahul Garg wrote:
>>>
>>> Thanks for the suggestions Matt. I've tried both the approaches. No luck 
>>> unfortunately :|
>>> From what I understand, Ansible seems to be waiting for the result to 
>>> get added to the results dictionary. Even though I have changed the 
>>> timeouts in win_reconnect (the plugin which I wrote).
>>>
>>> I've tried running it programmatically and through playbook as well. 
>>> Same findings on both.
>>>
>>> Here's  a bit of a traceback, this 
>>> happens when I manually stop the run (ctrl + c), if it helps. 
>>> I've put the code over here 
>>>  (it is highly 
>>> under developed as of now), you might have to modify certain things to make 
>>> it work if you want to reproduce in your own environment.
>>>
>>> Thanks for the time you've taken in helping me figure this out!
>>>
>>> On Monday, 27 June 2016 13:15:29 UTC-7, Matt Davis wrote:

 Without being able to reproduce what it's actually doing on my end, I 
 suspect it's blocking on the winrm Receive (you could verify that by 
 inserting Fiddler or another proxy in the middle). That *should* time out 
 eventually when no output comes back within the read timeout window- how 
 long have you waited? (could also try setting 
 ansible_winrm_read_timeout_sec to a nice low number to make it come back 
 faster)

 Another way you might be able to handle this (as kind of a poor-man's 
 async) would be to spawn the command in a new process via exec_command, 
 and 
 include a delay to prevent the hang during result fetch/disconnect, like:

 start-process -nonewwindow powershell.exe "-command sleep 2; 
 pnputil.exe -i -a driver/path"

 Unless you capture and marshal the results to a file yourself, you 
 wouldn't be able to detect a failure (this is the heavy-lifting that async 
 does for you), but should get the job done on the happy path.

 On Monday, June 27, 2016 at 9:45:37 AM UTC-7, Rahul Garg wrote:
>
> Hi Matt,
>
> Thank you for the advice, appreciate it!
>
> I tried doing it the 'cleaner' way using similar logic as in 
> win_reboot.py however after some initial testing Ansible still seems to 
> freeze on the connection.
> Could you please take a look at my plugin 
>  and let me know where I'm going wrong 
> or if I'm missing some tiny little detail.
>
> It basically freezes after the install driver command is sent to the 
> windows host (using pnputil).
>
> Thank you!
>
> On Monday, 20 June 2016 09:55:58 UTC-7, Matt Davis wrote:
>>
>> The module subsystem alone is not (and pretty much cannot safely) be 
>> made resilient to modules that interrupt the network connection.
>>
>> That said, all the bits and pieces are there to do what you need if 
>> you're doing custom work, but you'd have to string them together 
>> 

[ansible-project] Re: Windows - Ansible freezes when network connection disrupted

2016-06-28 Thread Rahul Garg
Thank you for all the help Matt, I was finally able to solve this today :)
I did it using scheduled job as you had mentioned, basically deferring the 
install action on the host to a later time so I don't lose the connection.

Fun times!

On Monday, 27 June 2016 17:57:41 UTC-7, Matt Davis wrote:
>
> The closest thing I've been able to approximate what you're doing is using 
> devmanview 
> /disable_enable to bounce my WinRM connection's NIC- it definitely hangs 
> on the Receive in that case, as I expected. Regardless, it's a race, so 
> without deferring the action on the Windows side, it's possible that the 
> NIC could bounce even before you've gotten the response from the WinRM 
> Command POST, much less the actual process results via the next WinRM 
> Receive call. 
>
> Unless you want to start working with things at the winrm level (trust me, 
> you probably don't), the trick is going to be deferring the device bounce 
> until *after* the WinRM session has completed (where I was going with the 
> sleep before the command in a separate process). This is further 
> complicated by WinRM's aggressive nuking of child processes once the parent 
> shell has exited, so it's also possible you're running into that (eg, WinRM 
> call completes, while Powershell subprocess is still sleeping, WinRM 
> helpfully nukes the process for you before/during the action you want). 
>
> You might also want to look into doing this in a scheduled job- that would 
> at least let you escape the constraints of the WinRM environment, though it 
> brings a whole host of other problems, too...
>
> Or just wait for async in 2.2. :)
>
>
>
>
>
> On Monday, June 27, 2016 at 3:03:20 PM UTC-7, Rahul Garg wrote:
>>
>> Thanks for the suggestions Matt. I've tried both the approaches. No luck 
>> unfortunately :|
>> From what I understand, Ansible seems to be waiting for the result to get 
>> added to the results dictionary. Even though I have changed the timeouts in 
>> win_reconnect (the plugin which I wrote).
>>
>> I've tried running it programmatically and through playbook as well. Same 
>> findings on both.
>>
>> Here's  a bit of a traceback, this happens 
>> when I manually stop the run (ctrl + c), if it helps. 
>> I've put the code over here 
>>  (it is highly 
>> under developed as of now), you might have to modify certain things to make 
>> it work if you want to reproduce in your own environment.
>>
>> Thanks for the time you've taken in helping me figure this out!
>>
>> On Monday, 27 June 2016 13:15:29 UTC-7, Matt Davis wrote:
>>>
>>> Without being able to reproduce what it's actually doing on my end, I 
>>> suspect it's blocking on the winrm Receive (you could verify that by 
>>> inserting Fiddler or another proxy in the middle). That *should* time out 
>>> eventually when no output comes back within the read timeout window- how 
>>> long have you waited? (could also try setting 
>>> ansible_winrm_read_timeout_sec to a nice low number to make it come back 
>>> faster)
>>>
>>> Another way you might be able to handle this (as kind of a poor-man's 
>>> async) would be to spawn the command in a new process via exec_command, and 
>>> include a delay to prevent the hang during result fetch/disconnect, like:
>>>
>>> start-process -nonewwindow powershell.exe "-command sleep 2; pnputil.exe 
>>> -i -a driver/path"
>>>
>>> Unless you capture and marshal the results to a file yourself, you 
>>> wouldn't be able to detect a failure (this is the heavy-lifting that async 
>>> does for you), but should get the job done on the happy path.
>>>
>>> On Monday, June 27, 2016 at 9:45:37 AM UTC-7, Rahul Garg wrote:

 Hi Matt,

 Thank you for the advice, appreciate it!

 I tried doing it the 'cleaner' way using similar logic as in 
 win_reboot.py however after some initial testing Ansible still seems to 
 freeze on the connection.
 Could you please take a look at my plugin 
  and let me know where I'm going wrong 
 or if I'm missing some tiny little detail.

 It basically freezes after the install driver command is sent to the 
 windows host (using pnputil).

 Thank you!

 On Monday, 20 June 2016 09:55:58 UTC-7, Matt Davis wrote:
>
> The module subsystem alone is not (and pretty much cannot safely) be 
> made resilient to modules that interrupt the network connection.
>
> That said, all the bits and pieces are there to do what you need if 
> you're doing custom work, but you'd have to string them together yourself 
> to make an action/module pair that can be resilient to changes that 
> interrupt the network connection. Take a look at the way the win_reboot 
> action 
> 
>  
> works- you can follow a similar pattern yourself: write a 

[ansible-project] Re: Using backslash in Windows path

2016-06-28 Thread 'J Hawkesworth' via Ansible Project
Just noticed you said windows paths. in playbooks I would suggest the 
following

1/ use ansible 2.0 or later

2/ use key: value (yaml style) rather than key=value key=value as you are 
less likely to need to quote vars if they aren't all on one line.

3/ If you aren't using templating you can usually just have bare paths 
without any quoting

win_copy:
   src: myfile.txt
   dest: C:\Myfiles\myfile.txt

4/ if you are using templating then you may need to double quote your 
windows paths - and if you are double quoting then use double backslash for 
path separator

vars:
   sub_dir: "parent_folder\\child_folder"

win_copy:
   src: myfile.txt
   dest: "C:\\Myfiles\\{{ sub_dir }}\\myfile.txt"

It looks like maybe you are trying to use a UNC path to access files from a 
second windows machine  \\someserver\\share.  Unfortunately windows treats 
this as a 'second hop' (hop 1 is from ansible controller to windows box, 
hop 2 is from windows box to \\second_machine), and 'second hop' 
communication is usually disallowed.

If you have pywinrm installed and you set up kerberos delegation you can 
get round this limitation, but this is new functionality and not yet 
documented.  If possible it might be easier to use fetch to collect files 
from one windows machine and then win_copy to push the files out to your 
windows machines if you don't want to, or can't set up kerberos delegation.

Hope this helps,

Jon


On Tuesday, June 28, 2016 at 11:04:19 PM UTC+1, J Hawkesworth wrote:
>
> Can you give a bit more detail?
>
> Don't forget that as well as python parsing, there is yaml parsing and if 
> you are using templates - {{ }} then there is jinja2 parsing too.
>
> So can you share a minimal version of the problem?
>
> Jon
>
> On Tuesday, June 28, 2016 at 9:22:55 PM UTC+1, Karol Olczak wrote:
>>
>> Hi 
>>
>> What is the most efficient way to "push" backslashes in ansible playbooks 
>> ? 
>>
>> My playbook does not work because Python cut backslashes or add new one. 
>>
>> e.g. //hostname001/foo/ 
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cc90f9b9-18f1-4630-bdff-bbad5aed8924%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: 500 WinRMTransport. SSL: CERTIFCATE_VERIFY_FAILED

2016-06-28 Thread 'J Hawkesworth' via Ansible Project
Hi,

I think you don't need to set 
ansible_winrm_transport: ssl
assuming you have set

ansible_port: 5986

This is because 5986 is the https listener port for winrm 

Please can you try without this setting and report back?



On Tuesday, June 28, 2016 at 9:22:57 PM UTC+1, Brian wrote:
>
> Installed ansible 2.1.0.0 on Ubuntu and I'm getting the infamous:  
>
> ssl: 500 WinRMTransport. [SSL: CERTIFICATE_VERIFY_FAILED] certificate 
> verify failed (_ssl.c:590)  
>
> error when trying to connect to a windows client.  I followed the 
> instructions here  and 
> the powershell script runs with no errors but to no avail.  
>
> I'm using ansible_winrm_transport: ssl
> ansible_winrm_server_cert_validation: ignore
>
> But nothing seems to work.  Is there some documentation somewhere that 
> explains how to set up a windows client and configure ansible to connect to 
> it (besides all the bits and pieces scattered about the forums, that is)? 
>  Clearly the above referenced documentation is missing some important 
> detail. 
>
> This is on a local network.
>
> Thanks,
>
> Brian
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e1c4e1d8-4c26-4152-9373-7d969510f35c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Using backslash in Windows path

2016-06-28 Thread 'J Hawkesworth' via Ansible Project
Can you give a bit more detail?

Don't forget that as well as python parsing, there is yaml parsing and if 
you are using templates - {{ }} then there is jinja2 parsing too.

So can you share a minimal version of the problem?

Jon

On Tuesday, June 28, 2016 at 9:22:55 PM UTC+1, Karol Olczak wrote:
>
> Hi 
>
> What is the most efficient way to "push" backslashes in ansible playbooks 
> ? 
>
> My playbook does not work because Python cut backslashes or add new one. 
>
> e.g. //hostname001/foo/ 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2cb6c8c3-8fc3-4e48-9f66-21e5d39fdeb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ubuntu playbook syntax

2016-06-28 Thread Kai Stian Olstad

On 28. juni 2016 19:51, teddy mills wrote:

This playbook works, but I dont think this is the proper way to install
multiple packages.
Can someone correct this and show how it should be done ? TIA


If it work and is understandable it's OK in my book, but it could be 
more condense.




ansible-playbook/root/aplays/core.pb -u teddy -k

###
- hosts: teddy
   sudo: true
   tasks:
- name: install sysstat
  apt: name=sysstat update_cache=yes state=latest

- name: install htop
  apt: name=htop update_cache=yes state=latest

- name: install curl
  apt: name=curl update_cache=yes state=latest

- name: install bzip2
  apt: name=bzip2 update_cache=yes state=latest

- name: install lft
  apt: name=lft update_cache=yes state=latest

- name: install traceroute
  apt: name=traceroute update_cache=yes state=latest

- name: install ncdu
  apt: name=ncdu update_cache=yes state=latest

- name: install midnight-commander mc
  apt: name=mc update_cache=yes state=latest

- name: install screen
  apt: name=screen update_cache=yes state=latest

- name: install wget
  apt: name=wget update_cache=yes state=latest


- name: install apt packages
  apt: name={{ item }} update_cache=yes state=latest
  with_items:
- sysstat
- htop
- curl
- bzip

I think you see the pattern, just continue to add the rest of the packages.

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5772E826.2030908%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Authentication or Permission Failure

2016-06-28 Thread brendan maynard
I am running ansible version 2.1.0.0

On Tue, Jun 28, 2016 at 4:01 PM, brendan maynard 
wrote:

> I am getting a issue that appears to be a file E & W error on my local
> machine when executing simple ad hoc modules (i.e. ping) -
>
> test@ubuntu:~$ ansible hosts -m ping -
> Using /etc/ansible/ansible.cfg as config file
> Loaded callback minimal of type stdout, v2.0
> <192.168.56.236> ESTABLISH SSH CONNECTION FOR USER: test
> <192.168.56.236> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o
> ControlPersist=60s -o StrictHostKeyChecking=no -o
> KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o PasswordAuthentication=no -o User=test -o ConnectTimeout=10 -o
> ControlPath=/home/test/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.56.236
> '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo
> /tmp/ansible-tmp-1467143557.54-130391232423944 `" && echo
> ansible-tmp-1467143557.54-130391232423944="` echo
> /tmp/ansible-tmp-1467143557.54-130391232423944 `" ) && sleep 0'"'"''
> }
> 192.168.56.236 | UNREACHABLE! => {
> "changed": false,
> "msg": "Authentication or permission failure. In some cases, you may
> have been able to authenticate and did not have permissions on the remote
> directory. Consider changing the remote temp path in ansible.cfg to a path
> rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo
> /tmp/ansible-tmp-1467143557.54-130391232423944 `\" && echo
> ansible-tmp-1467143557.54-130391232423944=\"` echo
> /tmp/ansible-tmp-1467143557.54-130391232423944 `\" ), exited with result
> 16: Syntax error while parsing '/bin/sh -c '( umask 77 && mkdir -p \"` echo
> /tmp/ansible-tmp-1467143557.54-130391232423944 `\" && echo
> ansible-tmp-1467143557.54-130391232423944=\"` echo
> /tmp/ansible-tmp-1467143557.54-130391232423944 `\" ) && sleep 0''\n\n\nCmd
> exec error.\n",
> "unreachable": true
>
> I can SSH from my machines to the localhost, and from the local host to
> the machines via public key.  I can also create the directory above with no
> issue...  I have changed the remote_tmp directory to /tmp, and it has 1777
> privileges...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f4918362-884f-4928-88e1-7d7a5838302d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAyUPk08OmWrBjxWVCmaj0cFBLDUr4CWF-dDLSE98VS93egtoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] 500 WinRMTransport. SSL: CERTIFCATE_VERIFY_FAILED

2016-06-28 Thread Brian
Installed ansible 2.1.0.0 on Ubuntu and I'm getting the infamous:  

ssl: 500 WinRMTransport. [SSL: CERTIFICATE_VERIFY_FAILED] certificate 
verify failed (_ssl.c:590)  

error when trying to connect to a windows client.  I followed the 
instructions here  and 
the powershell script runs with no errors but to no avail.  

I'm using ansible_winrm_transport: ssl
ansible_winrm_server_cert_validation: ignore

But nothing seems to work.  Is there some documentation somewhere that 
explains how to set up a windows client and configure ansible to connect to 
it (besides all the bits and pieces scattered about the forums, that is)? 
 Clearly the above referenced documentation is missing some important 
detail. 

This is on a local network.

Thanks,

Brian

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6024546d-8e90-468b-b39f-8c4343fefaa2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Authentication or Permission Failure

2016-06-28 Thread brendan maynard
I am getting a issue that appears to be a file E & W error on my local 
machine when executing simple ad hoc modules (i.e. ping) - 

test@ubuntu:~$ ansible hosts -m ping -
Using /etc/ansible/ansible.cfg as config file
Loaded callback minimal of type stdout, v2.0
<192.168.56.236> ESTABLISH SSH CONNECTION FOR USER: test
<192.168.56.236> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o 
ControlPersist=60s -o StrictHostKeyChecking=no -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o User=test -o ConnectTimeout=10 -o 
ControlPath=/home/test/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.56.236 
'/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo 
/tmp/ansible-tmp-1467143557.54-130391232423944 `" && echo 
ansible-tmp-1467143557.54-130391232423944="` echo 
/tmp/ansible-tmp-1467143557.54-130391232423944 `" ) && sleep 0'"'"''
}
192.168.56.236 | UNREACHABLE! => {
"changed": false, 
"msg": "Authentication or permission failure. In some cases, you may 
have been able to authenticate and did not have permissions on the remote 
directory. Consider changing the remote temp path in ansible.cfg to a path 
rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo 
/tmp/ansible-tmp-1467143557.54-130391232423944 `\" && echo 
ansible-tmp-1467143557.54-130391232423944=\"` echo 
/tmp/ansible-tmp-1467143557.54-130391232423944 `\" ), exited with result 
16: Syntax error while parsing '/bin/sh -c '( umask 77 && mkdir -p \"` echo 
/tmp/ansible-tmp-1467143557.54-130391232423944 `\" && echo 
ansible-tmp-1467143557.54-130391232423944=\"` echo 
/tmp/ansible-tmp-1467143557.54-130391232423944 `\" ) && sleep 0''\n\n\nCmd 
exec error.\n", 
"unreachable": true

I can SSH from my machines to the localhost, and from the local host to the 
machines via public key.  I can also create the directory above with no 
issue...  I have changed the remote_tmp directory to /tmp, and it has 1777 
privileges...

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f4918362-884f-4928-88e1-7d7a5838302d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Single quotes inside Jinja2 string literals

2016-06-28 Thread Deepali Mittal
I am getting the same error using ansible 2.1 stable branch. Did you find a 
work around for this? 

- name: Set ELB variables
  set_fact:
host: "{{ elb_ins.elb.dns_name }}"
url: 'http//{{ elb_ins.elb.dns_name }}/Server/'


On Wednesday, January 27, 2016 at 3:22:49 PM UTC+5:30, Christian Thiemann 
wrote:
>
> How can I include single quotes in single-quoted Jinja2 string literals in 
> Ansible 2.0?
>
> Minimal test case:
>
> ---
> - hosts: localhost
>   tasks:
> - debug: msg="{{ 'foo\'bar\'baz' }}"
>
> Ansible 1.9.4:
>
> ok: [localhost] => {
> "msg": "foo'bar'baz"
> }
>
> Ansible devel:
>
> fatal: [localhost]: FAILED! => {"failed": true, "msg": "template error 
> while templating string: expected token 'end of print statement', got 'bar'"
> }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3084d4a1-57e3-444c-bead-fdcd5b1bda4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Using backslash in Windows path

2016-06-28 Thread Karol Olczak
Hi

What is the most efficient way to "push" backslashes in ansible playbooks ?

My playbook does not work because Python cut backslashes or add new one.

e.g. //hostname001/foo/


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d0b15e0b-623a-45cb-b760-91ee59bace04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ubuntu playbook syntax

2016-06-28 Thread teddy mills

This playbook works, but I dont think this is the proper way to install 
multiple packages.
Can someone correct this and show how it should be done ? TIA



ansible-playbook/root/aplays/core.pb -u teddy -k

###
- hosts: teddy
  sudo: true
  tasks:
   - name: install sysstat
 apt: name=sysstat update_cache=yes state=latest

   - name: install htop
 apt: name=htop update_cache=yes state=latest

   - name: install curl
 apt: name=curl update_cache=yes state=latest

   - name: install bzip2
 apt: name=bzip2 update_cache=yes state=latest

   - name: install lft
 apt: name=lft update_cache=yes state=latest

   - name: install traceroute
 apt: name=traceroute update_cache=yes state=latest

   - name: install ncdu
 apt: name=ncdu update_cache=yes state=latest

   - name: install midnight-commander mc
 apt: name=mc update_cache=yes state=latest

   - name: install screen
 apt: name=screen update_cache=yes state=latest

   - name: install wget
 apt: name=wget update_cache=yes state=latest

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/04a0efe5-e277-4974-9197-b4fb09b7cc0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] compare dates in filenames to variable

2016-06-28 Thread Guy Przytula
we are using an older version of ansible 1.4 (Because we had a problem 
after upgarde) on linux and targetting linux and aix

I have a question about how to :
having a folder with filenames like   : 
SAP500.4.db2istm5.DBPART000.20160628120023.001   keeping a date 20160628
in the playbook we collect a variable : eg 20160627

we only want to copy files to another directory if the file has a date 
equal to variable or more recent
eg. 20160627-20160628-20160629... all these dates would do..
if anybody has a sample code how to achieve this, please share
I have tried with date -d function but -d is not supported on aix (even in 
bash)..

thanks for all update/help
Best Regards, Guy Przytula

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f6d8eb18-f9ad-4b74-84f3-e1127b989385%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Environment-separated inventories ignored with cached host data

2016-06-28 Thread Brian Coca
The fact_cache should not be an issue unless hosts are named the same.

As for the inventory issue, are you using caching in the inventory scripts?
If you are using the same cache directory names ... that could explain your
issue (i would add environment to the path).


--
Brian Coca

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7fhSdE6%2B0QU4%2BdGt98dcOywkV16W7yTEhipjQ2orJj-FQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Environment-separated inventories ignored with cached host data

2016-06-28 Thread Guy Knights
I have my inventory separated into environment-specific directories, with
an ec2 dynamic inventory script in each inventory dir. Each ec2 inventory
script filters out instances by their "Environment" tag. I run my playbooks
by using the '-i' command-line parameter and pointing to the specific
environment inventory I want to run, which normally works.

However, I ran into an issue this morning where I was trying to run a
playbook against my staging servers but ansible-playbook was instead
running it over my prod servers. I re-ran it a few times, including
--list-hosts to confirm the instances it was trying to apply the playbook
to, but it was still using my prod inventory. I also confirmed that I was
using '-i inventory/stage/' in the command, which I was.

I had a thought, and removed both /tmp/ansible_fact_cache and
~/.ansible/tmp/* and re-ran the exact same command, and this time my
staging inventory was used correctly.

Is this a known issue? Have I configured something wrong here? I'm very
confused by this behaviour.

Thanks,
Guy

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CANNH9muXO3G%3D1DhqzcmzffD7o706Efm%3DEXxuPt84sG93cT23Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Creating Dynamic Inventory with CloudFormation Outputs

2016-06-28 Thread Stephen Granger
Just a quick response, some what self promoting but hopefully helpful.

https://github.com/ansible/ansible-modules-extras/pull/2329
cloudformation_facts module

I'd previously put together a lookup plugin (mainly through combining
others efforts)
https://github.com/ansible/ansible/pull/12880
I'm going to make the time to rewrite this using boto3 and try and get it
completed before the end of July.

This will give you the resources that were created by the cloudformation
stacks. It's also possible to use the ec2_facts,
http://docs.ansible.com/ansible/ec2_facts_module.html and  ec2_remote_facts
http://docs.ansible.com/ansible/ec2_remote_facts_module.html to get a list
of the ec2 instances and then iterate them through through the add_host
http://docs.ansible.com/ansible/add_host_module.html to add them to an
in-memory inventory.

Similar to the example here,
http://docs.ansible.com/ansible/ec2_module.html#examples

On 28 June 2016 at 03:03, Mocking Bird  wrote:

> I have the same question. Why there isn't any answer here?
>
> On Friday, June 17, 2016 at 8:25:35 PM UTC+7, divya mangotra wrote:
>>
>> I am using AWS CloudFormation to create infrastructure and the template
>> creates EC2 instances, Elasticache cluster and RDS instance. Now, I am
>> wondering as to how to use the CloudFormation outputs to create Ansible
>> Dynamic Inventory? In the static inventory files I also have *groups of
>> groups*. How do I tweak my *ec2.ini *and *ec2.py* to accomodate the same?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/0b74b57c-0228-41bc-a2df-a520d2dcb943%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BemtqvBaMX5%3DXG6JOwmjZC73JB_-%2B0NQKmhKP%2BjFTvpc02SHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ec2.py and the incredibly no good bad corporate overlords policies.

2016-06-28 Thread Joe Garcia
Ok that fixed that issue!  Thank you very much.  However for some reason
the first time I run ( or run again after a short period of time) the ping
module against all hosts it fails on the first 2 hosts always fails with
the same error.  If i run it a second time right after it works just fine.
Here is the error:

"msg": "failed to transfer file to
/home/ec2-user/.ansible/tmp/ansible-tmp-1467127255.64-133176804889810/ping:\nsftp>
put /tmp/tmpCl5Pww
/home/ec2-user/.ansible/tmp/ansible-tmp-1467127255.64-133176804889810/ping\n\nOpenSSH_7.2p2
Ubuntu-4ubuntu1, OpenSSL 1.0.2g-fips  1 Mar 2016\r\ndebug1: Reading
configuration data /home//.ssh/config\r\ndebug1:
/home//.ssh/config line 1: Applying options for *\r\ndebug1:
Reading configuration data /etc/ssh/ssh_config\r\ndebug1:
/etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux:
Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2:
mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards:
request forwardings: 0 local, 0 remote\r\ndebug3:
mux_client_request_session: entering\r\ndebug3: mux_client_request_alive:
entering\r\ndebug3: mux_client_request_alive: done pid = 6845\r\ndebug3:
mux_client_request_session: session request sent\r\ndebug1:
mux_client_request_session: master session id: 4\r\ndebug2: Remote version:
3\r\ndebug2: Server supports extension \"posix-ren...@openssh.com\"
revision 1\r\ndebug2: Server supports extension \"stat...@openssh.com\"
revision 2\r\ndebug2: Server supports extension \"fstat...@openssh.com\"
revision 2\r\ndebug2: Server supports extension \"hardl...@openssh.com\"
revision 1\r\ndebug2: Server supports extension \"fs...@openssh.com\"
revision 1\r\ndebug3: Sent message fd 5 T:16 I:1\r\ndebug3:
SSH_FXP_REALPATH . -> /home/ec2-user size 0\r\ndebug3: Looking up
/tmp/tmpCl5Pww\r\ndebug3: Sent message fd 5 T:17 I:2\r\ndebug3: Received
stat reply T:101 I:2\r\ndebug1: Couldn't stat remote file: No such file or
directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3
P:/home/ec2-user/.ansible/tmp/ansible-tmp-1467127255.64-133176804889810/ping\r\nremote
open(\"/home/ec2-user/.ansible/tmp/ansible-tmp-1467127255.64-133176804889810/ping\"):
No such file or directory\r\ndebug3: mux_client_read_packet: read header
failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n"


On Tue, Jun 28, 2016 at 3:17 AM Alexey Vazhnov 
wrote:

> Check «DNS Hostnames=Yes» in your VPC settings (not in Ansible).
>
>
> On Friday, June 24, 2016 at 10:35:19 PM UTC+5, Joe Garcia wrote:
>>
>> Hey All,
>>
>> Our corporate overlords have deemed it prudent to not allow IP addresses
>> to go out through our proxy.  So we cannot ssh to an IP address and have to
>> use the FQDN.  The ec2.py script does not return the DNS record of the
>> public IP of the server.  It is always returning the public IP address even
>> though I have set the following in ec2.ini:
>>
>> destination_variable = public_dns_name
>> vpc_destination_variable = public_dns_name
>>
>> Anybody know why?
>>
>> Below is the full ec2.ini file.
>>
>> Thanks,
>>
>> Joe
>>
>> # Ansible EC2 external inventory script settings
>> #
>>
>> [ec2]
>>
>> # to talk to a private eucalyptus instance uncomment these lines
>> # and edit edit eucalyptus_host to be the host name of your cloud
>> controller
>> #eucalyptus = True
>> #eucalyptus_host = clc.cloud.domain.org
>>
>> # AWS regions to make calls to. Set this to 'all' to make request to all
>> regions
>> # in AWS and merge the results together. Alternatively, set this to a
>> comma
>> # separated list of regions. E.g. 'us-east-1,us-west-1,us-west-2'
>> regions = all
>> regions_exclude = us-gov-west-1,cn-north-1,us-east-1
>>
>> # When generating inventory, Ansible needs to know how to address a
>> server.
>> # Each EC2 instance has a lot of variables associated with it. Here is
>> the list:
>> #
>> http://docs.pythonboto.org/en/latest/ref/ec2.html#module-boto.ec2.instance
>> # Below are 2 variables that are used as the address of a server:
>> #   - destination_variable
>> #   - vpc_destination_variable
>>
>> # This is the normal destination variable to use. If you are running
>> Ansible
>> # from outside EC2, then 'public_dns_name' makes the most sense. If you
>> are
>> # running Ansible from within EC2, then perhaps you want to use the
>> internal
>> # address, and should set this to 'private_dns_name'. The key of an EC2
>> tag
>> # may optionally be used; however the boto instance variables hold
>> precedence
>> # in the event of a collision.
>> destination_variable = public_dns_name
>>
>> # This allows you to override the inventory_name with an ec2 variable,
>> instead
>> # of using the destination_variable above. Addressing (aka
>> ansible_ssh_host)
>> # will still use destination_variable. Tags should be written as
>> 'tag_TAGNAME'.
>> #hostname_variable = tag_Name
>>
>> # For server inside a VPC, using DNS names may not make sense. When an
>> instance
>> # has 'subnet_id' set, 

[ansible-project] Ansible set_fact not working

2016-06-28 Thread sreenivas narayan


I am trying to list the directory size of certain directory in list of 
servers.   In the below  playbook the ruby script along with ansible task 
will create file with all instance details and saving it 
in region-ec2-list.txt. What I need in lineinfile  is to,  it should insert 
the set_fact output to file /tmp/disk-ec2-list.txt below the line {{ 
inventory_hostname }} as the output of the ruby script will have same {{ 
inventory_hostname }} , that is public ip


- name: Listing ec2 instance in all regions(us-east-1", "us-west-1", 
"us-west-2", "eu-west-1", "eu-central-1", "ap-southeast-2)
  local_action: command /usr/bin/ruby /root/sree/test/list-all.rb "{{ 
corp_aws_key_id }}" "{{ corp_aws_secret_access_key }}"
  register: output_ruby
  run_once: true
- name: copy output to file
  local_action: copy content="{{ output_ruby.stdout }}" 
dest="/tmp/disk-ec2-list.txt"
- name: Execute du -sh /var/lib/mysql
  command: du -sh /var/lib/mysql
  register: disk_usage_mysql
- set_fact: mysql={{ disk_usage_mysql.stdout }}
- name: Execute du -sh  /usr/local/wdd/wddrdata/attachment
  command: du -sh /usr/local/wdd/wddrdata/attachment
  register: disk_usage_wddrdata
- set_fact: wddrdata={{ disk_usage_wddyrdata.stdout }}
- name: debug
  debug: var="{{ inventory_hostname }} {{ mysql }} {{ wddrdata }}"
- name: localaction
#  local_action: copy content= "{{ inventory_hostname }} {{ mysql }} 
{{ wddrdata }}" dest="/tmp/disk-ec2-list.txt"
#  local_action: lineinfile dest=/tmp/disk-ec2-list.txt insertafter=EOF 
line="{{ inventory_hostname }} {{ mysql }} {{ wddrdata }}" create=yes


In short: how to insert a file using lineinfile after string "{{ 
inventory_hostname }}"


please help. Also let me know if anymore details is required

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2d82700b-9059-440b-9973-e3d67ea509e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible set_fact not working with lineinfile

2016-06-28 Thread sreenivas narayan
I am trying to list the directory size of certain directory in list of 
servers.   In the below  playbook the ruby script along with ansible task 
will create file with all instance details and saving it 
in region-ec2-list.txt. What I need in lineinfile  is to,  it should insert 
the set_fact output to file /tmp/disk-ec2-list.txt below the line {{ 
inventory_hostname }} as the output of the ruby script will have same {{ 
inventory_hostname }} , that is public ip


- name: Listing ec2 instance in all regions(us-east-1", "us-west-1", 
"us-west-2", "eu-west-1", "eu-central-1", "ap-southeast-2)
  local_action: command /usr/bin/ruby /root/sree/test/list-all.rb "{{ 
corp_aws_key_id }}" "{{ corp_aws_secret_access_key }}"
  register: output_ruby
  run_once: true
- name: copy output to file
  local_action: copy content="{{ output_ruby.stdout }}" 
dest="/tmp/disk-ec2-list.txt"
- name: Execute du -sh /var/lib/mysql
  command: du -sh /var/lib/mysql
  register: disk_usage_mysql
- set_fact: mysql={{ disk_usage_mysql.stdout }}
- name: Execute du -sh  /usr/local/zephyr/zephyrdata/attachment
  command: du -sh /usr/local/zephyr/zephyrdata/attachment
  register: disk_usage_zephyrdata
- set_fact: zephyrdata={{ disk_usage_zephyrdata.stdout }}
- name: debug
  debug: var="{{ inventory_hostname }} {{ mysql }} {{ zephyrdata }}"
- name: localaction
#  local_action: copy content= "{{ inventory_hostname }} {{ mysql }} {{ 
zephyrdata }}" dest="/tmp/disk-ec2-list.txt"
#  local_action: lineinfile dest=/tmp/disk-ec2-list.txt insertafter=EOF 
line="{{ inventory_hostname }} {{ mysql }} {{ zephyrdata }}" create=yes


In short: how to insert a file using lineinfile after string "{{ 
inventory_hostname }}"


please help. Also let me know if anymore details is required

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/910dfb1c-8907-48f6-96c5-ea58430d4964%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Still in 2.1?: Nested values always cast to string

2016-06-28 Thread Brian Coca
​The issue fixed was casting in YAML:

varname: 1

not about templating, as YAML only sees a string:

varname "{{1}}"
​
​^ casting to |int in the YAML definition is mostly useless, you need to
cast on consumption:

option={{varname|int}}​

--
Brian Coca

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7cVciwZEmbG3rYh-fF%3DbzN7uDTGuZDucayCaY48US7TFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible when statement error

2016-06-28 Thread Brian Coca
you error has '{% if \"XQWATCHER_GIT_IDENTITY\" id defined %}', which seems
to indicate you misspelled 'is' as 'id'.



--
Brian Coca

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7eB%3D7V2yF7WS1OhnWce0x-CD1nVnsrKkcP3GwUcT7ii%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible when statement error

2016-06-28 Thread Arbab Nazar
sorry about the error, here is the error:

fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional
check '\"XQWATCHER_GIT_IDENTITY\" id defined' failed. The error was:
template error while templating string: expected token 'end of statement
block', got 'id'. String: {% if \"XQWATCHER_GIT_IDENTITY\" id defined %}
True {% else %} False {% endif %}\n\nThe error appears to have been in
'/Users/arbab/test-ansible/test.yml': line 8, column 7, but may\nbe
elsewhere in the file depending on the exact syntax problem.\n\nThe
offending line appears to be:\n\n  tasks:\n- debug:\n  ^ here\n"}

On Tue, Jun 28, 2016 at 7:02 PM, Arbab Nazar  wrote:

> ---
> - hosts: all
>   gather_facts: no
>   vars:
> XQWATCHER_GIT_IDENTITY: !!null
>
>   tasks:
> - debug:
> msg: "Test Success"
>   when: XQWATCHER_GIT_IDENTITY is defined
>
> Getting this error when I run the playbook
>
> ansible-playbook -i "localhost," test.yml -c local
>
>
>
> PLAY [all] 
> *
>
> TASK [debug] 
> ***
> fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional check 
> 'XQWATCHER_GIT_IDENTITY' failed. The error was: error while evaluating 
> conditional (XQWATCHER_GIT_IDENTITY): 'abc' is undefined\n\nThe error appears 
> to have been in '/Users/arbab/test-ansible/test.yml': line 8, column 7, but 
> may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
> offending line appears to be:\n\n  tasks:\n- debug:\n  ^ here\n"}
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/IyrUlKnf2ew/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/77bd8f7a-27d5-44c7-b597-ebaa0483d414%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMfRAg%3D3sKrCcecV_9LWERW9e%2B7Uw3p%2B7RjOVNCMoNaKxRTAOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible when statement error

2016-06-28 Thread Arbab Nazar


---
- hosts: all
  gather_facts: no
  vars:
XQWATCHER_GIT_IDENTITY: !!null

  tasks:
- debug:
msg: "Test Success"
  when: XQWATCHER_GIT_IDENTITY is defined

Getting this error when I run the playbook

ansible-playbook -i "localhost," test.yml -c local



PLAY [all] *

TASK [debug] ***
fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional check 
'XQWATCHER_GIT_IDENTITY' failed. The error was: error while evaluating 
conditional (XQWATCHER_GIT_IDENTITY): 'abc' is undefined\n\nThe error appears 
to have been in '/Users/arbab/test-ansible/test.yml': line 8, column 7, but 
may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
offending line appears to be:\n\n  tasks:\n- debug:\n  ^ here\n"}

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/77bd8f7a-27d5-44c7-b597-ebaa0483d414%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] lineinfile with a backslash in the regexp field

2016-06-28 Thread fanvalt
Hello,

I would like to replace the following line:
jstl.jar,taglibs-standard-spec-*.jar*,\*
with:
jstl.jar,taglibs-standard-spec-*.jar,icu4j-2.6.1.jar,\

I tried to double the backslash without any success, the issue occurs only 
on the regexp backslash:

For example, when doing this:
- name: catalina.properties jstl
  lineinfile:
dest: /{{ tomcatdir }}/conf/catalina.properties
regexp: "^jstl.jar,taglibs-standard-spec-*.jar*,.**"
line: "jstl.jar,taglibs-standard-spec-*.jar,icu4j-2.6.1.jar,\\"

I have no error but an extra line as it does not recognize the line to 
replace, I thought '.' was meaning any character and '*' as many as we want.
When using this one:
regexp: "^jstl.jar,taglibs-standard-spec-*.jar*,\\*"
line: "jstl.jar,taglibs-standard-spec-*.jar,icu4j-2.6.1.jar,\\"

I have a syntax error.

Can you help me about using the backslash in the regexp parameter, without 
being a special character ?

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/edb9fc0b-97b7-419f-83f7-bceed80e4a3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Creating Dynamic Inventory with CloudFormation Outputs

2016-06-28 Thread Mocking Bird
I have the same question. Why there isn't any answer here?

On Friday, June 17, 2016 at 8:25:35 PM UTC+7, divya mangotra wrote:
>
> I am using AWS CloudFormation to create infrastructure and the template 
> creates EC2 instances, Elasticache cluster and RDS instance. Now, I am 
> wondering as to how to use the CloudFormation outputs to create Ansible 
> Dynamic Inventory? In the static inventory files I also have *groups of 
> groups*. How do I tweak my *ec2.ini *and *ec2.py* to accomodate the same?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0b74b57c-0228-41bc-a2df-a520d2dcb943%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] by using ansible-playbook how to built a server on awazon web service cloud

2016-06-28 Thread rameshlinux86
Hi 
how to create ansible-playbook on awazon web services cloud.?

install a t2.micro server in the "us east" region with 15Gb additional EBS 
storage.
 pick ubuntu 14.04 LTS 64 bit and install apache,php,mysql,ntp


please reply me as soon as possible.


Regrads.
raja.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/81d2b45d-ad43-4b19-a0a8-029446bec784%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

2016-06-28 Thread 'J Hawkesworth' via Ansible Project
Hi,

Since python 2.7.9  ( I think) python's default behavior has been to 
validate certificates for any https connections.

The certificate used by the windows hosts is likely self-generated, 
therefore won't be fully trusted.

So in order to avoid the certificate check, you have to set the following 
var in your ansible inventory/group_vars that apply to your windows hosts.

# The following is necessary for Python 2.7.9+ when using default WinRM 
self-signed certificates:ansible_winrm_server_cert_validation: ignore


Its documented here: 
http://docs.ansible.com/ansible/intro_windows.html#inventory

If you would rather python did check the certificate then you will either 
need to trust the cert for each of your windows hosts, or acquire trusted 
(not self-signed) certificates for each of your windows hosts, add them to 
the the computer certificate store and ensure that winrm is using your new 
certificate.

Hope this helps,

Jon


On Tuesday, June 28, 2016 at 1:37:59 AM UTC+1, Hugo Enrique Hernández 
Priego wrote:
>
> Hi
>
> I'm running ansible against a windows host for testing purposes. but i am 
> getting this error :
>
> Red Hat 7.2
> Ansible 1.9.2
>
> [ansible-windows]$ ansible windows -i host -m win_ping -v
>
>  ESTABLISH WINRM CONNECTION FOR USER: prhtblad 
> on PORT 5986 TO srvspodvlmx01.wt.mx.corp
>  WINRM CONNECT: transport=plaintext endpoint=
> https://srvspodvlmx01.wt.mx.corp:5986/wsman
> srvspodvlmx01.wt.mx.corp | FAILED => Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 
> 582, in _executor
> exec_rc = self._executor_internal(host, new_stdin)
>   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 
> 785, in _executor_internal
> return self._executor_internal_inner(host, self.module_name, 
> self.module_args, inject, port, complex_args=complex_args)
>   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 
> 964, in _executor_internal_inner
> conn = self.connector.connect(actual_host, actual_port, actual_user, 
> actual_pass, actual_transport, actual_private_key_file, delegate_host)
>   File "/usr/lib/python2.7/site-packages/ansible/runner/connection.py", 
> line 52, in connect
> self.active = conn.connect()
>   File 
> "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/winrm.py",
>  
> line 140, in connect
> self.protocol = self._winrm_connect()
>   File 
> "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/winrm.py",
>  
> line 96, in _winrm_connect
> protocol.send_message('')
>   File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 207, in 
> send_message
> return self.transport.send_message(message)
>   File "/usr/lib/python2.7/site-packages/winrm/transport.py", line 173, in 
> send_message
> response = self.session.send(prepared_request, 
> timeout=self.read_timeout_sec)
>   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 585, 
> in send
> r = adapter.send(request, **kwargs)
>   File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 477, 
> in send
> raise SSLError(e, request=request)
> SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
> (_ssl.c:765)
>
> Any idea about this error ?
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fe44292a-bc85-49a9-80f3-270c6b338556%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ec2.py and the incredibly no good bad corporate overlords policies.

2016-06-28 Thread Alexey Vazhnov
Check «DNS Hostnames=Yes» in your VPC settings (not in Ansible).

On Friday, June 24, 2016 at 10:35:19 PM UTC+5, Joe Garcia wrote:
>
> Hey All,
>
> Our corporate overlords have deemed it prudent to not allow IP addresses 
> to go out through our proxy.  So we cannot ssh to an IP address and have to 
> use the FQDN.  The ec2.py script does not return the DNS record of the 
> public IP of the server.  It is always returning the public IP address even 
> though I have set the following in ec2.ini:
>
> destination_variable = public_dns_name
> vpc_destination_variable = public_dns_name
>
> Anybody know why?
>
> Below is the full ec2.ini file.
>
> Thanks,
>
> Joe
>
> # Ansible EC2 external inventory script settings
> #
>
> [ec2]
>
> # to talk to a private eucalyptus instance uncomment these lines
> # and edit edit eucalyptus_host to be the host name of your cloud 
> controller
> #eucalyptus = True
> #eucalyptus_host = clc.cloud.domain.org
>
> # AWS regions to make calls to. Set this to 'all' to make request to all 
> regions
> # in AWS and merge the results together. Alternatively, set this to a comma
> # separated list of regions. E.g. 'us-east-1,us-west-1,us-west-2'
> regions = all
> regions_exclude = us-gov-west-1,cn-north-1,us-east-1
>
> # When generating inventory, Ansible needs to know how to address a server.
> # Each EC2 instance has a lot of variables associated with it. Here is the 
> list:
> #   
> http://docs.pythonboto.org/en/latest/ref/ec2.html#module-boto.ec2.instance
> # Below are 2 variables that are used as the address of a server:
> #   - destination_variable
> #   - vpc_destination_variable
>
> # This is the normal destination variable to use. If you are running 
> Ansible
> # from outside EC2, then 'public_dns_name' makes the most sense. If you are
> # running Ansible from within EC2, then perhaps you want to use the 
> internal
> # address, and should set this to 'private_dns_name'. The key of an EC2 tag
> # may optionally be used; however the boto instance variables hold 
> precedence
> # in the event of a collision.
> destination_variable = public_dns_name
>
> # This allows you to override the inventory_name with an ec2 variable, 
> instead
> # of using the destination_variable above. Addressing (aka 
> ansible_ssh_host)
> # will still use destination_variable. Tags should be written as 
> 'tag_TAGNAME'.
> #hostname_variable = tag_Name
>
> # For server inside a VPC, using DNS names may not make sense. When an 
> instance
> # has 'subnet_id' set, this variable is used. If the subnet is public, 
> setting
> # this to 'ip_address' will return the public IP address. For instances in 
> a
> # private subnet, this should be set to 'private_ip_address', and Ansible 
> must
> # be run from within EC2. The key of an EC2 tag may optionally be used; 
> however
> # the boto instance variables hold precedence in the event of a collision.
> # WARNING: - instances that are in the private vpc, _without_ public ip 
> address
> # will not be listed in the inventory until You set:
> # vpc_destination_variable = private_ip_address
> #vpc_destination_variable = ip_address
> vpc_destination_variable = public_dns_name
>
> # The following two settings allow flexible ansible host naming based on a
> # python format string and a comma-separated list of ec2 tags.  Note that:
> #
> # 1) If the tags referenced are not present for some instances, empty 
> strings
> #will be substituted in the format string.
> # 2) This overrides both destination_variable and vpc_destination_variable.
> #
> #destination_format = {0}.{1}.example.com
> #destination_format_tags = Name,environment
>
> # To tag instances on EC2 with the resource records that point to them from
> # Route53, uncomment and set 'route53' to True.
> route53 = False
>
> # To exclude RDS instances from the inventory, uncomment and set to False.
> #rds = False
>
> # To exclude ElastiCache instances from the inventory, uncomment and set 
> to False.
> #elasticache = False
>
> # Additionally, you can specify the list of zones to exclude looking up in
> # 'route53_excluded_zones' as a comma-separated list.
> # route53_excluded_zones = samplezone1.com, samplezone2.com
>
> # By default, only EC2 instances in the 'running' state are returned. Set
> # 'all_instances' to True to return all instances regardless of state.
> all_instances = False
>
> # By default, only EC2 instances in the 'running' state are returned. 
> Specify
> # EC2 instance states to return as a comma-separated list. This
> # option is overriden when 'all_instances' is True.
> # instance_states = pending, running, shutting-down, terminated, stopping, 
> stopped
>
> # By default, only RDS instances in the 'available' state are returned. 
>  Set
> # 'all_rds_instances' to True return all RDS instances regardless of state.
> all_rds_instances = False
>
> # By default, only ElastiCache clusters and nodes in the 'available' state
> # are returned. Set 'all_elasticache_clusters' and/or 

Re: [ansible-project] Still in 2.1?: Nested values always cast to string

2016-06-28 Thread Barry Kaplan
Single quotes makes no difference.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f8266bae-0e0a-4465-830e-3604eb8d7593%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.