Re: [ansible-project] template not looking in templates directory for included roles

2016-08-22 Thread Daniel Watrous
I think you're right that I read that wrong. However, I did find a way to
reference the file from another role that I think should work for me.

{{ role_path }}/../php/templates/phpsitevhost

Since I know the name of the role that will be installed, and that it will
be adjacent to other roles, I should be able to always use "{{ role_path
}}/../" to access the files from another role.

This way I can prevent duplicating these files.

Thanks for your help.

On Mon, Aug 22, 2016 at 2:29 PM, Dick Davies  wrote:

> Ok I think you're misreading the docs.
>
> "Any copy, script, template or include tasks (in the role) can
> reference files in roles/x/{files,templates,tasks}/ (dir depends on
> task) without having to path them relatively or absolutely"
>
> (in the role) above refers to role x. roles can't see each others bits n
> pieces.
>
> The php role needs nginx to be setup,it also needs a vhost.
>
> Just have it set the nginx role as a dependency (like you already
> are), but put the vhost template in the php role
> e.g.
>
> roles/
> ├── nginx
> │   ...rest of role skipped...
> │   ├── defaults
> │   │   └── main.yml  # <- php role can see these vars
> │   └── handlers
> │   └── main.yml  # <- php role can run these handlers
> └── php
> │   ...rest of role skipped...
> ├── meta
> │   └── main.yml  # <- if there's a dependency set here
> └── templates
> └── foo.vhost.j2 # <- template lives here
>
>
> On 22 August 2016 at 20:15, Daniel Watrous 
> wrote:
> > The documented feature is listed under behaviors:
> >
> > "Any copy, script, template or include tasks (in the role) can reference
> > files in roles/x/{files,templates,tasks}/ (dir depends on task) without
> > having to path them relatively or absolutely"
> >
> > Based on this I would expect a filename reference to look in
> > "roles/x/templates" until it found the template file.
> >
> > I can duplicate the file for lower roles, but I would rather
> parameterize it
> > and have the stated functionality work to find it in the templates
> folder of
> > the other role.
> >
> >
> > On Mon, Aug 22, 2016 at 12:55 PM, Dick Davies 
> > wrote:
> >>
> >> I'm not seeing the documented feature you're describing at the link
> >> you posted, and to my knowledge
> >> Anisble has never searching other roles templates/ for templates.
> >>
> >> If I was tackling this problem, I'd have the php role contain the
> >> templates it needs.
> >> You already know the nginx role has been applied, so you know where to
> put
> >> them.
> >>
> >> Handlers and vars from the nginx dependency are visible when you apply
> >> the php role,
> >> so you can find the right place to put your configs and bounce nginx
> >> if you need to easily
> >> enough.
> >>
> >> On 22 August 2016 at 15:47, Daniel Watrous 
> >> wrote:
> >> > It does have its own templates directory, but that directory doesn't
> >> > have a
> >> > file of that name. I'm wondering how I can get the documented
> >> > functionality
> >> > that would have ansible look in the other templates directories until
> it
> >> > finds that file.
> >> >
> >> > Otherwise, is there some way to accomplish what I am trying to do?
> >> >
> >> > Daniel
> >> >
> >> >
> >> > On Aug 22, 2016 4:14 AM, "Dick Davies" 
> wrote:
> >> >
> >> > Roles look in their own templates/ directory for templates. The nginx
> >> > role will be applied first due to the dependency, but it has its own
> >> > templates/ directory.
> >> >
> >> > On 21 August 2016 at 15:32, Daniel Watrous 
> >> > wrote:
> >> >> I have a playbook with several roles. For example, I have an nginx
> role
> >> >> and
> >> >> a php role. Each has the typical directory structure. The nginx role
> >> >> has a
> >> >> template and a task for a virtualhost file that appears like this in
> >> >> the
> >> >> tasks
> >> >>
> >> >> - name: "Move virtual host file into place"
> >> >>   template: "src={{item.src}} dest={{item.dest}} mode={{item.mode}}
> >> >> owner={{
> >> >> nginx_site_user }} group={{ nginx_site_group }}"
> >> >>   with_items:
> >> >> - dest: "{{ nginx_sites_available }}/{{ nginx_site_user }}"
> >> >>   src: "{{ nginx_vhost_file_template }}"
> >> >>   mode: 640
> >> >>   notify:
> >> >>   - restart nginx
> >> >>
> >> >> When I run the nginx role, the variable nginx_vhost_file_template is
> >> >> set
> >> >> to
> >> >> "default" and the file "roles/nginx/templates/default" exists. This
> >> >> works
> >> >> fine.
> >> >>
> >> >> For my PHP role, I simply want to override the
> >> >> nginx_vhost_file_template
> >> >> variable to point to a file "phpsitevhost" in the directory
> >> >> "roles/php/templates/phpsitevhost". The php role includes the file
> >> >> "meta/main.yml" with the following contents.
> >> >>
> >> >> ---
> >> >> dependencies:
> >> >>   - { role: nginx }
> >> >>
> >> >> Based on the 

[ansible-project] Ansible 2.1.2 RC1 is ready for testing

2016-08-22 Thread James Cammarata
Hi all, we're happy to announce that RC1 for 2.1.2 is now available for
testing.

This release candidate fixes many bugs, including (but not limited to):

* Fixed a bug introduced by static includes in 2.1, which prevented
notifications from going to the "top level" handler name.
* Fixed a bug where a group_vars or host_vars directory in the current
working directory would be used (and would take precedence) over those in
the inventory and/or playbook directory.
* Fixed a bug which could occur when the result of an async task did not
parse as valid JSON.
* (re)-allowed the use of ansible_python_interpreter lines with more than
one argument.
* Fixed several bugs related to the creation of the implicit localhost in
inventory.
* Fixed a bug related to an unspecified number of retries when using until.
* Fixed a race-condition bug when creating temp directories before the
worker process is forked.

How do you get it?
--

The tar.gz of the release can be found here:

http://releases.ansible.com/ansible/ansible-2.1.2.0-0.1.rc1.tar.gz
SHA256: 877595c6ae0f6a4cbf91d368aeb1194d8df65cbb084033b62dd163c2a24080d7

You can also test against the git repository as follows:

$ git clone https://github.com/ansible/ansible.git
$ cd ansible
$ git checkout v2.1.2.0-0.1.rc1
$ git submodule update --init

You can then source our testing script:

$ . hacking/env-setup

or you can build your own .tar.gz (output will be
dist/ansible-2.1.2.0.tar.gz):

$ make sdist

If you discover any errors, or if you see any regressions from playbooks
which work on 1.9.x and prior, please open a Github issue and be sure to
mention you're testing against this release candidate.

Thanks!

James Cammarata

Ansible Lead/Sr. Principal Software Engineer
Ansible by Red Hat
twitter: @thejimic, github: jimi-c

-- 
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/CAMFyvFh1UKSEtVxeEZr353su0S6mioY%3D2rof5yxkUd6LoOottA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to change/redefine variables in nested dictionary?

2016-08-22 Thread Dmitry Owl
I have dictionary:
  test:
a:
  name: 'somevalue'
  other: 'somevalue'
  another: 'somevalue'
b:
  name: 'somevalue'
  other: 'somevalue'
  another: 'somevalue'

How can I change value of *"name"* in each dictionary during play of 
playbook and that this has affected on all further reference to the *"test" 
*dictionary? I want to get something like this:

  test:
a:
  name: 'newvalue'
  other: 'somevalue'
  another: 'somevalue'
b:
  name: 'newvalue'
  other: 'somevalue'
  another: 'somevalue'

I have tried to use *"with_dict"*, *"debug"* and *"combine" *jinja filter 
but didn't get any result.
I will be grateful for any help! Thank you!

-- 
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/3c717154-0bc5-4ba1-a2f7-93bceee360b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] template not looking in templates directory for included roles

2016-08-22 Thread Dick Davies
Ok I think you're misreading the docs.

"Any copy, script, template or include tasks (in the role) can
reference files in roles/x/{files,templates,tasks}/ (dir depends on
task) without having to path them relatively or absolutely"

(in the role) above refers to role x. roles can't see each others bits n pieces.

The php role needs nginx to be setup,it also needs a vhost.

Just have it set the nginx role as a dependency (like you already
are), but put the vhost template in the php role
e.g.

roles/
├── nginx
│   ...rest of role skipped...
│   ├── defaults
│   │   └── main.yml  # <- php role can see these vars
│   └── handlers
│   └── main.yml  # <- php role can run these handlers
└── php
│   ...rest of role skipped...
├── meta
│   └── main.yml  # <- if there's a dependency set here
└── templates
└── foo.vhost.j2 # <- template lives here


On 22 August 2016 at 20:15, Daniel Watrous  wrote:
> The documented feature is listed under behaviors:
>
> "Any copy, script, template or include tasks (in the role) can reference
> files in roles/x/{files,templates,tasks}/ (dir depends on task) without
> having to path them relatively or absolutely"
>
> Based on this I would expect a filename reference to look in
> "roles/x/templates" until it found the template file.
>
> I can duplicate the file for lower roles, but I would rather parameterize it
> and have the stated functionality work to find it in the templates folder of
> the other role.
>
>
> On Mon, Aug 22, 2016 at 12:55 PM, Dick Davies 
> wrote:
>>
>> I'm not seeing the documented feature you're describing at the link
>> you posted, and to my knowledge
>> Anisble has never searching other roles templates/ for templates.
>>
>> If I was tackling this problem, I'd have the php role contain the
>> templates it needs.
>> You already know the nginx role has been applied, so you know where to put
>> them.
>>
>> Handlers and vars from the nginx dependency are visible when you apply
>> the php role,
>> so you can find the right place to put your configs and bounce nginx
>> if you need to easily
>> enough.
>>
>> On 22 August 2016 at 15:47, Daniel Watrous 
>> wrote:
>> > It does have its own templates directory, but that directory doesn't
>> > have a
>> > file of that name. I'm wondering how I can get the documented
>> > functionality
>> > that would have ansible look in the other templates directories until it
>> > finds that file.
>> >
>> > Otherwise, is there some way to accomplish what I am trying to do?
>> >
>> > Daniel
>> >
>> >
>> > On Aug 22, 2016 4:14 AM, "Dick Davies"  wrote:
>> >
>> > Roles look in their own templates/ directory for templates. The nginx
>> > role will be applied first due to the dependency, but it has its own
>> > templates/ directory.
>> >
>> > On 21 August 2016 at 15:32, Daniel Watrous 
>> > wrote:
>> >> I have a playbook with several roles. For example, I have an nginx role
>> >> and
>> >> a php role. Each has the typical directory structure. The nginx role
>> >> has a
>> >> template and a task for a virtualhost file that appears like this in
>> >> the
>> >> tasks
>> >>
>> >> - name: "Move virtual host file into place"
>> >>   template: "src={{item.src}} dest={{item.dest}} mode={{item.mode}}
>> >> owner={{
>> >> nginx_site_user }} group={{ nginx_site_group }}"
>> >>   with_items:
>> >> - dest: "{{ nginx_sites_available }}/{{ nginx_site_user }}"
>> >>   src: "{{ nginx_vhost_file_template }}"
>> >>   mode: 640
>> >>   notify:
>> >>   - restart nginx
>> >>
>> >> When I run the nginx role, the variable nginx_vhost_file_template is
>> >> set
>> >> to
>> >> "default" and the file "roles/nginx/templates/default" exists. This
>> >> works
>> >> fine.
>> >>
>> >> For my PHP role, I simply want to override the
>> >> nginx_vhost_file_template
>> >> variable to point to a file "phpsitevhost" in the directory
>> >> "roles/php/templates/phpsitevhost". The php role includes the file
>> >> "meta/main.yml" with the following contents.
>> >>
>> >> ---
>> >> dependencies:
>> >>   - { role: nginx }
>> >>
>> >> Based on the documentation
>> >> http://docs.ansible.com/ansible/playbooks_roles.html#roles, I would
>> >> expect
>> >> the template call in the nginx role to look in both
>> >> "roles/nginx/templates/"
>> >> and "roles/php/templates/". It's not working this way and instead I get
>> >>
>> >> TASK [nginx : Move virtual host file into place]
>> >> ***
>> >> failed: [localhost] (item={u'dest':
>> >> u'/etc/nginx/sites-available/examplewp',
>> >> u'src': u'phpsitevhost', u'group': u'examplewp', u'mode': 640,
>> >> u'owner':
>> >> u'examplewp'}) => {"failed": true, "item": {"dest":
>> >> "/etc/nginx/sites-available/examplewp", "group": "examplewp", "mode":
>> >> 640,
>> >> "owner": "examplewp", "src": "phpsitevhost"}, "msg": "IOError: [Errno
>> >> 2]
>> >> No
>> >> such file 

Re: [ansible-project] template not looking in templates directory for included roles

2016-08-22 Thread Daniel Watrous
The documented feature is listed under behaviors:

"Any copy, script, template or include tasks (in the role) can reference
files in roles/x/{files,templates,tasks}/ (dir depends on task) without
having to path them relatively or absolutely"

Based on this I would expect a filename reference to look in
"roles/x/templates" until it found the template file.

I can duplicate the file for lower roles, but I would rather parameterize
it and have the stated functionality work to find it in the templates
folder of the other role.


On Mon, Aug 22, 2016 at 12:55 PM, Dick Davies 
wrote:

> I'm not seeing the documented feature you're describing at the link
> you posted, and to my knowledge
> Anisble has never searching other roles templates/ for templates.
>
> If I was tackling this problem, I'd have the php role contain the
> templates it needs.
> You already know the nginx role has been applied, so you know where to put
> them.
>
> Handlers and vars from the nginx dependency are visible when you apply
> the php role,
> so you can find the right place to put your configs and bounce nginx
> if you need to easily
> enough.
>
> On 22 August 2016 at 15:47, Daniel Watrous 
> wrote:
> > It does have its own templates directory, but that directory doesn't
> have a
> > file of that name. I'm wondering how I can get the documented
> functionality
> > that would have ansible look in the other templates directories until it
> > finds that file.
> >
> > Otherwise, is there some way to accomplish what I am trying to do?
> >
> > Daniel
> >
> >
> > On Aug 22, 2016 4:14 AM, "Dick Davies"  wrote:
> >
> > Roles look in their own templates/ directory for templates. The nginx
> > role will be applied first due to the dependency, but it has its own
> > templates/ directory.
> >
> > On 21 August 2016 at 15:32, Daniel Watrous 
> wrote:
> >> I have a playbook with several roles. For example, I have an nginx role
> >> and
> >> a php role. Each has the typical directory structure. The nginx role
> has a
> >> template and a task for a virtualhost file that appears like this in the
> >> tasks
> >>
> >> - name: "Move virtual host file into place"
> >>   template: "src={{item.src}} dest={{item.dest}} mode={{item.mode}}
> >> owner={{
> >> nginx_site_user }} group={{ nginx_site_group }}"
> >>   with_items:
> >> - dest: "{{ nginx_sites_available }}/{{ nginx_site_user }}"
> >>   src: "{{ nginx_vhost_file_template }}"
> >>   mode: 640
> >>   notify:
> >>   - restart nginx
> >>
> >> When I run the nginx role, the variable nginx_vhost_file_template is set
> >> to
> >> "default" and the file "roles/nginx/templates/default" exists. This
> works
> >> fine.
> >>
> >> For my PHP role, I simply want to override the nginx_vhost_file_template
> >> variable to point to a file "phpsitevhost" in the directory
> >> "roles/php/templates/phpsitevhost". The php role includes the file
> >> "meta/main.yml" with the following contents.
> >>
> >> ---
> >> dependencies:
> >>   - { role: nginx }
> >>
> >> Based on the documentation
> >> http://docs.ansible.com/ansible/playbooks_roles.html#roles, I would
> expect
> >> the template call in the nginx role to look in both
> >> "roles/nginx/templates/"
> >> and "roles/php/templates/". It's not working this way and instead I get
> >>
> >> TASK [nginx : Move virtual host file into place]
> >> ***
> >> failed: [localhost] (item={u'dest':
> >> u'/etc/nginx/sites-available/examplewp',
> >> u'src': u'phpsitevhost', u'group': u'examplewp', u'mode': 640, u'owner':
> >> u'examplewp'}) => {"failed": true, "item": {"dest":
> >> "/etc/nginx/sites-available/examplewp", "group": "examplewp", "mode":
> 640,
> >> "owner": "examplewp", "src": "phpsitevhost"}, "msg": "IOError: [Errno 2]
> >> No
> >> such file or directory: u'/home/vagrant/src/phpsitevhost'"}
> >>
> >>
> >> It appears to only be searching for the file in the directory where the
> >> playbook file is.
> >>
> >> How can I get the documented behavior where it would look for the file
> in
> >> the templates directories for all included roles?
> >>
> >>
> >>
> >> --
> >> 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/
> b779599d-597b-4f6e-84fd-6f5918221777%40googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > 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/
> 

Re: [ansible-project] SSH connection issue

2016-08-22 Thread jacek . sniecikowski
FYI, I am seeing that on AWS as well. Very intermittent but happens every 
50 deployments or so for us.
In our case it's all Debian running against other Debian machines all 
within AWS.


On Monday, August 22, 2016 at 11:41:24 AM UTC-7, Aaron Bernardino wrote:
>
> Thanks for the feedback.  I tried from my CentOS vagrant box and it 
> worked.  Provisioning using Cygwin does work though when I am just using 
> Vagrant on Cygwin to create and configure a VM locally.
>
> On Saturday, August 20, 2016 at 6:30:05 AM UTC-4, Dick Davies wrote:
>>
>> This is running under Cygwin by the look of it, that's not supported. 
>>
>> Can you install a small VM to run Ansible from? 
>>
>> On 19 August 2016 at 22:28, Aaron Bernardino 
>>  wrote: 
>> > I'm running a playbook where tasks are failing with error message -> 
>> "SSH 
>> > Error: data could not be sent to the remote host. Make sure this host 
>> can be 
>> > reached over ssh", "unreachable": true 
>> > The weird thing is that I have around 11 tasks in the play and I'd get 
>> the 
>> > error on the 1st, sometimes on the 9th or 11th task while the other 
>> tasks 
>> > succeed. 
>> > 
>> > I'm running the playbook against a server in AWS EC2. I'm specifying my 
>> PEM 
>> > file in ansible_ssh_private_key_file from the inventory.  I can also 
>> ansible 
>> > ping the server.  Any advise would be appreciated. Thanks. 
>> > 
>> > Executed: 
>>  ansible-playbook -vvv -i inventory --limit 172.28.4.35 
>>  log-forwarder-aggregator-playbook.yml 
>> > 
>> > Here's a snippet of the logs: 
>> > 
>> > { provisioning }  » ansible-playbook -vvv -i inventory --limit 
>> 172.28.4.35 
>> > log-forwarder-aggregator-playbook.yml 
>> > Using /home/abernardino/.ansible.cfg as config file 
>> > 
>> > PLAYBOOK: log-forwarder-aggregator-playbook.yml 
>> >  
>> > 1 plays in log-forwarder-aggregator-playbook.yml 
>> > 
>> > PLAY [172.28.4.35] 
>> > * 
>> > 
>> > TASK [setup] 
>> > *** 
>> > <172.28.4.35> ESTABLISH SSH CONNECTION FOR USER: centos 
>> > <172.28.4.35> SSH: EXEC ssh -C -q -o ControlPersist=60s -q -o 
>> > 'IdentityFile="D:/DOCUMENTS/CLOUD/aaron-engg-keypair.pem"' -o 
>> > KbdInteractiveAuthentication=no -o 
>> > 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
>> -o 
>> > PasswordAuthentication=no -o User=centos -o ConnectTimeout=15 -o 
>> > ControlPath=/tmp 172.28.4.35 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` 
>> echo 
>> > $HOME/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979 `" && echo 
>> > ansible-tmp-1471641313.0-107908747465979="` echo 
>> > $HOME/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979 `" ) && 
>> sleep 
>> > 0'"'"'' 
>> > <172.28.4.35> PUT /tmp/tmpo_6Ley TO 
>> > 
>> /home/centos/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979/setup 
>> > <172.28.4.35> SSH: EXEC sftp -b - -C -o ControlPersist=60s -q -o 
>> > 'IdentityFile="D:/DOCUMENTS/CLOUD/aaron-engg-keypair.pem"' -o 
>> > KbdInteractiveAuthentication=no -o 
>> > 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
>> -o 
>> > PasswordAuthentication=no -o User=centos -o ConnectTimeout=15 -o 
>> > ControlPath=/tmp '[172.28.4.35]' 
>> > <172.28.4.35> ESTABLISH SSH CONNECTION FOR USER: centos 
>> > <172.28.4.35> SSH: EXEC ssh -C -q -o ControlPersist=60s -q -o 
>> > 'IdentityFile="D:/DOCUMENTS/CLOUD/aaron-engg-keypair.pem"' -o 
>> > KbdInteractiveAuthentication=no -o 
>> > 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
>> -o 
>> > PasswordAuthentication=no -o User=centos -o ConnectTimeout=15 -o 
>> > ControlPath=/tmp -tt 172.28.4.35 '/bin/sh -c '"'"'sudo -H -S -n -u root 
>> > /bin/sh -c '"'"'"'"'"'"'"'"'echo 
>> > BECOME-SUCCESS-xafywjotlomjhgfcgyibqprwhyzmezro; LANG=en_US.UTF-8 
>> > LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python 
>> > 
>> /home/centos/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979/setup; 
>> rm 
>> > -rf 
>> "/home/centos/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979/" > 
>> > /dev/null 2>&1'"'"'"'"'"'"'"'"' && sleep 0'"'"'' 
>> > ok: [172.28.4.35] 
>> > 
>> > TASK [td-agent : Include OS-specific variables.] 
>> > *** 
>> > task path: 
>> > /cygdrive/d/P4/logging/dev/provisioning/roles/td-agent/tasks/main.yml:3 
>> > ok: [172.28.4.35] => {"ansible_facts": {}, "changed": false, 
>> "invocation": 
>> > {"module_args": {"_raw_params": "RedHat.yml"}, "module_name": 
>> > "include_vars"}} 
>> > 
>> > TASK [td-agent : Install the libselinux-python package] 
>> >  
>> > task path: 
>> > 
>> /cygdrive/d/P4/logging/dev/provisioning/roles/td-agent/tasks/setup-RedHat.yml:2
>>  
>>
>> > <172.28.4.35> ESTABLISH SSH CONNECTION FOR USER: centos 
>> > <172.28.4.35> SSH: EXEC ssh -C -q -o ControlPersist=60s -q -o 
>> > 

Re: [ansible-project] SSH connection issue

2016-08-22 Thread Aaron Bernardino
Thanks for the feedback.  I tried from my CentOS vagrant box and it worked. 
 Provisioning using Cygwin does work though when I am just using Vagrant on 
Cygwin to create and configure a VM locally.

On Saturday, August 20, 2016 at 6:30:05 AM UTC-4, Dick Davies wrote:
>
> This is running under Cygwin by the look of it, that's not supported. 
>
> Can you install a small VM to run Ansible from? 
>
> On 19 August 2016 at 22:28, Aaron Bernardino 
>  wrote: 
> > I'm running a playbook where tasks are failing with error message -> 
> "SSH 
> > Error: data could not be sent to the remote host. Make sure this host 
> can be 
> > reached over ssh", "unreachable": true 
> > The weird thing is that I have around 11 tasks in the play and I'd get 
> the 
> > error on the 1st, sometimes on the 9th or 11th task while the other 
> tasks 
> > succeed. 
> > 
> > I'm running the playbook against a server in AWS EC2. I'm specifying my 
> PEM 
> > file in ansible_ssh_private_key_file from the inventory.  I can also 
> ansible 
> > ping the server.  Any advise would be appreciated. Thanks. 
> > 
> > Executed: 
>  ansible-playbook -vvv -i inventory --limit 172.28.4.35 
>  log-forwarder-aggregator-playbook.yml 
> > 
> > Here's a snippet of the logs: 
> > 
> > { provisioning }  » ansible-playbook -vvv -i inventory --limit 
> 172.28.4.35 
> > log-forwarder-aggregator-playbook.yml 
> > Using /home/abernardino/.ansible.cfg as config file 
> > 
> > PLAYBOOK: log-forwarder-aggregator-playbook.yml 
> >  
> > 1 plays in log-forwarder-aggregator-playbook.yml 
> > 
> > PLAY [172.28.4.35] 
> > * 
> > 
> > TASK [setup] 
> > *** 
> > <172.28.4.35> ESTABLISH SSH CONNECTION FOR USER: centos 
> > <172.28.4.35> SSH: EXEC ssh -C -q -o ControlPersist=60s -q -o 
> > 'IdentityFile="D:/DOCUMENTS/CLOUD/aaron-engg-keypair.pem"' -o 
> > KbdInteractiveAuthentication=no -o 
> > 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
> -o 
> > PasswordAuthentication=no -o User=centos -o ConnectTimeout=15 -o 
> > ControlPath=/tmp 172.28.4.35 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` 
> echo 
> > $HOME/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979 `" && echo 
> > ansible-tmp-1471641313.0-107908747465979="` echo 
> > $HOME/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979 `" ) && 
> sleep 
> > 0'"'"'' 
> > <172.28.4.35> PUT /tmp/tmpo_6Ley TO 
> > /home/centos/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979/setup 
> > <172.28.4.35> SSH: EXEC sftp -b - -C -o ControlPersist=60s -q -o 
> > 'IdentityFile="D:/DOCUMENTS/CLOUD/aaron-engg-keypair.pem"' -o 
> > KbdInteractiveAuthentication=no -o 
> > 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
> -o 
> > PasswordAuthentication=no -o User=centos -o ConnectTimeout=15 -o 
> > ControlPath=/tmp '[172.28.4.35]' 
> > <172.28.4.35> ESTABLISH SSH CONNECTION FOR USER: centos 
> > <172.28.4.35> SSH: EXEC ssh -C -q -o ControlPersist=60s -q -o 
> > 'IdentityFile="D:/DOCUMENTS/CLOUD/aaron-engg-keypair.pem"' -o 
> > KbdInteractiveAuthentication=no -o 
> > 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
> -o 
> > PasswordAuthentication=no -o User=centos -o ConnectTimeout=15 -o 
> > ControlPath=/tmp -tt 172.28.4.35 '/bin/sh -c '"'"'sudo -H -S -n -u root 
> > /bin/sh -c '"'"'"'"'"'"'"'"'echo 
> > BECOME-SUCCESS-xafywjotlomjhgfcgyibqprwhyzmezro; LANG=en_US.UTF-8 
> > LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python 
> > 
> /home/centos/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979/setup; 
> rm 
> > -rf 
> "/home/centos/.ansible/tmp/ansible-tmp-1471641313.0-107908747465979/" > 
> > /dev/null 2>&1'"'"'"'"'"'"'"'"' && sleep 0'"'"'' 
> > ok: [172.28.4.35] 
> > 
> > TASK [td-agent : Include OS-specific variables.] 
> > *** 
> > task path: 
> > /cygdrive/d/P4/logging/dev/provisioning/roles/td-agent/tasks/main.yml:3 
> > ok: [172.28.4.35] => {"ansible_facts": {}, "changed": false, 
> "invocation": 
> > {"module_args": {"_raw_params": "RedHat.yml"}, "module_name": 
> > "include_vars"}} 
> > 
> > TASK [td-agent : Install the libselinux-python package] 
> >  
> > task path: 
> > 
> /cygdrive/d/P4/logging/dev/provisioning/roles/td-agent/tasks/setup-RedHat.yml:2
>  
>
> > <172.28.4.35> ESTABLISH SSH CONNECTION FOR USER: centos 
> > <172.28.4.35> SSH: EXEC ssh -C -q -o ControlPersist=60s -q -o 
> > 'IdentityFile="D:/DOCUMENTS/CLOUD/aaron-engg-keypair.pem"' -o 
> > KbdInteractiveAuthentication=no -o 
> > 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
> -o 
> > PasswordAuthentication=no -o User=centos -o ConnectTimeout=15 -o 
> > ControlPath=/tmp 172.28.4.35 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` 
> echo 
> > 

[ansible-project] Re: ec2.ini pattern_exclude and instance_filters

2016-08-22 Thread Guy Knights
Oops, just noting that I accidentally mistyped the instance_filter line in
the second error above (The filter '~Platform' is invalid").

On Mon, Aug 22, 2016 at 11:14 AM, Guy Knights  wrote:

> I'm trying to remove certain ec2 hosts from having ansible run on them by
> using the instance_filters and/or pattern_exclude options in the ini file
> for ec2.py, but it doesn't seem to be working. I tried using the following
> syntax for instance_filters:
>
> instance_filters = "tag:Environment=prod,!Platform=windows"
>
> However when I run a playbook it gives me the following error:
>
> The filter '!Platform' is invalid", while: getting EC2 instances
> inventory/prod/ec2.py:3: Error parsing host definition ': No closing
> quotation
>
> I removed the double quotes and I get a similar error:
>
> The filter '~Platform' is invalid", while: getting EC2 instances
> inventory/prod/ec2.py:3: Error parsing host definition ': No closing
> quotation
>
> I also tried changing them to single quotes but once again got yet another
> slightly different error:
>
> The filter ''tag:Environment' is invalid", while: getting EC2 instances
> inventory/prod/ec2.py:3: Error parsing host definition ': No closing
> quotation
>
> Meanwhile, I tried playing with pattern_exclude instead. I added the
> following:
>
> pattern_exclude = '*-ad'
>
> When I run this, it still tries to excute the playbook on servers whose
> names match the pattern 'example-ec2-ad'.
>
> What am I doing wrong here?
>
> 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/CANNH9mt%2BfTpOPawOxCOi%3D%2B5LNzA%2BzAdaXHw3KnM%3DsiETyjr-9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] winrm Unable to connect to windows10 desktop

2016-08-22 Thread Deep18
 

Hi,

I am trying to use ansible to controla windows 10 desktop VM in my lab and 
cannot seem to get past the connection error.Appreciate your help here.


Here is my setup:

MacBook is the control host and trying to connect to a windows10 desktop 
VM. I went through and followed all instructions in the ansible doc to 
enable remotePowershell on windows VM, turned OFF firewall on the windows 
VM.The windows VM is not part of any domain.


My inventory file:

[windows]

10.203.189.4

[windows:vars]  #group variables and 
values as a string

  ansible_connection=winrm 

  ansible_user= voiceqa

  ansible_password = abcdef

  ansible_port=5986

  ansible_winrm_server_cert_validation= ignore


I get the following error:


$ ansible windows --inventory-file=./hosts  -m win_ping -v

No config file found; using defaults

Loaded callback minimal of type stdout, v2.0

<10.203.189.4> ESTABLISH WINRM CONNECTION FOR USER: voiceqa on PORT 5986 TO 
10.203.189.4

<10.203.189.4> WINRM CONNECT: transport=ssl 
endpoint=https://10.203.189.4:5986/wsman

<10.203.189.4> WINRM CONNECTION ERROR: 
HTTPSConnectionPool(host='10.203.189.4', port=5986): Max retries exceeded 
with url: /wsman (Caused by 
NewConnectionError(': Failed to establish a new connection: [Errno 61] 
Connection refused',))

Traceback (most recent call last):

  File 
"/Users/dnveer/venv/vqp/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py",
 
line 134, in _winrm_connect

protocol.send_message('')

  File 
"/Users/dnveer/venv/vqp/lib/python2.7/site-packages/winrm/protocol.py", 
line 207, in send_message

return self.transport.send_message(message)

  File 
"/Users/dnveer/venv/vqp/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 
"/Users/dnveer/venv/vqp/lib/python2.7/site-packages/requests/sessions.py", 
line 585, in send

r = adapter.send(request, **kwargs)

  File 
"/Users/dnveer/venv/vqp/lib/python2.7/site-packages/requests/adapters.py", 
line 467, in send

raise ConnectionError(e, request=request)

ConnectionError: HTTPSConnectionPool(host='10.203.189.4', port=5986): Max 
retries exceeded with url: /wsman (Caused by 
NewConnectionError(': Failed to establish a new connection: [Errno 61] 
Connection refused',))


10.203.189.4 | FAILED! => {

"failed": true, 

"msg": "ssl: HTTPSConnectionPool(host='10.203.189.4', port=5986): Max 
retries exceeded with url: /wsman (Caused by 
NewConnectionError(': Failed to establish a new connection: [Errno 61] 
Connection refused',))"

}

-- 
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/75fbb377-ae2d-4e46-b954-806f7329f0b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How do you avoid running same roles multiple times when including playbooks?

2016-08-22 Thread Jacek Sniecikowski
So basically I will need to set facts for every major playbook once it 
succeeds and then check for it?
I thought Ansible was idempotent in this way by default

On Saturday, August 20, 2016 at 3:28:45 AM UTC-7, Dick Davies wrote:
>
> Use a when: clause, or make the included files tasks idempotent. 
>
> On 19 August 2016 at 22:25,   
> wrote: 
> > Short version: 
> > Why does Ansible keep running '-include: mysql-cluster.yml' whenever it 
> > encounters it? Can't it recognize this was already executed once? 
> > 
> > Long version: 
> > I am trying to find a good way to organize Ansible scripts so that they 
> meet 
> > these requirements: 
> > - Developers can run their project and not worry about running any 
> > dependencies manually 
> > - Have a master playbook describing our whole infrastructure (site.yml) 
> and 
> > not call dependencies multiple times even though they already run. 
> > 
> > We're running a mid size setup with site.yml that is a list of other 
> > playbooks that we include. 
> > # file: site.yml 
> > # This is a top level playbook representing everything in Polaris. 
> > # It includes subplaybooks for independent collections of modules that 
> may 
> > be deployed together. 
> > 
> > # Infrastructure 
> > - include: cdh5.yml 
> > - include: memcached.yml 
> > - include: myAPI_1.yml 
> > - include: myAPI_2.yml 
> > 
> > ( and so on ) 
> > 
> > The myAPI_1 and myAPI_2 playbook look like this: 
> > file: myAPI_1.yml 
> > --- 
> > 
> > - include: mysql-cluster.yml 
> > 
> > - name: Memcached - Setup 
> >   hosts: memcached 
> >   roles: 
> > - memcached 
> >   tags: 
> > - memcached 
> > 
> > - name: My API 1 - Setup 
> >   hosts: myapis 
> >   roles: 
> > - repository 
> > - oracle-java 
> > - myAPIs/myAPI_1 
> >tags: 
> > - myAPI_1 
> > 
> > 
> > 
> > When running site.yml, how do I avoid calling running MySQL-cluster 
> playbook 
> > twice? Once included via myAPI_1, second time via myAPI_2. 
> > For developers, I want them to be able to run myAPI_1.yml and not worry 
> > about running any other dependencies. 
> > 
> > I tried doing this with TAGS, so developers would always launch site.yml 
> > with '--tags=myAPI1' but for a large site.yml this takes a long time and 
> > leaves a lot irrelevant logging. 
> > 
> > Using meta dependencies works only for roles, not playbooks. 
> > 
> > -- 
> > 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-proje...@googlegroups.com . 
> > To post to this group, send email to ansible...@googlegroups.com 
> . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/bdf52ade-9cbb-45fa-8b03-fc789aa515f7%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/da079b88-79c6-405c-8229-7f01ee4007c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ec2.ini pattern_exclude and instance_filters

2016-08-22 Thread Guy Knights
I'm trying to remove certain ec2 hosts from having ansible run on them by
using the instance_filters and/or pattern_exclude options in the ini file
for ec2.py, but it doesn't seem to be working. I tried using the following
syntax for instance_filters:

instance_filters = "tag:Environment=prod,!Platform=windows"

However when I run a playbook it gives me the following error:

The filter '!Platform' is invalid", while: getting EC2 instances
inventory/prod/ec2.py:3: Error parsing host definition ': No closing
quotation

I removed the double quotes and I get a similar error:

The filter '~Platform' is invalid", while: getting EC2 instances
inventory/prod/ec2.py:3: Error parsing host definition ': No closing
quotation

I also tried changing them to single quotes but once again got yet another
slightly different error:

The filter ''tag:Environment' is invalid", while: getting EC2 instances
inventory/prod/ec2.py:3: Error parsing host definition ': No closing
quotation

Meanwhile, I tried playing with pattern_exclude instead. I added the
following:

pattern_exclude = '*-ad'

When I run this, it still tries to excute the playbook on servers whose
names match the pattern 'example-ec2-ad'.

What am I doing wrong here?

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/CANNH9mv6HGitEjPFqRW8ME%2Be9-bsO80mCRGm%2BKC98Edsqkd%3DhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] template not looking in templates directory for included roles

2016-08-22 Thread Dick Davies
I'm not seeing the documented feature you're describing at the link
you posted, and to my knowledge
Anisble has never searching other roles templates/ for templates.

If I was tackling this problem, I'd have the php role contain the
templates it needs.
You already know the nginx role has been applied, so you know where to put them.

Handlers and vars from the nginx dependency are visible when you apply
the php role,
so you can find the right place to put your configs and bounce nginx
if you need to easily
enough.

On 22 August 2016 at 15:47, Daniel Watrous  wrote:
> It does have its own templates directory, but that directory doesn't have a
> file of that name. I'm wondering how I can get the documented functionality
> that would have ansible look in the other templates directories until it
> finds that file.
>
> Otherwise, is there some way to accomplish what I am trying to do?
>
> Daniel
>
>
> On Aug 22, 2016 4:14 AM, "Dick Davies"  wrote:
>
> Roles look in their own templates/ directory for templates. The nginx
> role will be applied first due to the dependency, but it has its own
> templates/ directory.
>
> On 21 August 2016 at 15:32, Daniel Watrous  wrote:
>> I have a playbook with several roles. For example, I have an nginx role
>> and
>> a php role. Each has the typical directory structure. The nginx role has a
>> template and a task for a virtualhost file that appears like this in the
>> tasks
>>
>> - name: "Move virtual host file into place"
>>   template: "src={{item.src}} dest={{item.dest}} mode={{item.mode}}
>> owner={{
>> nginx_site_user }} group={{ nginx_site_group }}"
>>   with_items:
>> - dest: "{{ nginx_sites_available }}/{{ nginx_site_user }}"
>>   src: "{{ nginx_vhost_file_template }}"
>>   mode: 640
>>   notify:
>>   - restart nginx
>>
>> When I run the nginx role, the variable nginx_vhost_file_template is set
>> to
>> "default" and the file "roles/nginx/templates/default" exists. This works
>> fine.
>>
>> For my PHP role, I simply want to override the nginx_vhost_file_template
>> variable to point to a file "phpsitevhost" in the directory
>> "roles/php/templates/phpsitevhost". The php role includes the file
>> "meta/main.yml" with the following contents.
>>
>> ---
>> dependencies:
>>   - { role: nginx }
>>
>> Based on the documentation
>> http://docs.ansible.com/ansible/playbooks_roles.html#roles, I would expect
>> the template call in the nginx role to look in both
>> "roles/nginx/templates/"
>> and "roles/php/templates/". It's not working this way and instead I get
>>
>> TASK [nginx : Move virtual host file into place]
>> ***
>> failed: [localhost] (item={u'dest':
>> u'/etc/nginx/sites-available/examplewp',
>> u'src': u'phpsitevhost', u'group': u'examplewp', u'mode': 640, u'owner':
>> u'examplewp'}) => {"failed": true, "item": {"dest":
>> "/etc/nginx/sites-available/examplewp", "group": "examplewp", "mode": 640,
>> "owner": "examplewp", "src": "phpsitevhost"}, "msg": "IOError: [Errno 2]
>> No
>> such file or directory: u'/home/vagrant/src/phpsitevhost'"}
>>
>>
>> It appears to only be searching for the file in the directory where the
>> playbook file is.
>>
>> How can I get the documented behavior where it would look for the file in
>> the templates directories for all included roles?
>>
>>
>>
>> --
>> 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/b779599d-597b-4f6e-84fd-6f5918221777%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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/Mniko9GHPCI/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/CAK5eLPRYZodnJbvd7z-icgM29zajJbY-Kd%3DgEUy2yt0dcEkYOQ%40mail.gmail.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
> 

[ansible-project] Re: group_vars behavior changed in 2.1?

2016-08-22 Thread Allen Sanabria
I ran into this issue as well. I decided to write an action plugin called 
include_vars_dir. This will sort the files in alphabetical order and 
include them. This also works in a role as well. I am in the process of 
writing a test suite, before making the PR. If you are interested in 
checking the code before the PR is made 
https://github.com/linuxdynasty/ld-ansible-plugins/blob/master/action_plugins/include_vars_dir.py

I know some of this functionality is possible with using fileglob and 
include_vars. I needed something that I can control the depth of the 
directory as well.

- name: include all yml files in group_vars/all and all nested directories
  include_vars_dir:
dir: 'group_vars/all'

- name: include all yml files in group_vars/services
  include_vars_dir:
dir: 'group_vars/services'
depth: 1

- name: include only bastion.yml files
  include_vars_dir:
dir: 'vars'
files_matching: 'bastion.yml'

- name: include only all yml files exception bastion.yml
  include_vars_dir:
dir: 'vars'
ignore_files: 'bastion.yml'



 that instead of using include_vars with fileglob. 

On Thursday, August 18, 2016 at 9:41:27 AM UTC-7, Vincent Jørgensen wrote:
>
> Hi all, I have an ansible project with a groups_vars directory, with a 
> subdirectory called all beneath it, like so:
> /project/group_vars/all/ami.yml
> /project/group_vars/all/dns.yml
> /project/group_vars/all/key.yml
>
> Previously, I didn't have to specify in my playbook the path to each 
> variable file (amis dns and keys change often enough that it's handy to 
> keep them separate). But since moving to 2.1.1.0, ansible can't find the 
> files under all, so I've had to resort to this:
> - hosts:  localhost
>   ...
>   vars_files:
> - "{{ base_dir }}/group_vars/all/dns.yml"
> - "{{ base_dir }}/group_vars/all/ami.yml"
> - "{{ base_dir }}/group_vars/all/key.yml"
>   tasks:
>   - ...
>
>
> Did this feature go away?  It isn't the end of the world, but I liked that 
> feature, that all could be directory or a file. Thanks. \V
>

-- 
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/ce223a5e-8d1d-4354-ba78-06440f5259e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible docs help

2016-08-22 Thread Donald Blodgett
Yes, those (and other parameters at the same level on plays, like become, 
gather_facts, and run_once) are what I am looking for. It's unfortunate 
that they are not listed anywhere it would be very helpful, especially for 
people new to Ansible.

On Saturday, August 20, 2016 at 5:28:14 AM UTC-4, Trond Hindenes wrote:
>
> you mean like "name", "hosts", "tasks", "roles" and such? Good question, I 
> don't know if that's properly organized anywhere.
>
> On Thursday, August 18, 2016 at 6:41:27 PM UTC+2, Donald Blodgett wrote:
>>
>> I am trying to find the listing of descriptions, valid and default values 
>> for playbook play parameters similar to the module index that lists these 
>> for each of the modules. Can anyone point me in the correct direction? 
>> 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/d6848272-2d17-4cb3-8627-284d6ff910d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: group_vars behavior changed in 2.1?

2016-08-22 Thread David Resnick
I just posted about this too, it looks like a bug to me.

- David

On Thursday, August 18, 2016 at 7:41:27 PM UTC+3, Vincent Jørgensen wrote:
>
> Hi all, I have an ansible project with a groups_vars directory, with a 
> subdirectory called all beneath it, like so:
> /project/group_vars/all/ami.yml
> /project/group_vars/all/dns.yml
> /project/group_vars/all/key.yml
>
> Previously, I didn't have to specify in my playbook the path to each 
> variable file (amis dns and keys change often enough that it's handy to 
> keep them separate). But since moving to 2.1.1.0, ansible can't find the 
> files under all, so I've had to resort to this:
> - hosts:  localhost
>   ...
>   vars_files:
> - "{{ base_dir }}/group_vars/all/dns.yml"
> - "{{ base_dir }}/group_vars/all/ami.yml"
> - "{{ base_dir }}/group_vars/all/key.yml"
>   tasks:
>   - ...
>
>
> Did this feature go away?  It isn't the end of the world, but I liked that 
> feature, that all could be directory or a file. Thanks. \V
>

-- 
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/ce1020e4-332e-4016-ab2c-ce411f2f2948%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Recording generated template configurations

2016-08-22 Thread Josh Smift
SO> Anybody know of a way to deploy a template to multiple servers, but
SO> have each configuration simultaneously centralized on another server? 

How about delegate_to?

  - hosts: myservers

tasks: 

  - name: put foo on myservers
template: 
  src: foo.txt.j2 
  dest: /etc/foo.txt 

  - name: put foo for myservers onto centralserver
template: 
  src: foo.txt.j2 
  dest: "/srv/myservers/{{ inventory_hostname }}" 
delegate_to: centralserver

That seems to work for me; it's not *simultaneous* simultaneous, but it's
in one playbook anyway. :^)

  -Josh (j...@care.com)

(apologies for the automatic corporate disclaimer that follows)




This email is intended for the person(s) to whom it is addressed and may 
contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, 
distribution, copying, or disclosure by any person other than the addressee(s) 
is strictly prohibited. If you have received this email in error, please notify 
the sender immediately by return email and delete the message and any 
attachments from your system.

-- 
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/22459.7719.83809.686842%40gargle.gargle.HOWL.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] localhost in multiple groups (e.g. all) as well as "ungrouped"

2016-08-22 Thread David Resnick
I've found a regression in Ansible 2.1.1.0 where group_vars are not being 
applied correctly to a host that is shown as part of those groups.

My playbook is for performing AWS operations.

My inventory file looks something like this:

[control_host]
localhost connection=local
[nonprod]
[eu-nonprod]
[eu-west-1]
[demo]
[eu-west-1:children]
control_host
[demo:children]
control_host
[nonprod:children]
eu-nonprod
demo
[eu-nonprod:children]
eu-west-1

When I run this with Ansible 2.1.1 my groups_vars are not picked up -- 
including values set in group_vars/all.yml. With 2.1.0 group_vars are set 
as expected.

I'm not sure this is connected, but I've noticed that localhost is shown as 
belonging to all expected groups when running with 2.1.0 -- and with 
Ansible 2.1.1 localhost is shown to belong to the "ungrouped" group as well.

TASK [debug] 
***
ok: [localhost] => {
"groups": {
"all": [
"localhost"
],
"control_host": [
"localhost"
],
"demo": [
"localhost"
],
"eu-nonprod": [
"localhost"
],
"eu-west-1": [
"localhost"
],
"nonprod": [
"localhost"
],
"ungrouped": [
"localhost"
]
}
}

Am I missing something here? Should I open an issue about this?

Thanks,
David

-- 
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/637adf5a-cb5d-4f62-9bbc-dc19c2b43670%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Feature add gtdLocation and failover on dnsmadeeasy module

2016-08-22 Thread Mohamed Radwan
Hello

Is it possobile to add gtdLocation option inside dnsmadeeasy module ? I 
have different Geo location for the same dns record and I want to define 
gtdLocation ? also it will be great if you add failover option ?
Right now it is giving me "msg": "unsupported parameter for module: 
gtdLocation"}"

Thanks
Mohamed 


-- 
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/70846fe4-f57d-4b88-af86-fe8b5f7870b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Recording generated template configurations

2016-08-22 Thread Soren Olegnowicz
Anybody know of a way to deploy a template to multiple servers, but have 
each configuration simultaneously centralized on another server? I do not 
want the servers speaking with each other, so synchronize would not really 
be an option. I would also prefer not to use fetch, as having the different 
configurations live on the main workstation would become too clunky too 
quickly.

-- 
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/13a7f1c3-818d-4f2c-8fdf-14c856f95799%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] template not looking in templates directory for included roles

2016-08-22 Thread Daniel Watrous
It does have its own templates directory, but that directory doesn't have a
file of that name. I'm wondering how I can get the documented functionality
that would have ansible look in the other templates directories until it
finds that file.

Otherwise, is there some way to accomplish what I am trying to do?

Daniel

On Aug 22, 2016 4:14 AM, "Dick Davies"  wrote:

Roles look in their own templates/ directory for templates. The nginx
role will be applied first due to the dependency, but it has its own
templates/ directory.

On 21 August 2016 at 15:32, Daniel Watrous  wrote:
> I have a playbook with several roles. For example, I have an nginx role
and
> a php role. Each has the typical directory structure. The nginx role has a
> template and a task for a virtualhost file that appears like this in the
> tasks
>
> - name: "Move virtual host file into place"
>   template: "src={{item.src}} dest={{item.dest}} mode={{item.mode}}
owner={{
> nginx_site_user }} group={{ nginx_site_group }}"
>   with_items:
> - dest: "{{ nginx_sites_available }}/{{ nginx_site_user }}"
>   src: "{{ nginx_vhost_file_template }}"
>   mode: 640
>   notify:
>   - restart nginx
>
> When I run the nginx role, the variable nginx_vhost_file_template is set
to
> "default" and the file "roles/nginx/templates/default" exists. This works
> fine.
>
> For my PHP role, I simply want to override the nginx_vhost_file_template
> variable to point to a file "phpsitevhost" in the directory
> "roles/php/templates/phpsitevhost". The php role includes the file
> "meta/main.yml" with the following contents.
>
> ---
> dependencies:
>   - { role: nginx }
>
> Based on the documentation
> http://docs.ansible.com/ansible/playbooks_roles.html#roles, I would expect
> the template call in the nginx role to look in both
"roles/nginx/templates/"
> and "roles/php/templates/". It's not working this way and instead I get
>
> TASK [nginx : Move virtual host file into place]
> ***
> failed: [localhost] (item={u'dest': u'/etc/nginx/sites-available/
examplewp',
> u'src': u'phpsitevhost', u'group': u'examplewp', u'mode': 640, u'owner':
> u'examplewp'}) => {"failed": true, "item": {"dest":
> "/etc/nginx/sites-available/examplewp", "group": "examplewp", "mode": 640,
> "owner": "examplewp", "src": "phpsitevhost"}, "msg": "IOError: [Errno 2]
No
> such file or directory: u'/home/vagrant/src/phpsitevhost'"}
>
>
> It appears to only be searching for the file in the directory where the
> playbook file is.
>
> How can I get the documented behavior where it would look for the file in
> the templates directories for all included roles?
>
>
>
> --
> 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/b779599d-597b-4f6e-84fd-
6f5918221777%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
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/Mniko9GHPCI/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/CAK5eLPRYZodnJbvd7z-icgM29zajJbY-Kd%
3DgEUy2yt0dcEkYOQ%40mail.gmail.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/CAHSC4g2MSgo2-pnQ8_QTji1E3%3Dssr3ZyZjab0RHYzPv-AH0%2Bmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Unexpected evaluation of condition in 'when' statement

2016-08-22 Thread Alfredo M
Hi all,

I'm trying to figure out why the expression "false and (var is undefined)", 
when 'var' has the value of an undefined variable, returns true. Here it is 
an example:

- hosts: localhost
  vars:
  g: "{{ z }}"
  is_false_var: false
  tasks:

  - debug: "msg='this must not be shown'"
when: (is_false_var) and (b is undefined)
ignore_errors: yes

  - debug: "msg='this must not be shown'"
when:* (is_false_var) and (g is undefined)*
ignore_errors: yes

  - debug: "msg='this must not be shown'"
when: (is_false_var) and false
ignore_errors: yes

  - debug: "msg='this must not be shown'"
when: (is_false_var) and true
ignore_errors: yes

  - debug: "msg={{ is_false_var and g is undefined }}"
ignore_errors: yes

That returns:

PLAY [localhost] 
***

TASK [setup] 
***
ok: [localhost]

TASK [debug] 
***
skipping: [localhost]




*TASK [debug] 
***ok: 
[localhost] => { "msg": "this must not be shown"}*

TASK [debug] 
***
skipping: [localhost]

TASK [debug] 
***
skipping: [localhost]

TASK [debug] 
***
fatal: [localhost]: FAILED! => {"failed": true, "msg": "{{ z }}: 'z' is 
undefined"}
...ignoring

PLAY RECAP 
*
localhost : ok=3 changed=0 unreachable=0 failed=0 

Any ideas or thoughts about the avobe?

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/71882ba5-b853-443f-b44d-5236f2a13097%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Apt-get simulate command

2016-08-22 Thread Rémi Morel
I want to check if a package need to be updated and write a log file. That 
why i use apt-get -s install, and I put the result with a register to use 
it later.

Thanks for watching my problem.

RM

Le lundi 22 août 2016 15:25:34 UTC+2, Jean-Yves LENHOF a écrit :
>
> Le 22/08/2016 à 09:19, Rémi Morel a écrit :
>
> Hello, 
>
> I have spend a lot of time to find a solution at this issue.
> I have a task :
>
> - name: check updated package (Debian)
>   command: apt-get -s install {{ item.item }}
>   register: updateD
>   when: (ansible_os_family == "Debian") and (installD is defined) and ( {{ 
> item.rc }} == 0)
>   with_items: "{{ installD.results }}"
>   failed_when: updateD > 1
>   changed_when: no
>
> and Ansible reaction is :
>
> [WARNING]: Consider using apt module rather than running apt-get
>
> But I don't find any option in documentation to obtain the result of "-s".
>
>
> Hi,
>
> Could you explain what you want to do ?
> To not do things in ansible but simulate, there's --check command line 
> option
>
> Regards,
>
> JYL
>

-- 
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/7582a25d-4f2f-43dc-835a-388d4e9d77e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] stdout looks empty, but 'when' thinks it isn't?

2016-08-22 Thread Kai Stian Olstad

On 22. aug. 2016 12:10, 'Steve Kersley' via Ansible Project wrote:

This works fine, but it fails on a switch that has no current value set, so
I used a 'when' clause to check if stdout from the collection task is
empty.  However, this isn't working.  If I print via debug the value of
stdout, it certainly looks empty so why isn't the when clause working?

Any help on what I'm doing wrong (or a better way to do it) appreciated?
 For the moment I can kludge around it by setting a value before I delete
all the values, so that I know it should always have something and not
worry about it, but that's bad practice and I'd prefer to know what I'm
doing wrong for next time!

- hosts: switches
  gather_facts: False
  vars:
cli:
  host: "{{ inventory_hostname }}"
  username: user
  password: password
  auth_pass: password
  transport: cli
  tasks:
  - name: Collect logging configuration
connection: local
become: false
register: syslog
ios_command:
  provider: "{{ cli }}"
  authorize: yes
  commands:
- show running-config | include logging host

  - debug: msg="empty"
when: syslog.stdout == ""
  - debug: msg="not empty"
when: syslog.stdout != ""
  - debug: var=syslog.stdout

  - name: Remove existing syslog config
connection: local
become: false
when: syslog.stdout != ""
ios_command:
  provider: "{{ cli }}"
  authorize: yes
  commands:
- configure terminal
- no {{ item }}
- exit
with_items: "{{ syslog.stdout_lines }}"

Output:
PLAY [switches]


TASK [Collect logging configuration]
***
ok: [switchname]

TASK [debug]
***
skipping: [switchname]

TASK [debug]
***
ok: [switchname] => {
"msg": "not empty"
}

TASK [debug]
***
ok: [switchname] => {
"syslog.stdout": [
""
]
}


It's not empty, it does contain a list.
So if you do this I think it should work
when: syslog.stdout[0] != ""

--
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/f2430ec1-b76c-aead-987a-dbabc16f97cf%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Pre-requisite tasks

2016-08-22 Thread Kai Stian Olstad

On 22. aug. 2016 11:52, Dan Nestor wrote:

Hello everybody, this is my first post here.

I have a playbook that includes these tasks:

- name: Staging directory exists
  file:
path: "{{ staging_dir }}"
recurse: yes
state: directory


- name: "{{ java_package }} is present in staging directory"
  copy:
src: "{{ java_package }}"
dest: "{{ staging_dir }}/{{ java_package }}"


- name: "{{ java_package }} is installed"
  yum:
name: "{{ staging_dir }}/{{ java_package }}"
state: present

I would like to copy the file to the host only if needed, that is, the RPM
in question is not already installed. Can I do this in Ansible?


- name: Check if package is installed
  command: rpm -q {{ java_package }}
  register: package_installed

- block:
  - name: Staging directory exists
file:
  path: "{{ staging_dir }}"
  recurse: yes
  state: directory

  - name: "{{ java_package }} is present in staging directory"
copy:
  src: "{{ java_package }}"
  dest: "{{ staging_dir }}/{{ java_package }}"

  - name: "{{ java_package }} is installed"
yum:
  name: "{{ staging_dir }}/{{ java_package }}"
  state: present
  when: package_installed.rc == 1

--
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/e27d2220-f57a-d4ad-d0f5-e184db0d8ad1%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Some Ansible Windows winrm variables doesn't seems to be use

2016-08-22 Thread 'J Hawkesworth' via Ansible Project
So that's a connection timeout.  Is there a firewall between your ansible 
controller and the windows box?
Did you run the configure for remoting .ps1 script on the windows node to 
set up winrm for ansible?
Can you traceroute to 10.10.32.29 from your ansible box?

Jon

On Monday, August 22, 2016 at 1:23:27 PM UTC+1, Googly Googly wrote:
>
> Just did upgrade to 2.1.1.0 still facing the same issue:
>
> Loaded callback minimal of type stdout, v2.0
> <10.10.32.29> ESTABLISH WINRM CONNECTION FOR USER: amitag on PORT 5985 TO 
> 10.10.32.29
> 10.10.32.29 | UNREACHABLE! => {
> "changed": false,
> "msg": "plaintext: HTTPConnectionPool(host='10.10.32.29', port=5985): 
> Max retries exceeded with url: /wsman (Caused by 
> ConnectTimeoutError( object at 0x33bc790>, 'Connection to 10.10.32.29 timed out. (connect 
> timeout=30)'))",
> "unreachable": true
> }
>
>
>
>
> On Wednesday, July 6, 2016 at 3:36:00 AM UTC+5:30, Matt Davis wrote:
>>
>> There was a late change to 2.1.0 that broke psuedo-connection vars (eg, 
>> ansible_winrm_X) defined in group_vars files, preventing them from 
>> propagating correctly into the worker process (where flat inventory files 
>> worked fine). It's been corrected for 2.1.1 (currently in release 
>> candidate). 
>>
>> On Tuesday, July 5, 2016 at 5:44:30 AM UTC-7, Googly Googly wrote:
>>>
>>> Hi,
>>>
>>>
>>> I am facing exactly same issue. Did you find solution to this? It was 
>>> giving me another issue till y'day and since this morning when I restarted 
>>> my Linux VM. I started getting this issue.
>>>
>>> Thanks,
>>>
>>> On Thursday, June 9, 2016 at 2:06:18 AM UTC+5:30, Julien Savard wrote:

 Hi,
 It seems ansible does not use the variables in /etc/ansible/hosts for 
 winrm connection :

 In /etc/ansible/hosts : 

 [windows]
 10.10.10.10

 [windows:vars]
 ansible_user=WindowsUser
 ansible_password=UserPassword
 ansible_winrm_scheme=http
 ansible_port=5985
 ansible_connection=winrm
 ansible_winrm_server_cert_validation=ignore


 [root@linuxServer ~]# ansible windows -m win_ping
 10.10.10.10 | FAILED => Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", 
 line 586, in _executor
 exec_rc = self._executor_internal(host, new_stdin)
   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", 
 line 789, 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 968, 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 94, in _winrm_connect
 realm=realm)
   File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 68, 
 in __init__
 auth_method=transport)
   File "/usr/lib/python2.7/site-packages/winrm/transport.py", line 109, 
 in __init__
 raise InvalidCredentialsError("auth method %s requires a password" 
 % self.auth_method)
 InvalidCredentialsError: auth method plaintext requires a password


 [root@linuxServer ~]# ansible windows -m win_ping -k
 SSH password:
 10.10.10.10 | FAILED => Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", 
 line 586, in _executor
 exec_rc = self._executor_internal(host, new_stdin)
   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", 
 line 789, 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 968, 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 
 

Re: [ansible-project] Apt-get simulate command

2016-08-22 Thread Kai Stian Olstad

On 22. aug. 2016 09:19, Rémi Morel wrote:

Hello,

I have spend a lot of time to find a solution at this issue.
I have a task :

- name: check updated package (Debian)
  command: apt-get -s install {{ item.item }}
  register: updateD


The result of the command is registered in the variable updateD



  when: (ansible_os_family == "Debian") and (installD is defined) and ( {{
item.rc }} == 0)


You should not use {{ }} in when, they are implied.



  with_items: "{{ installD.results }}"
  failed_when: updateD > 1
  changed_when: no

and Ansible reaction is :

[WARNING]: Consider using apt module rather than running apt-get

But I don't find any option in documentation to obtain the result of "-s".


Since they are in the variable updateD you can print out all of them 
like this.


- debug: var=updateD


--
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/32266f86-e1dc-495d-83de-9a99aad397e2%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_unzip hanging on overwrite

2016-08-22 Thread 'J Hawkesworth' via Ansible Project
I'd try and organise things so that there's no need to merge the contents 
of the directory (probably by removing the contents of the directory first 
using win_file state: absent.)

Jon

On Thursday, August 18, 2016 at 5:41:38 PM UTC+1, Derek Viljoen wrote:
>
> I'm new to ansible.  I'm debugging a called to win_unzip that is hanging. 
>  I see other users having the same problem with no resolution.  I've 
> diagnosed it down to the generated powershell script calling 
> Expand-Archive.  If I pull the generated script and run it in powershell it 
> pops up a dialog prompting me to merge the extract with the contents of the 
> directory.
>
> Is there an option I can pass in to force the overwrite?
>
>
>

-- 
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/28e911b0-bb0d-4ee9-898f-5d40838a92d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_unzip hanging

2016-08-22 Thread 'J Hawkesworth' via Ansible Project
Would it be possible to use win_file state: absent first?  I don't know 
what problem you are trying to solve but its a pattern I use, which I like 
as that way I know the contents of an unzipped folder only contains the 
things in my zip, thereby enforcing that my playbook remains in control of 
what is left on my managed hosts.

Jon

On Thursday, August 18, 2016 at 5:41:27 PM UTC+1, Derek Viljoen wrote:
>
> I've got the same problem.  It is because the Expand-Archive command in 
> the generated powershell script prompts the user to overwrite an existing 
> file/directory.  I've opened another thread asking if anyone knows how to 
> force it to overwrite without prompting.
>
>
> On Thursday, July 16, 2015 at 6:16:29 AM UTC-5, Guillaume Querso wrote:
>>
>> hi jon,
>>
>> unfortunately, nothing works to solve the problem... is there anything 
>> new on the domain access? because it  would make things a lot easier for me 
>> (and the windows community)!!! 
>>
>> Thanks
>>
>> Le mercredi 15 juillet 2015 14:53:36 UTC+1, J Hawkesworth a écrit :
>>>
>>> Hi Guillaume,
>>>
>>> A few things you could try.
>>>
>>> Run with -v to see if the module is being run.
>>>
>>> 2/ set 
>>> ANSIBLE_KEEP_REMOTE_FILES=1 on your controller before running your 
>>> playbook.
>>>
>>> This will then not delete the powershell scripts so you can log into the 
>>> affected machine and run them directly in powershell 
>>>
>>> 3/ check event log for errors.
>>>
>>> Hopefully you can find out what the problem is using the above.
>>>
>>> Jon
>>>
>>> On Wednesday, July 15, 2015 at 12:24:53 PM UTC+1, Guillaume Querso wrote:

 hi all,

 I am using ansible to unzip files on a windows 2008 R2 server. My 
 playbook was working fine but for an unknown reason, the win_unzip module 
 is now never ending. i am running ansible 1.9.2. 
 Thank you for your help!!

>>>

-- 
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/72287aa6-2c78-4718-bbbd-d7fbc5518631%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Apt-get simulate command

2016-08-22 Thread Jean-Yves LENHOF
Le 22/08/2016 à 09:19, Rémi Morel a écrit :
> Hello,
>
> I have spend a lot of time to find a solution at this issue.
> I have a task :
>
> |
> -name:check updated package(Debian)
>   command:apt-get-s install {{item.item }}
>   register:updateD
>   when:(ansible_os_family =="Debian")and(installD
> isdefined)and({{item.rc }}==0)
>   with_items:"{{ installD.results }}"
>   failed_when:updateD >1
>   changed_when:no
> |
>
> and Ansible reaction is :
>
> [WARNING]: Consider using apt module rather than running apt-get
>
> But I don't find any option in documentation to obtain the result of "-s".

Hi,

Could you explain what you want to do ?
To not do things in ansible but simulate, there's --check command line
option

Regards,

JYL

-- 
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/da8641c0-1d5a-d295-c406-aaea3eeed095%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] playbook fails testing connection from loadbalancer (nginix) to 2 backend webhosts (apache2)

2016-08-22 Thread James Lovato
The test to the loadbalancer itself never fails, and serves the same 
content as the websites (although host and metadata are a bit different), 
and I can't for the life of me figure out the disconnect.
If someone can point me in the right direction it would be appreciated.

All hosts are ubuntu 16.04.01 LTS
hostnames:
loadbalancer - Ansible-nginx
webcluster - AnsibleWeb, AnsibleWeb2

All AWS EC2 instances



The loadbalancer lines in my status playbook:

- hosts: loadbalancer
  tasks:
- name: verify backend index response
  uri: url=http://{{item}} return_content=yes
  with_items: '{{groups.webcluster}}'
  register: app_index

- fail: msg="index failed to return content"
  when: "'Hello, from sunny {{item.item}}!' not in item.content"
  with_items: "{{app_index.results}}"


Output of the play before it stops:

PLAY [loadbalancer] 


TASK [setup] 
***
ok: [Ansible-nginx]

TASK [verify backend index response] 
***
ok: [Ansible-nginx] => (item=AnsibleWeb)
ok: [Ansible-nginx] => (item=AnsibleWeb2)

TASK [fail] 

failed: [Ansible-nginx] (item={*u*'*status': 200*, u'content_length': 
u'35', '_ansible_item_result': True, u'date': u'Sat, 20 Aug 2016 23:26:21 
GMT', '_ansible_no_log': False, u'url': u'http://AnsibleWeb', u'changed': 
False, u'server': u'Apache/2.4.18 (Ubuntu)', *u'content': u'Hello, from 
sunny ip-172-31-30-54!\n'*, 'item': u'AnsibleWeb', u'connection': u'close', 
u'content_type': u'text/html; charset=utf-8', 'invocation': {'module_name': 
u'uri', u'module_args': {u'directory_mode': None, u'force': False, 
u'remote_src': None, u'follow_redirects': u'safe', u'body_format': u'raw', 
u'owner': None, u'follow': False, u'group': None, u'use_proxy': True, 
u'setype': None, u'content': None, u'serole': None, u'status_code': [200], 
u'return_content': True, u'method': u'GET', u'body': None, u'url_username': 
None, u'src': None, u'dest': None, u'selevel': None, u'force_basic_auth': 
False, u'removes': None, u'http_agent': u'ansible-httpget', u'regexp': 
None, u'url_password': None, u'url': u'http://AnsibleWeb', u'backup': None, 
u'seuser': None, u'creates': None, u'headers': {}, u'delimiter': None, 
u'mode': None, u'timeout': 30, u'validate_certs': True}}, u'msg': u'OK (35 
bytes)', u'redirected': False}) => {"failed": true, "item": {"changed": 
false, "connection": "close", *"content": "Hello, from sunny 
ip-172-31-30-54!\n",* "content_length": "35", "content_type": "text/html; 
charset=utf-8", "date": "Sat, 20 Aug 2016 23:26:21 GMT", "invocation": 
{"module_args": {"backup": null, "body": null, "body_format": "raw", 
"content": null, "creates": null, "delimiter": null, "dest": null, 
"directory_mode": null, "follow": false, "follow_redirects": "safe", 
"force": false, "force_basic_auth": false, "group": null, "headers": {}, 
"http_agent": "ansible-httpget", "method": "GET", "mode": null, "owner": 
null, "regexp": null, "remote_src": null, "removes": null, 
"return_content": true, "selevel": null, "serole": null, "setype": null, 
"seuser": null, "src": null, "status_code": [200], "timeout": 30, "url": 
"http://AnsibleWeb;, "url_password": null, "url_username": null, 
"use_proxy": true, "validate_certs": true}, "module_name": "uri"}, "item": 
"AnsibleWeb", "msg": "OK (35 bytes)", "redirected": false, "server": 
"Apache/2.4.18 (Ubuntu)", "status": 200, "url": "http://AnsibleWeb"}, 
"msg": "index failed to return content"}
failed: [Ansible-nginx] (item={*u'status': 200,* u'content_length': u'35', 
'_ansible_item_result': True, u'date': u'Sat, 20 Aug 2016 23:26:21 GMT', 
'_ansible_no_log': False, u'url': u'http://AnsibleWeb2', u'changed': False, 
u'server': u'Apache/2.4.18 (Ubuntu)', *u'content': u'Hello, from sunny 
ip-172-31-24-83!\n',* 'item': u'AnsibleWeb2', u'connection': u'close', 
u'content_type': u'text/html; charset=utf-8', 'invocation': {'module_name': 
u'uri', u'module_args': {u'directory_mode': None, u'force': False, 
u'remote_src': None, u'follow_redirects': u'safe', u'body_format': u'raw', 
u'owner': None, u'follow': False, u'group': None, u'use_proxy': True, 
u'setype': None, u'content': None, u'serole': None, u'status_code': [200], 
u'return_content': True, u'method': u'GET', u'body': None, u'url_username': 
None, u'src': None, u'dest': None, u'selevel': None, u'force_basic_auth': 
False, u'removes': None, u'http_agent': u'ansible-httpget', u'regexp': 
None, u'url_password': None, u'url': u'http://AnsibleWeb2', u'backup': 
None, u'seuser': None, u'creates': None, u'headers': {}, u'delimiter': 
None, u'mode': None, u'timeout': 30, u'validate_certs': True}}, u'msg': 
u'OK (35 bytes)', u'redirected': False}) => {"failed": true, "item": 
{"changed": false, "connection": "close", *"content": "Hello, from sunny 
ip-172-31-24-83!\n",* 

[ansible-project] stdout looks empty, but 'when' thinks it isn't?

2016-08-22 Thread 'Steve Kersley' via Ansible Project
As an Ansible newcomer, I'm trying to write some scripts to standardize 
Cisco switch configuration.  Unfortunately since Cisco doesn't offer a way 
to clear existing configuration before setting (in this instance I'm 
wanting to erase and standardize syslog targets, which is mostly configured 
as one value, but on some switches may have never been set, or may have 
been pointed at one of three other hosts in addition to the normal), I 
decided the easiest way was to first fetch the current setting(s), then 
iterate through and erase them, then set the correct target.

This works fine, but it fails on a switch that has no current value set, so 
I used a 'when' clause to check if stdout from the collection task is 
empty.  However, this isn't working.  If I print via debug the value of 
stdout, it certainly looks empty so why isn't the when clause working?

Any help on what I'm doing wrong (or a better way to do it) appreciated? 
 For the moment I can kludge around it by setting a value before I delete 
all the values, so that I know it should always have something and not 
worry about it, but that's bad practice and I'd prefer to know what I'm 
doing wrong for next time!

- hosts: switches
  gather_facts: False
  vars:
cli:
  host: "{{ inventory_hostname }}"
  username: user
  password: password
  auth_pass: password
  transport: cli
  tasks:
  - name: Collect logging configuration
connection: local
become: false
register: syslog
ios_command:
  provider: "{{ cli }}"
  authorize: yes
  commands:
- show running-config | include logging host

  - debug: msg="empty"
when: syslog.stdout == ""
  - debug: msg="not empty"
when: syslog.stdout != ""
  - debug: var=syslog.stdout

  - name: Remove existing syslog config
connection: local
become: false
when: syslog.stdout != ""
ios_command:
  provider: "{{ cli }}"
  authorize: yes
  commands:
- configure terminal
- no {{ item }}
- exit
with_items: "{{ syslog.stdout_lines }}"

Output:
PLAY [switches] 


TASK [Collect logging configuration] 
***
ok: [switchname]

TASK [debug] 
***
skipping: [switchname]

TASK [debug] 
***
ok: [switchname] => {
"msg": "not empty"
}

TASK [debug] 
***
ok: [switchname] => {
"syslog.stdout": [
""
]
}

TASK [Remove existing syslog config] 
***
failed: [switchname] (item=) => {"commands": ["configure terminal", "no ", 
"exit"], "failed": true, "item": "", "msg": "matched error in response: no 
\r\n% Incomplete command.\r\n\r\nSwitchName(config)#"}


Thanks,
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/593b3798-a437-41b2-b4b4-65afa3e13bff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Perform a failed_when: on an async task based on a value from stdout

2016-08-22 Thread Omar E
I am trying to perform a failed_when: on an async task based on a value 
from stdout.

This is my task:

  - name: RUN SOME TASK LOCALLY
command: .sh
 chdir=/task_folder/
delegate_to: localhost
register: task_status
async: 3600
poll: 0

This is where I check on the task status and would like it to fail when the 
specified text is in stdout.

 - name: CHECK TASK PROGRESS
   async_status: jid={{ task_status.ansible_job_id }}
   register: poll_status
   until: poll_status.finished
   retries: 100
   failed_when: "'ERROR. TASK FAILED.' in poll_status.stdout"

When I run the above playbook I am faced with the following error from 
Ansible

TASK [CHECK TASK PROGRESS] 
* 
fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional 
check ''ERROR. TASK FAILED.' in poll_status.stdout' failed. The error was: 
error while evaluating conditional ('ERROR. TASK FAILED.' in 
poll_status.stdout): Unable to look up a name or access an attribute in 
template string ({% if 'ERROR. TASK FAILED.' in poll_status.stdout %} True 
{% else %} False {% endif %}).\nMake sure your variable name does not 
contain invalid characters like '-': argument of type 'StrictUndefined' is 
not iterable"}


Help! Thanks in advance.


-- 
This communication contains information which is confidential and the 
copyright of Whispir or a third party. If you have received this email in 
error please notify us by return email or telephone Whispir on +613 8630 
9900 and delete the document and delete all copies immediately. If you are 
the intended recipient of this communication you should not copy, disclose 
or distribute this communication without the authority of Whispir. Any 
views expressed in this Communication are those of the individual sender, 
except where the sender specifically states them to be the views of 
Whispir. Except as required at law, Whispir does not represent, warrant 
and/or guarantee that the integrity of this communication has been 
maintained nor that the communication is free of errors,virus, interception 
or interference.

-- 
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/43dff1e3-51e1-4b82-af5d-b1bc2b2967c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Apt-get simulate command

2016-08-22 Thread Rémi Morel
Hello,

I have spend a lot of time to find a solution at this issue.
I have a task :

- name: check updated package (Debian)
  command: apt-get -s install {{ item.item }}
  register: updateD
  when: (ansible_os_family == "Debian") and (installD is defined) and ( {{ 
item.rc }} == 0)
  with_items: "{{ installD.results }}"
  failed_when: updateD > 1
  changed_when: no

and Ansible reaction is :

[WARNING]: Consider using apt module rather than running apt-get

But I don't find any option in documentation to obtain the result of "-s".

-- 
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/80f9c607-eea7-47b6-a2b3-3133fa501549%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible 2.1.0 organizing host_vars

2016-08-22 Thread Marvyn Alcantara
Hello

we would like to ask if this is possible, Organizing host specific 
configurations for web servers via host_vars directory. our goal is to 
consolidate all host specific machine configurations (ie, IP addresses1, IP 
address2, virtual host configurations per hosts.. etc) 

our current playbook scenario

inventory/ 
playbooks/
   -> cms-generic/
-> group_vars/group_varible.yml
-> host_vars/host_server1.yml
   host_server2.yml
   host_serverN.yml

.
.

we are wondering if this are possible 

inventory/ 
playbooks/
   -> cms-generic/
-> group_vars/group_varible.yml
-> host_vars/groupA/host_server1.yml
  
host_server2.yml
-> host_vars/groupB/host_server3.yml
 
host_server4.yml
-> host_vars/groupN/host_serverN.yml

Thank you

-- 
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/2a2c92cc-2c0d-40ae-907f-3536046c5728%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Pre-requisite tasks

2016-08-22 Thread Dan Nestor
Hello everybody, this is my first post here.

I have a playbook that includes these tasks:

- name: Staging directory exists
  file:
path: "{{ staging_dir }}"
recurse: yes
state: directory


- name: "{{ java_package }} is present in staging directory"
  copy:
src: "{{ java_package }}"
dest: "{{ staging_dir }}/{{ java_package }}"


- name: "{{ java_package }} is installed"
  yum:
name: "{{ staging_dir }}/{{ java_package }}"
state: present

I would like to copy the file to the host only if needed, that is, the RPM 
in question is not already installed. Can I do this in Ansible?

Thanks!

Dan

-- 
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/92d3af4c-cd74-4a13-8cd9-584d5c9780a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Purge any iptables rules which are NOT in playbook

2016-08-22 Thread John Doe
Hey,

I want to make sure that any existing iptables rules will be gone after I 
run my play book, in puppet I just need to set purge to yes or something 
very similar, but I can't find anything related in ansible/iptables module. 
Any ideas how I could achieve that ?

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/aae98fec-9f13-4610-80f2-dfe2e21bcd6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Some Ansible Windows winrm variables doesn't seems to be use

2016-08-22 Thread Googly Googly
Just did upgrade to 2.1.1.0 still facing the same issue:

Loaded callback minimal of type stdout, v2.0
<10.10.32.29> ESTABLISH WINRM CONNECTION FOR USER: amitag on PORT 5985 TO 
10.10.32.29
10.10.32.29 | UNREACHABLE! => {
"changed": false,
"msg": "plaintext: HTTPConnectionPool(host='10.10.32.29', port=5985): 
Max retries exceeded with url: /wsman (Caused by 
ConnectTimeoutError(, 'Connection to 10.10.32.29 timed out. (connect 
timeout=30)'))",
"unreachable": true
}




On Wednesday, July 6, 2016 at 3:36:00 AM UTC+5:30, Matt Davis wrote:
>
> There was a late change to 2.1.0 that broke psuedo-connection vars (eg, 
> ansible_winrm_X) defined in group_vars files, preventing them from 
> propagating correctly into the worker process (where flat inventory files 
> worked fine). It's been corrected for 2.1.1 (currently in release 
> candidate). 
>
> On Tuesday, July 5, 2016 at 5:44:30 AM UTC-7, Googly Googly wrote:
>>
>> Hi,
>>
>>
>> I am facing exactly same issue. Did you find solution to this? It was 
>> giving me another issue till y'day and since this morning when I restarted 
>> my Linux VM. I started getting this issue.
>>
>> Thanks,
>>
>> On Thursday, June 9, 2016 at 2:06:18 AM UTC+5:30, Julien Savard wrote:
>>>
>>> Hi,
>>> It seems ansible does not use the variables in /etc/ansible/hosts for 
>>> winrm connection :
>>>
>>> In /etc/ansible/hosts : 
>>>
>>> [windows]
>>> 10.10.10.10
>>>
>>> [windows:vars]
>>> ansible_user=WindowsUser
>>> ansible_password=UserPassword
>>> ansible_winrm_scheme=http
>>> ansible_port=5985
>>> ansible_connection=winrm
>>> ansible_winrm_server_cert_validation=ignore
>>>
>>>
>>> [root@linuxServer ~]# ansible windows -m win_ping
>>> 10.10.10.10 | FAILED => Traceback (most recent call last):
>>>   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", 
>>> line 586, in _executor
>>> exec_rc = self._executor_internal(host, new_stdin)
>>>   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", 
>>> line 789, 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 968, 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 94, in _winrm_connect
>>> realm=realm)
>>>   File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 68, in 
>>> __init__
>>> auth_method=transport)
>>>   File "/usr/lib/python2.7/site-packages/winrm/transport.py", line 109, 
>>> in __init__
>>> raise InvalidCredentialsError("auth method %s requires a password" % 
>>> self.auth_method)
>>> InvalidCredentialsError: auth method plaintext requires a password
>>>
>>>
>>> [root@linuxServer ~]# ansible windows -m win_ping -k
>>> SSH password:
>>> 10.10.10.10 | FAILED => Traceback (most recent call last):
>>>   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", 
>>> line 586, in _executor
>>> exec_rc = self._executor_internal(host, new_stdin)
>>>   File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", 
>>> line 789, 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 968, 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, 

Re: [ansible-project] Ansible hostname alias not in setup

2016-08-22 Thread Kai Stian Olstad

On 22. aug. 2016 10:43, Tomasz Klosinski wrote:

Is it possible to access {{ ansible_ssh_host }} variable from inventory in
the above example? I need ip addresses to provision VMs before I run
Ansible on them.


Yes, but ansible_ssh_host is deprecated in version 2.x  so use 
ansible_host instead.


--
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/8c5e9786-8427-ec0f-55ae-29c21beee549%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] template not looking in templates directory for included roles

2016-08-22 Thread Dick Davies
Roles look in their own templates/ directory for templates. The nginx
role will be applied first due to the dependency, but it has its own
templates/ directory.

On 21 August 2016 at 15:32, Daniel Watrous  wrote:
> I have a playbook with several roles. For example, I have an nginx role and
> a php role. Each has the typical directory structure. The nginx role has a
> template and a task for a virtualhost file that appears like this in the
> tasks
>
> - name: "Move virtual host file into place"
>   template: "src={{item.src}} dest={{item.dest}} mode={{item.mode}} owner={{
> nginx_site_user }} group={{ nginx_site_group }}"
>   with_items:
> - dest: "{{ nginx_sites_available }}/{{ nginx_site_user }}"
>   src: "{{ nginx_vhost_file_template }}"
>   mode: 640
>   notify:
>   - restart nginx
>
> When I run the nginx role, the variable nginx_vhost_file_template is set to
> "default" and the file "roles/nginx/templates/default" exists. This works
> fine.
>
> For my PHP role, I simply want to override the nginx_vhost_file_template
> variable to point to a file "phpsitevhost" in the directory
> "roles/php/templates/phpsitevhost". The php role includes the file
> "meta/main.yml" with the following contents.
>
> ---
> dependencies:
>   - { role: nginx }
>
> Based on the documentation
> http://docs.ansible.com/ansible/playbooks_roles.html#roles, I would expect
> the template call in the nginx role to look in both "roles/nginx/templates/"
> and "roles/php/templates/". It's not working this way and instead I get
>
> TASK [nginx : Move virtual host file into place]
> ***
> failed: [localhost] (item={u'dest': u'/etc/nginx/sites-available/examplewp',
> u'src': u'phpsitevhost', u'group': u'examplewp', u'mode': 640, u'owner':
> u'examplewp'}) => {"failed": true, "item": {"dest":
> "/etc/nginx/sites-available/examplewp", "group": "examplewp", "mode": 640,
> "owner": "examplewp", "src": "phpsitevhost"}, "msg": "IOError: [Errno 2] No
> such file or directory: u'/home/vagrant/src/phpsitevhost'"}
>
>
> It appears to only be searching for the file in the directory where the
> playbook file is.
>
> How can I get the documented behavior where it would look for the file in
> the templates directories for all included roles?
>
>
>
> --
> 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/b779599d-597b-4f6e-84fd-6f5918221777%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/CAK5eLPRYZodnJbvd7z-icgM29zajJbY-Kd%3DgEUy2yt0dcEkYOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Use of fetch -- can we preserve timestamps?

2016-08-22 Thread Paul Tötterman

>
> Would it be possible to add an option to PRESERVE the file time stamps 
> (mtime, ctime)?
>

You could try opening a feature request ticket 
on https://github.com/ansible/ansible-modules-core

Cheers,
Paul

-- 
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/eb9a1fdb-0f5c-4b31-b30b-548256f3fcbe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible hostname alias not in setup

2016-08-22 Thread Tomasz Klosinski
Hello,

Is it possible to access {{ ansible_ssh_host }} variable from inventory in 
the above example? I need ip addresses to provision VMs before I run 
Ansible on them. 
Thanks in advance,

Tomasz Klosinski

On Thursday, 17 April 2014 15:39:28 UTC+2, Brian Coca wrote:
>
> inventory_hostname is a 'magic' variable and always present, its not part 
> of fact gathering but inventory definition.
>
> to see if a variable exists for a host you can do:
>
> 'varname' in hostvars[]
> ​
>

-- 
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/6b511bf3-4e26-435d-aa03-8d0b9df1eee5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible Playbook Doesn't run on RHEL 4.x

2016-08-22 Thread Jean-Yves LENHOF


Le 22/08/2016 à 09:34, Mona Gopal a écrit :
> Hi,
>
> My ansible playbook works on 6.x and the same fails with the below
> error on 4.x
>
> Error is:
>
> fatal: [172.19.1.239]: FAILED! => {"changed": false, "failed": true,
> "module_stderr": "", "module_stdout": "Traceback (most recent call
> last):\r\n  File
> \"/root/.ansible/tmp/ansible-tmp-1471850606.58-237797342898160/setup\",
> line 10, in ?\r\nimport subprocess\r\nImportError: No module named
> subprocess\r\n", "msg": "MODULE FAILURE", "parsed": false}
>
>
> *4.x has python2.7 installed on it /usr/local/bin.*
>
>
> Could you please help a way forward
>
>
> Thanks in advance,
>
> Mona G
>
>
>

Verify that you have |subprocess.py on your python2.7 installation...
|
You should also use ansible_python_interpreter in your inventory for
this server (http://docs.ansible.com/ansible/faq.html, How do I handle
python pathing not having a Python 2.X in /usr/bin/python on a remote
machine?)


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/b9d24083-aee5-71b0-6888-3c25766f2cdf%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible Playbook Doesn't run on RHEL 4.x

2016-08-22 Thread Kai Stian Olstad

On 22. aug. 2016 09:34, Mona Gopal wrote:

My ansible playbook works on 6.x and the same fails with the below error on
4.x

Error is:

fatal: [172.19.1.239]: FAILED! => {"changed": false, "failed": true,
"module_stderr": "", "module_stdout": "Traceback (most recent call
last):\r\n  File
\"/root/.ansible/tmp/ansible-tmp-1471850606.58-237797342898160/setup\",
line 10, in ?\r\nimport subprocess\r\nImportError: No module named
subprocess\r\n", "msg": "MODULE FAILURE", "parsed": false}


*4.x has python2.7 installed on it /usr/local/bin.*


Ansible expect Python to be at /usr/bin/python if it's not you need to 
set ansible_python_interpreter.


https://docs.ansible.com/ansible/faq.html#how-do-i-handle-python-pathing-not-having-a-python-2-x-in-usr-bin-python-on-a-remote-machine

--
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/14ab9762-6886-28a9-4713-7c43df7103e2%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Playbook Doesn't run on RHEL 4.x

2016-08-22 Thread Mona Gopal
Hi,

My ansible playbook works on 6.x and the same fails with the below error on 
4.x

Error is:

fatal: [172.19.1.239]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "", "module_stdout": "Traceback (most recent call 
last):\r\n  File 
\"/root/.ansible/tmp/ansible-tmp-1471850606.58-237797342898160/setup\", 
line 10, in ?\r\nimport subprocess\r\nImportError: No module named 
subprocess\r\n", "msg": "MODULE FAILURE", "parsed": false}


*4.x has python2.7 installed on it /usr/local/bin.*


Could you please help a way forward


Thanks in advance,

Mona G



-- 
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/85b73d86-657f-443f-984c-df2a56e95675%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.