Re: [ansible-project] Variables in defaults/main.yml of a role are accessible from other roles. What if we have same {{ VAR }} names in several roles? Just wanted to check if this case is intended.

2014-04-04 Thread Marko_Lisica
Hi,

That is 100% clear. But in this case one role does not have its own
defaults and inherits defaults from the last role in a list regardles if
that role is played or not.


On Fri, Apr 4, 2014 at 12:16 AM, Michael DeHaan mich...@ansible.com wrote:

 It's entirely intended.  For instance, you might have a role that applies
 a particular configuration to machines that live in a particular
 datacenter, and one of the things that sets might be the port to use for
 the database
 server.  That port variable would then be available to other roles.

 While this sounds scary at first, Ansible contains safeguards to make sure
 the variables used in one role are absolutely used there and not clobbered
 by another.  Thus they have guaranteed scope to that role.

 As such, if you define a variable port in two places, each role is
 guaranteed to be able to read the local value.


 On Thu, Apr 3, 2014 at 10:09 AM, Marko Lisica titelskib...@gmail.comwrote:

 Hi,

 I stumbled onto little mind game with ansible today : D .

 I have three roles that are tagged.

 - hosts: vagrant
   sudo: yes
   roles:
 - {role: ansible_users, tags: users}
 - {role: ansible_nginx, tags: nginx}
 - {role: ansible_mysql, tags: mysql}


 I have defaults/main.yml for ansible_users and ansible_mysql in their
 respective places.

 This is ansible_users defaults:

 ---
 users:
   - user: detlic
 webdir:
   - woodpecker
   - aligator
   - user: keder
 webdir: []


 This is ansible_mysql defaults:

 ---
 users:
   - user: detlic
 db:
   - aligatordb
   - woodpeckerdb
   - user: jazavac
 db:
   - badgerdb
   - ddaybdb


 I have left NGINX role without defaults. How I understand things is
 that NGINX will inherit defaults vars from other roles and use them where
 it can. But in this case {{ VARS }} are named the same in both USER and
 MYSQL roles.

 NGINX role is before MYSQL from whoom it should inherit vars? In my test
 case it inherits it from the LAST role in the list. So in this case it is
 MYSQL. If I remove MYSQL role from a list then everything is fine.

 Another thing is if I leave MYSQL role present BUT use TAGS and play
 roles with jsut USERS and NGINX tags, still NGINX inherits defaults from
 MYSQL.

 Can someone comment on this.

 --
 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/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/y_Gucqc_3sE/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/CAEVJ8QPg4RQo6Ae-K0pLUAkyA6J2W7R53-nxGNmZPR%3DGKKM7iA%40mail.gmail.comhttps://groups.google.com/d/msgid/ansible-project/CAEVJ8QPg4RQo6Ae-K0pLUAkyA6J2W7R53-nxGNmZPR%3DGKKM7iA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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/CABqYKhB9bpMmDOz7QDhCscrsY%3DWAdvpAor65pBtRpXh5GToqPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible 1.5.4 breaks variables in vars_files

2014-04-04 Thread Mark Nottingham
I have a playbook with the following:

  vars_files:
- vars/{{ ansible_pkg_mgr }}.yml

... that works fine in 1.5.3, but 1.5.4 doesn't appear to be able to find 
it; when one of the variables that should have been imported is referenced, 
it throws a 'foo is undefined' error.

I can provide a minimal reproduction if it'd be helpful.

-- 
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/72edbc94-1dab-4b83-a41e-f141b5d51cb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] variable isn't expanded correctly?

2014-04-04 Thread Dario Bertini
You're right, anyhow this is a regression introduced with ansible 1.5.0

-- 
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/a53fa008-066a-4ac0-a8da-919f4e8e9b72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Cleaning up after failed ansible run

2014-04-04 Thread Rike-Benjamin Schuppner
So, this means there is no good answer for cleaning up / ad-hoc debugging 
or was it just the question which was unclear? It happens regularly that 
ansible gets stuck on some machine (doing apt upgrades) and I don’t see any 
practical way of finding out even where it got stuck and why.

Cheers
/rike

Am Montag, 10. März 2014 11:56:08 UTC+1 schrieb Rike-Benjamin Schuppner:

 Hi,

 sometimes, ansible fails on a machine and leaves back running but possibly 
 blocking and frozen processes such as

 /usr/bin/python 
 /root/.ansible/tmp/ansible-tmp-1394441713.94-63420941773266/apt

 Is there a way to clean up those processes?

 Also related: Ansible sometimes apparently freezes or halts when running 
 on a client (or at least it does not return in time). Is there a way to at 
 the very least tell which host is affected without having to CTRL-C 
 everything and restart with -? Sometimes it would be really nice to get 
 back some live status information without having to wait for the process to 
 return correctly (which may not even happen at all if the process is 
 waiting for user input).

 Cheers
 /rike



-- 
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/3d644ae2-0fc8-4c17-8bed-5ca5f880d9a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running python command on when statement

2014-04-04 Thread Matt Martz
Douglas,

You won't be able to use pure python in a when statement, you will have to 
handle it using jinja2.

I see 2 options for you:

1) Use a combination of several jinja2 filters to get you what you want such as:

when: 
ansible_mounts|map(attribute='mount')|intersect(['/var/lib/myMount'])|length == 0

2) Create your own custom jinja2 filter to do this.

-- 
Matt Martz
m...@sivel.net

On April 3, 2014 at 10:27:23 PM, douglaslopespere...@gmail.com 
(douglaslopespere...@gmail.com) wrote:

Hi all,

I was trying to update ansible from 1.2 to 1.5 and noticed that I can no longer 
use only_if which has been replaced by when.

But when I try to run a shell task with this condition:

when: len(filter(lambda m: m['mount'] == '/var/lib/myMount', 
'{{ansible_mounts}}')) == 0

I get the following error:

error while evaluating conditional: len(filter(lambda m: m['mount'] == 
'/var/lib/myMount', '[{u'size_total': 8455118848, u'mount': u'/', 
u'size_available': 6891151360, u'fstype': u'ext4', u'device': u'/dev/xvda1', 
u'options': u'rw'}, {u'size_total': 16122802176, u'mount': u'/mnt', 
u'size_available': 15129432064, u'fstype': u'ext3', u'device': u'/dev/xvdb', 
u'options': u'rw,_netdev'}, {u'size_total': 107321753600, u'mount': 
u'/var/lib/myMount', u'size_available': 107250851840, u'fstype': u'xfs', 
u'device': u'/dev/xvdf', u'options': u'rw,noatime'}]')) == 0

The ansible_mounts variable is being correctly returned as you can see in the 
error message.

I've tryed different combinations of positioning the quote marks but no luck.

Any help?

Regards,
Douglas
--
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/112db0a1-c88e-4bc5-a896-a9f738909391%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/etPan.533ea293.6b8b4567.c382%40mobiletuvix.rackspace.corp.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible conditions and logics

2014-04-04 Thread Maxim Odinintsev
Yes, this is valid syntax and this conditions working as AND. And it 
working for me ;)
You can create simple playbook for verifying it.

I've never seen this syntax used with when:

 - name: Moving on
   debug: msg=doing something with {{ item.item }}
   when:
 - item.stat.exists == true
 - item.stat.islnk != true
   with_items: st.results

 Is that a valid conditional? Is it equivalent to 'and' ?

 On Wednesday, April 2, 2014 5:53:52 AM UTC-5, Maxim Odinintsev wrote:

 Hello,

 I'm tried make it over ansible, but in final, i think much easiest way is 
 using script module.

 If someone interesting, when i tried it, i'm used this construction for 
 getting files attributes and states:

 - name: Getting files stats
   stat: path={{ item }}
   register: st
   with_items:
- /etc/asterisk
- /etc/bind
- /etc/GeoIP.conf
- /etc/iptables
- /etc/jabber
- /etc/monit
- /etc/mysql
- /etc/nginx
- /etc/postfix
- /etc/ppp
- /etc/snmp
- /etc/sphinx
- /etc/xl2tpd

 - name: Moving on
   debug: msg=doing something with {{ item.item }}
   when:
 - item.stat.exists == true
 - item.stat.islnk != true
   with_items: st.results


 Thank you


 Hello,

 Yes, you understand correctly. How can I synchronize files on remote 
 node (not from local host to remote) ?

 Thank you.

 If I understand correctly, you're copying the contents of several 
 directories to a central location, removing the old path, and then 
 creating 
 a symlink to the new location? To do that with ansible you'd just need to 
 call the synchronize module to copy the files (or use command/shell to do 
 the rsync), and then use the file module to create the symlink.


 On Mon, Mar 31, 2014 at 6:56 AM, Maxim Odinintsev gwyn...@gmail.comwrote:

 Hello,

 I'm trying migrate out my infrastructure under ansible control, but 
 stopped on simple things realization with ansible.

 I would be very grateful if some one can explain, best way for moving 
 on this simple shell script under ansible. 
 May be simplest way is running external shell, and not try to push it 
 all under ansible logic ?

 pushd /
 for i in \
   /etc/ipsec* \
   /home \
   /root \
   do
   [[ -r $i ]] || continue
   [[ -L $i ]]  continue
   dst_dir=$(readlink -m /protected$(dirname $i))
   dst_name=${dst_dir}/$(basename $i)
   mkdir -p $dst_dir
   rsync -a $i $dst_dir  rm -rf $i  ln -s $dst_name $i
   ls -ld $i
 done
 popd

 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-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/a29d1d41-ffd3-40e9-8cc4-a4a891e443c6%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/a29d1d41-ffd3-40e9-8cc4-a4a891e443c6%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/2c6b7061-c9c5-4712-8088-13e6943ae4a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running python command on when statement

2014-04-04 Thread douglaslopespereira
Hi Matt,

That is a great suggestion! I will give it a try.

I overcame this by using this task:

- name: check mount point
  shell: mount | sed -n -e '/\/var\/lib\/myMount.*/p'
  register: result

and after that using the result variable on the when statement:

when: result.stdout==

It looks like your solution is more straightforward.

Thank you.
Regards,
Douglas

On Friday, April 4, 2014 9:16:19 AM UTC-3, Matt Martz wrote:

 Douglas,

 You won't be able to use pure python in a when statement, you will have to 
 handle it using jinja2.

 I see 2 options for you:

 1) Use a combination of several jinja2 filters to get you what you want 
 such as:

 when: 
 ansible_mounts|map(attribute='mount')|intersect(['/var/lib/myMount'])|length 
 == 0

 2) Create your own custom jinja2 filter to do this.

 -- 
 Matt Martz
 ma...@sivel.net javascript:

 On April 3, 2014 at 10:27:23 PM, douglaslo...@gmail.com javascript: (
 douglaslo...@gmail.com javascript:) wrote:

 Hi all,

 I was trying to update ansible from 1.2 to 1.5 and noticed that I can no 
 longer use only_if which has been replaced by when.

 But when I try to run a shell task with this condition:

 when: len(filter(lambda m: m['mount'] == '/var/lib/myMount', 
 '{{ansible_mounts}}')) == 0

 I get the following error:

 error while evaluating conditional: len(filter(lambda m: m['mount'] == 
 '/var/lib/myMount', '[{u'size_total': 8455118848, u'mount': u'/', 
 u'size_available': 6891151360, u'fstype': u'ext4', u'device': 
 u'/dev/xvda1', u'options': u'rw'}, {u'size_total': 16122802176, u'mount': 
 u'/mnt', u'size_available': 15129432064, u'fstype': u'ext3', u'device': 
 u'/dev/xvdb', u'options': u'rw,_netdev'}, {u'size_total': 107321753600, 
 u'mount': u'/var/lib/myMount', u'size_available': 107250851840, u'fstype': 
 u'xfs', u'device': u'/dev/xvdf', u'options': u'rw,noatime'}]')) == 0

 The ansible_mounts variable is being correctly returned as you can see in 
 the error message.

 I've tryed different combinations of positioning the quote marks but no 
 luck.

 Any help?

 Regards,
 Douglas
 --
 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 javascript:.
 To post to this group, send email to ansible...@googlegroups.comjavascript:
 .
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/ansible-project/112db0a1-c88e-4bc5-a896-a9f738909391%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/112db0a1-c88e-4bc5-a896-a9f738909391%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


On Friday, April 4, 2014 9:16:19 AM UTC-3, Matt Martz wrote:

 Douglas,

 You won't be able to use pure python in a when statement, you will have to 
 handle it using jinja2.

 I see 2 options for you:

 1) Use a combination of several jinja2 filters to get you what you want 
 such as:

 when: 
 ansible_mounts|map(attribute='mount')|intersect(['/var/lib/myMount'])|length 
 == 0

 2) Create your own custom jinja2 filter to do this.

 -- 
 Matt Martz
 ma...@sivel.net javascript:

 On April 3, 2014 at 10:27:23 PM, douglaslo...@gmail.com javascript: (
 douglaslo...@gmail.com javascript:) wrote:

 Hi all,

 I was trying to update ansible from 1.2 to 1.5 and noticed that I can no 
 longer use only_if which has been replaced by when.

 But when I try to run a shell task with this condition:

 when: len(filter(lambda m: m['mount'] == '/var/lib/myMount', 
 '{{ansible_mounts}}')) == 0

 I get the following error:

 error while evaluating conditional: len(filter(lambda m: m['mount'] == 
 '/var/lib/myMount', '[{u'size_total': 8455118848, u'mount': u'/', 
 u'size_available': 6891151360, u'fstype': u'ext4', u'device': 
 u'/dev/xvda1', u'options': u'rw'}, {u'size_total': 16122802176, u'mount': 
 u'/mnt', u'size_available': 15129432064, u'fstype': u'ext3', u'device': 
 u'/dev/xvdb', u'options': u'rw,_netdev'}, {u'size_total': 107321753600, 
 u'mount': u'/var/lib/myMount', u'size_available': 107250851840, u'fstype': 
 u'xfs', u'device': u'/dev/xvdf', u'options': u'rw,noatime'}]')) == 0

 The ansible_mounts variable is being correctly returned as you can see in 
 the error message.

 I've tryed different combinations of positioning the quote marks but no 
 luck.

 Any help?

 Regards,
 Douglas
 --
 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 javascript:.
 To post to this group, send email to ansible...@googlegroups.comjavascript:
 .
 To view this discussion on the web visit 
 

Re: [ansible-project] Ansible 1.5.4 breaks variables in vars_files

2014-04-04 Thread James Cammarata
This issue was reported the other day and has been fixed in the devel
branch:

https://github.com/ansible/ansible/issues/6832

You can grab that patch for now if you'd like (
https://github.com/ansible/ansible/commit/9c6dd9f79c6fbed3346b951fc280f30cb6d676ae),
which will be included in the next release.



On Fri, Apr 4, 2014 at 3:43 AM, Mark Nottingham m...@mnot.net wrote:

 I have a playbook with the following:

   vars_files:
 - vars/{{ ansible_pkg_mgr }}.yml

 ... that works fine in 1.5.3, but 1.5.4 doesn't appear to be able to find
 it; when one of the variables that should have been imported is referenced,
 it throws a 'foo is undefined' error.

 I can provide a minimal reproduction if it'd be helpful.

 --
 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/72edbc94-1dab-4b83-a41e-f141b5d51cb4%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/72edbc94-1dab-4b83-a41e-f141b5d51cb4%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/CAFg%2Bn8SR3_%3D6qxV_fKuN9TiNp_LfWXW3HTnd3NfB1P3xCGrXBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] file module: absent recurse=yes and Directory not empty

2014-04-04 Thread Maxim Odinintsev
Hello,

When I'm run this job, but on some hosts return output:
rmtree failed: [Errno 39] Directory not empty: 
'/home/master/www/static.master/images/posters'

Sure this directories is not empty, and I'm want remove it recursive. But 
why i can't do this with file module ?

- name: Cleaner
  hosts: all
  sudo: yes

  tasks:
- name: get cache dirs
  shell: ls -1 /var/lib/nginx/cache/
  register: cache

- name: Remove cache
  file: name=/var/lib/nginx/cache/{{ item }} state=absent recurse=yes
  with_items: cache.stdout_lines

- name: get static dirs
  shell: ls -1 /home/master/www/static.master/
  register: static

- name: Clean static
  file: name=/home/master/www/static.master/{{ item }} state=absent 
recurse=yes
  with_items: static.stdout_lines


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/468b6757-2798-4003-ab2a-d9e5e85b6cd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Cleaning up after failed ansible run

2014-04-04 Thread Michael DeHaan
There's no mechanism for killing stuck processes other than say running
pkill.

(However if you use async you can set a lifetime time limit for a process
and it will be forcibly slain if that time limit is reached)

That's what's there now.



On Fri, Apr 4, 2014 at 8:15 AM, Rike-Benjamin Schuppner 
rikebenjamin.schupp...@googlemail.com wrote:

 So, this means there is no good answer for cleaning up / ad-hoc debugging
 or was it just the question which was unclear? It happens regularly that
 ansible gets stuck on some machine (doing apt upgrades) and I don't see any
 practical way of finding out even where it got stuck and why.

 Cheers
 /rike

 Am Montag, 10. März 2014 11:56:08 UTC+1 schrieb Rike-Benjamin Schuppner:

 Hi,

 sometimes, ansible fails on a machine and leaves back running but
 possibly blocking and frozen processes such as

 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1394441713.94-
 63420941773266/apt

 Is there a way to clean up those processes?

 Also related: Ansible sometimes apparently freezes or halts when running
 on a client (or at least it does not return in time). Is there a way to at
 the very least tell which host is affected without having to CTRL-C
 everything and restart with -? Sometimes it would be really nice to get
 back some live status information without having to wait for the process to
 return correctly (which may not even happen at all if the process is
 waiting for user input).

 Cheers
 /rike

  --
 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/3d644ae2-0fc8-4c17-8bed-5ca5f880d9a1%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/3d644ae2-0fc8-4c17-8bed-5ca5f880d9a1%40googlegroups.com?utm_medium=emailutm_source=footer
 .

 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/CAEVJ8QMS%2BNjFEeqc%3Dv_4EjSnO7nHH6MC56sfDwR7%2BWYfwjXCqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible conditions and logics

2014-04-04 Thread Michael DeHaan
Correct.




On Fri, Apr 4, 2014 at 8:58 AM, Maxim Odinintsev gwynn@gmail.comwrote:

 Yes, this is valid syntax and this conditions working as AND. And it
 working for me ;)
 You can create simple playbook for verifying it.


 I've never seen this syntax used with when:

 - name: Moving on
   debug: msg=doing something with {{ item.item }}
   when:
 - item.stat.exists == true
 - item.stat.islnk != true
   with_items: st.results

 Is that a valid conditional? Is it equivalent to 'and' ?

 On Wednesday, April 2, 2014 5:53:52 AM UTC-5, Maxim Odinintsev wrote:

 Hello,

 I'm tried make it over ansible, but in final, i think much easiest way
 is using script module.

 If someone interesting, when i tried it, i'm used this construction for
 getting files attributes and states:

 - name: Getting files stats
   stat: path={{ item }}
   register: st
   with_items:
- /etc/asterisk
- /etc/bind
- /etc/GeoIP.conf
- /etc/iptables
- /etc/jabber
- /etc/monit
- /etc/mysql
- /etc/nginx
- /etc/postfix
- /etc/ppp
- /etc/snmp
- /etc/sphinx
- /etc/xl2tpd

 - name: Moving on
   debug: msg=doing something with {{ item.item }}
   when:
 - item.stat.exists == true
 - item.stat.islnk != true
   with_items: st.results


 Thank you


 Hello,

 Yes, you understand correctly. How can I synchronize files on remote
 node (not from local host to remote) ?

 Thank you.

 If I understand correctly, you're copying the contents of several
 directories to a central location, removing the old path, and then 
 creating
 a symlink to the new location? To do that with ansible you'd just need to
 call the synchronize module to copy the files (or use command/shell to do
 the rsync), and then use the file module to create the symlink.


 On Mon, Mar 31, 2014 at 6:56 AM, Maxim Odinintsev 
 gwyn...@gmail.comwrote:

 Hello,

 I'm trying migrate out my infrastructure under ansible control, but
 stopped on simple things realization with ansible.

 I would be very grateful if some one can explain, best way for moving
 on this simple shell script under ansible.
 May be simplest way is running external shell, and not try to push it
 all under ansible logic ?

 pushd /
 for i in \
   /etc/ipsec* \
   /home \
   /root \
   do
   [[ -r $i ]] || continue
   [[ -L $i ]]  continue
   dst_dir=$(readlink -m /protected$(dirname $i))
   dst_name=${dst_dir}/$(basename $i)
   mkdir -p $dst_dir
   rsync -a $i $dst_dir  rm -rf $i  ln -s $dst_name $i
   ls -ld $i
 done
 popd

 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-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/a29d1d41-ffd3-40e9-8cc4-
 a4a891e443c6%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/a29d1d41-ffd3-40e9-8cc4-a4a891e443c6%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/2c6b7061-c9c5-4712-8088-13e6943ae4a9%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/2c6b7061-c9c5-4712-8088-13e6943ae4a9%40googlegroups.com?utm_medium=emailutm_source=footer
 .

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


Re: [ansible-project] Using sudo as root

2014-04-04 Thread Michael DeHaan
Unfortunately, it seems that
Ansible thinks it is smarter than I am, and refuses to run my modules
in sudo if the remote user is root, so everything fails with
permission denied errors.

This is true because sudo to the same user causes problems on lots of
systems.

This is the first I've heard of sudo to root from root giving different
behavior than being root.

Can you share some more details about your SELinux policy configuration?


On Fri, Apr 4, 2014 at 9:02 AM, Dustin C. Hatch admiraln...@gmail.comwrote:

 In my environment, when a VM is first provisioned, it has no users
 other than root, and root has no password. The machines are pre-seeded
 with an authorized SSH key so I can log in as root remotely to finish
 the set up. These machines have SELinux enforcing the strict policy,
 so even logging in as root is insufficient to make any changes, I have
 to use sudo to get to the sysadm_r role. Unfortunately, it seems that
 Ansible thinks it is smarter than I am, and refuses to run my modules
 in sudo if the remote user is root, so everything fails with
 permission denied errors.

 Is there a way I can force or trick Ansible into running my plays
 through sudo, even when logged in as root?

 Note: one of the steps in my playbook is to set up another user that
 will be used for all subsequent Ansible runs; only the initial set up
 needs to be run as root.

 Dustin C. Hatch
 http://dustin.hatch.name/

 --
 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/CAP8b%3Ddz06Gvm--LLgpWF3sDyU%3DQQdWRepO%2B8QYQnui1okhMz6A%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/CAEVJ8QOYGqjgCvpLz26H%2BaHguvBe2%2BtePbPVEhvscz-rOwLkmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ec2_elb_lb module fails with trivial example

2014-04-04 Thread i iordanov
Hello!

I may be doing something wrong, but I tried so many different things, I 
though it should report just in case. So far, I've tried Ansible 1.5 built 
from the repository and from Debian testing, and Ansible 1.6 (build from 
today's devel branch state). Also, I've tried with python-boto 2.9.x (from 
Ubuntu Saucy), 2.25 (Debian testing), and 2.27 (Debian unstable). The 
platform I'm running on is Debian Wheezy because I wanted everything else 
to be rock-solid.

I've tried simplifying my DNS settings to just leaving nameserver 8.8.8.8 
just in case it was a DNS issue.

Here is the absolutely trivial ec2_elb_lb configuration that fails and the 
error it fails with. This is the example almost straight out of the online 
manual. I started with a much more complicated config and eventually 
decided to trivialize it to see if the error still recurs, and indeed it 
does.

===
 name: Start load-balancers
  ec2_elb_lb:
aws_access_key: {{ ec2_access_key }}
aws_secret_key: {{ ec2_secret_key }}
name: test-please-delete
state: present
zones:
  - us-east-1a
  - us-east-1d
listeners:
  - protocol: http # options are http, https, ssl, tcp
load_balancer_port: 80
instance_port: 80
===

When ansible gets to this task, it hangs for a while and then reports the 
following error. Since the error occurs in python-httplib2, I tried 
updating it from 0.7 (Debian wheezy) to 0.8 (Debian testing), but that 
didn't help either:

TASK: [Start load-balancers] 
** 
failed: [localhost] = {failed: true, parsed: false}
invalid output was: Traceback (most recent call last):
  File 
/root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb, 
line 1880, in module
main()
  File 
/root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb, 
line 503, in main
aws_secret_key, region=region)
  File 
/root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb, 
line 210, in __init__
self.elb = self._get_elb()
  File 
/root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb, 
line 266, in _get_elb
elbs = self.elb_conn.get_all_load_balancers()
  File /usr/lib/python2.7/dist-packages/boto/ec2/elb/__init__.py, line 
124, in get_all_load_balancers
[('member', LoadBalancer)])
  File /usr/lib/python2.7/dist-packages/boto/connection.py, line 1143, in 
get_list
response = self.make_request(action, params, path, verb)
  File /usr/lib/python2.7/dist-packages/boto/connection.py, line 1089, in 
make_request
return self._mexe(http_request)
  File /usr/lib/python2.7/dist-packages/boto/connection.py, line 922, in 
_mexe
request.body, request.headers)
  File /usr/lib/python2.7/httplib.py, line 962, in request
self._send_request(method, url, body, headers)
  File /usr/lib/python2.7/httplib.py, line 996, in _send_request
self.endheaders(body)
  File /usr/lib/python2.7/httplib.py, line 958, in endheaders
self._send_output(message_body)
  File /usr/lib/python2.7/httplib.py, line 818, in _send_output
self.send(msg)
  File /usr/lib/python2.7/httplib.py, line 780, in send
self.connect()
  File /usr/lib/python2.7/dist-packages/boto/https_connection.py, line 
111, in connect
sock.connect((self.host, self.port))
  File /usr/lib/python2.7/socket.py, line 224, in meth
return getattr(self._sock,name)(*args)
socket.gaierror: [Errno -2] Name or service not known


FATAL: all hosts have already failed -- aborting

PLAY RECAP 
 

Many Thanks!
iordan

-- 
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/476a6c16-fec2-42b0-970c-f3e3754c2d2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variables in defaults/main.yml of a role are accessible from other roles. What if we have same {{ VAR }} names in several roles? Just wanted to check if this case is intended.

2014-04-04 Thread Marko_Lisica
Thing is that I wanted to point out if I tag my roles, and run a play, is
it intended to inherit vars from a role that is not in that particular play
although it exists in playbook, but it is excluded in particular run
because of tags.


On Fri, Apr 4, 2014 at 5:10 PM, Michael DeHaan mich...@ansible.com wrote:

 Defaults load into inventory scope.

 What I said applies to things in vars/


 On Fri, Apr 4, 2014 at 3:11 AM, Marko_Lisica titelskib...@gmail.comwrote:

 Hi,

 That is 100% clear. But in this case one role does not have its own
 defaults and inherits defaults from the last role in a list regardles if
 that role is played or not.


 On Fri, Apr 4, 2014 at 12:16 AM, Michael DeHaan mich...@ansible.comwrote:

 It's entirely intended.  For instance, you might have a role that
 applies a particular configuration to machines that live in a particular
 datacenter, and one of the things that sets might be the port to use for
 the database
 server.  That port variable would then be available to other roles.

 While this sounds scary at first, Ansible contains safeguards to make
 sure the variables used in one role are absolutely used there and not
 clobbered by another.  Thus they have guaranteed scope to that role.

 As such, if you define a variable port in two places, each role is
 guaranteed to be able to read the local value.


 On Thu, Apr 3, 2014 at 10:09 AM, Marko Lisica titelskib...@gmail.comwrote:

 Hi,

 I stumbled onto little mind game with ansible today : D .

 I have three roles that are tagged.

 - hosts: vagrant
   sudo: yes
   roles:
 - {role: ansible_users, tags: users}
 - {role: ansible_nginx, tags: nginx}
 - {role: ansible_mysql, tags: mysql}


 I have defaults/main.yml for ansible_users and ansible_mysql in
 their respective places.

 This is ansible_users defaults:

 ---
 users:
   - user: detlic
 webdir:
   - woodpecker
   - aligator
   - user: keder
 webdir: []


 This is ansible_mysql defaults:

 ---
 users:
   - user: detlic
 db:
   - aligatordb
   - woodpeckerdb
   - user: jazavac
 db:
   - badgerdb
   - ddaybdb


 I have left NGINX role without defaults. How I understand things is
 that NGINX will inherit defaults vars from other roles and use them where
 it can. But in this case {{ VARS }} are named the same in both USER and
 MYSQL roles.

 NGINX role is before MYSQL from whoom it should inherit vars? In my
 test case it inherits it from the LAST role in the list. So in this case it
 is MYSQL. If I remove MYSQL role from a list then everything is fine.

 Another thing is if I leave MYSQL role present BUT use TAGS and play
 roles with jsut USERS and NGINX tags, still NGINX inherits defaults from
 MYSQL.

 Can someone comment on this.

 --
 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/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/y_Gucqc_3sE/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/CAEVJ8QPg4RQo6Ae-K0pLUAkyA6J2W7R53-nxGNmZPR%3DGKKM7iA%40mail.gmail.comhttps://groups.google.com/d/msgid/ansible-project/CAEVJ8QPg4RQo6Ae-K0pLUAkyA6J2W7R53-nxGNmZPR%3DGKKM7iA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 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/CABqYKhB9bpMmDOz7QDhCscrsY%3DWAdvpAor65pBtRpXh5GToqPQ%40mail.gmail.comhttps://groups.google.com/d/msgid/ansible-project/CABqYKhB9bpMmDOz7QDhCscrsY%3DWAdvpAor65pBtRpXh5GToqPQ%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.


  --
 You received this message because you are subscribed to a topic in the
 

Re: [ansible-project] Running python command on when statement

2014-04-04 Thread Michael DeHaan
I should point out that trying to code in playbooks is usually the sign
that you're trying too hard to do something.

It should almost always be thought of as what is the easier way?

If syntax looks offensive, it is a sign simplification is needed -- that's
the Ansible way, basically.

A simple shell call to check if the particular directory is in the output
of mount would be cleaner.

- shell: blarg
  register: result

- shell: baz
  when: foo in result.stdout

OR

- shell: baz
  when: foo.rc != 2

ETC

would be preferable.

Alternatively, you could also write a custom facts module that returned the
mounts

- action: my_mount_facts
- shell: baz
  when: 'foo' in mounts

etc

Things like that.




On Fri, Apr 4, 2014 at 9:02 AM, douglaslopespere...@gmail.com wrote:

 Hi Matt,

 That is a great suggestion! I will give it a try.

 I overcame this by using this task:

 - name: check mount point
   shell: mount | sed -n -e '/\/var\/lib\/myMount.*/p'
   register: result

 and after that using the result variable on the when statement:

 when: result.stdout==

 It looks like your solution is more straightforward.

 Thank you.
 Regards,
 Douglas


 On Friday, April 4, 2014 9:16:19 AM UTC-3, Matt Martz wrote:

 Douglas,

 You won't be able to use pure python in a when statement, you will have
 to handle it using jinja2.

 I see 2 options for you:

 1) Use a combination of several jinja2 filters to get you what you want
 such as:

 when: 
 ansible_mounts|map(attribute='mount')|intersect(['/var/lib/myMount'])|length
 == 0

 2) Create your own custom jinja2 filter to do this.

 --
 Matt Martz
 ma...@sivel.net

 On April 3, 2014 at 10:27:23 PM, douglaslo...@gmail.com (
 douglaslo...@gmail.com) wrote:

 Hi all,

 I was trying to update ansible from 1.2 to 1.5 and noticed that I can no
 longer use only_if which has been replaced by when.

 But when I try to run a shell task with this condition:

 when: len(filter(lambda m: m['mount'] == '/var/lib/myMount',
 '{{ansible_mounts}}')) == 0

 I get the following error:

 error while evaluating conditional: len(filter(lambda m: m['mount'] ==
 '/var/lib/myMount', '[{u'size_total': 8455118848, u'mount': u'/',
 u'size_available': 6891151360, u'fstype': u'ext4', u'device':
 u'/dev/xvda1', u'options': u'rw'}, {u'size_total': 16122802176,
 u'mount': u'/mnt', u'size_available': 15129432064, u'fstype': u'ext3',
 u'device': u'/dev/xvdb', u'options': u'rw,_netdev'}, {u'size_total':
 107321753600, u'mount': u'/var/lib/myMount', u'size_available':
 107250851840, u'fstype': u'xfs', u'device': u'/dev/xvdf', u'options':
 u'rw,noatime'}]')) == 0

 The ansible_mounts variable is being correctly returned as you can see in
 the error message.

 I've tryed different combinations of positioning the quote marks but no
 luck.

 Any help?

 Regards,
 Douglas
 --
 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/112db0a1-c88e-4bc5-a896-
 a9f738909391%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/112db0a1-c88e-4bc5-a896-a9f738909391%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


 On Friday, April 4, 2014 9:16:19 AM UTC-3, Matt Martz wrote:

 Douglas,

 You won't be able to use pure python in a when statement, you will have
 to handle it using jinja2.

 I see 2 options for you:

 1) Use a combination of several jinja2 filters to get you what you want
 such as:

 when: 
 ansible_mounts|map(attribute='mount')|intersect(['/var/lib/myMount'])|length
 == 0

 2) Create your own custom jinja2 filter to do this.

 --
 Matt Martz
 ma...@sivel.net

 On April 3, 2014 at 10:27:23 PM, douglaslo...@gmail.com (
 douglaslo...@gmail.com) wrote:

 Hi all,

 I was trying to update ansible from 1.2 to 1.5 and noticed that I can no
 longer use only_if which has been replaced by when.

 But when I try to run a shell task with this condition:

 when: len(filter(lambda m: m['mount'] == '/var/lib/myMount',
 '{{ansible_mounts}}')) == 0

 I get the following error:

 error while evaluating conditional: len(filter(lambda m: m['mount'] ==
 '/var/lib/myMount', '[{u'size_total': 8455118848, u'mount': u'/',
 u'size_available': 6891151360, u'fstype': u'ext4', u'device':
 u'/dev/xvda1', u'options': u'rw'}, {u'size_total': 16122802176,
 u'mount': u'/mnt', u'size_available': 15129432064, u'fstype': u'ext3',
 u'device': u'/dev/xvdb', u'options': u'rw,_netdev'}, {u'size_total':
 107321753600, u'mount': u'/var/lib/myMount', u'size_available':
 107250851840, u'fstype': u'xfs', u'device': u'/dev/xvdf', u'options':
 u'rw,noatime'}]')) == 0

 The ansible_mounts variable is being correctly returned as you can see in
 the error 

Re: [ansible-project] Variables in defaults/main.yml of a role are accessible from other roles. What if we have same {{ VAR }} names in several roles? Just wanted to check if this case is intended.

2014-04-04 Thread Michael DeHaan
Yes.

Tags apply only to the tasks therein, not the variables themselves.


On Fri, Apr 4, 2014 at 11:18 AM, Marko_Lisica titelskib...@gmail.comwrote:

 Thing is that I wanted to point out if I tag my roles, and run a play, is
 it intended to inherit vars from a role that is not in that particular play
 although it exists in playbook, but it is excluded in particular run
 because of tags.


 On Fri, Apr 4, 2014 at 5:10 PM, Michael DeHaan mich...@ansible.comwrote:

 Defaults load into inventory scope.

 What I said applies to things in vars/


 On Fri, Apr 4, 2014 at 3:11 AM, Marko_Lisica titelskib...@gmail.comwrote:

 Hi,

 That is 100% clear. But in this case one role does not have its own
 defaults and inherits defaults from the last role in a list regardles if
 that role is played or not.


 On Fri, Apr 4, 2014 at 12:16 AM, Michael DeHaan mich...@ansible.comwrote:

 It's entirely intended.  For instance, you might have a role that
 applies a particular configuration to machines that live in a particular
 datacenter, and one of the things that sets might be the port to use for
 the database
 server.  That port variable would then be available to other roles.

 While this sounds scary at first, Ansible contains safeguards to make
 sure the variables used in one role are absolutely used there and not
 clobbered by another.  Thus they have guaranteed scope to that role.

 As such, if you define a variable port in two places, each role is
 guaranteed to be able to read the local value.


 On Thu, Apr 3, 2014 at 10:09 AM, Marko Lisica 
 titelskib...@gmail.comwrote:

 Hi,

 I stumbled onto little mind game with ansible today : D .

 I have three roles that are tagged.

 - hosts: vagrant
   sudo: yes
   roles:
 - {role: ansible_users, tags: users}
 - {role: ansible_nginx, tags: nginx}
 - {role: ansible_mysql, tags: mysql}


 I have defaults/main.yml for ansible_users and ansible_mysql in
 their respective places.

 This is ansible_users defaults:

 ---
 users:
   - user: detlic
 webdir:
   - woodpecker
   - aligator
   - user: keder
 webdir: []


 This is ansible_mysql defaults:

 ---
 users:
   - user: detlic
 db:
   - aligatordb
   - woodpeckerdb
   - user: jazavac
 db:
   - badgerdb
   - ddaybdb


 I have left NGINX role without defaults. How I understand things is
 that NGINX will inherit defaults vars from other roles and use them 
 where
 it can. But in this case {{ VARS }} are named the same in both USER and
 MYSQL roles.

 NGINX role is before MYSQL from whoom it should inherit vars? In my
 test case it inherits it from the LAST role in the list. So in this case 
 it
 is MYSQL. If I remove MYSQL role from a list then everything is fine.

 Another thing is if I leave MYSQL role present BUT use TAGS and play
 roles with jsut USERS and NGINX tags, still NGINX inherits defaults from
 MYSQL.

 Can someone comment on this.

 --
 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/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/y_Gucqc_3sE/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/CAEVJ8QPg4RQo6Ae-K0pLUAkyA6J2W7R53-nxGNmZPR%3DGKKM7iA%40mail.gmail.comhttps://groups.google.com/d/msgid/ansible-project/CAEVJ8QPg4RQo6Ae-K0pLUAkyA6J2W7R53-nxGNmZPR%3DGKKM7iA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 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
 

Re: [ansible-project] Ansible 1.5.4 breaks variables in vars_files

2014-04-04 Thread Michael DeHaan
It's not variables, rather, just facts.

But yes, fixed on the development branch.

We do not plan for a 1.5.4 update release at this time seeing 1.6 is due
for towards the end of the month.   This *may* change, but I'm thinking
probably it will not, since there's a workaround posted in the ticket link
above.






On Fri, Apr 4, 2014 at 9:34 AM, James Cammarata jcammar...@ansible.comwrote:

 This issue was reported the other day and has been fixed in the devel
 branch:

 https://github.com/ansible/ansible/issues/6832

 You can grab that patch for now if you'd like (
 https://github.com/ansible/ansible/commit/9c6dd9f79c6fbed3346b951fc280f30cb6d676ae),
 which will be included in the next release.



 On Fri, Apr 4, 2014 at 3:43 AM, Mark Nottingham m...@mnot.net wrote:

 I have a playbook with the following:

   vars_files:
 - vars/{{ ansible_pkg_mgr }}.yml

 ... that works fine in 1.5.3, but 1.5.4 doesn't appear to be able to find
 it; when one of the variables that should have been imported is referenced,
 it throws a 'foo is undefined' error.

 I can provide a minimal reproduction if it'd be helpful.

 --
 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/72edbc94-1dab-4b83-a41e-f141b5d51cb4%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/72edbc94-1dab-4b83-a41e-f141b5d51cb4%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/CAFg%2Bn8SR3_%3D6qxV_fKuN9TiNp_LfWXW3HTnd3NfB1P3xCGrXBw%40mail.gmail.comhttps://groups.google.com/d/msgid/ansible-project/CAFg%2Bn8SR3_%3D6qxV_fKuN9TiNp_LfWXW3HTnd3NfB1P3xCGrXBw%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 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/CAEVJ8QNThpoPV%3Dj%2BWARBkH1ZEYxuGwAj0jF92f8V-FqozxNBYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] variable isn't expanded correctly?

2014-04-04 Thread Dario Bertini
On Fri, Apr 4, 2014 at 5:13 PM, Michael DeHaan mich...@ansible.com wrote:

 (B) This variable really ought to be templated at an earlier level anyway.


Agree, is there something I could to do force the templating early, or
is it something that can be done only inside ansible itself?

-- 
xmpp: berda...@gmail.com
bitmessage: BM-2cTYXfGiSTsnx3righ6aHcJSWe4MV17jDP
gpg fingerprint: 3F8D53518012716C4EEF7DF67B498306B3BF75A0 (used just
for signing commits)

-- 
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/CAFdyfB2MfJkZ9G0%3D0y7t1ZCj_ZPsPRUunX2%2B5OnbT2cB0ZY8%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] variable isn't expanded correctly?

2014-04-04 Thread Michael DeHaan
Not without modifying the source to fix the root cause of the problem.




On Fri, Apr 4, 2014 at 11:23 AM, Dario Bertini berda...@gmail.com wrote:

 On Fri, Apr 4, 2014 at 5:13 PM, Michael DeHaan mich...@ansible.com
 wrote:
 
  (B) This variable really ought to be templated at an earlier level
 anyway.
 

 Agree, is there something I could to do force the templating early, or
 is it something that can be done only inside ansible itself?

 --
 xmpp: berda...@gmail.com
 bitmessage: BM-2cTYXfGiSTsnx3righ6aHcJSWe4MV17jDP
 gpg fingerprint: 3F8D53518012716C4EEF7DF67B498306B3BF75A0 (used just
 for signing commits)

 --
 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/CAFdyfB2MfJkZ9G0%3D0y7t1ZCj_ZPsPRUunX2%2B5OnbT2cB0ZY8%3Dw%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/CAEVJ8QMe6EZUnEf5BwrX%2BDA8LKPnF%2B-4pp4%3D0QeuRX898C%2BiDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] variable isn't expanded correctly?

2014-04-04 Thread Michael DeHaan
BTW, please make sure there's a ticket filed for this.

Thanks!


On Fri, Apr 4, 2014 at 11:24 AM, Michael DeHaan mich...@ansible.com wrote:

 Not without modifying the source to fix the root cause of the problem.




 On Fri, Apr 4, 2014 at 11:23 AM, Dario Bertini berda...@gmail.com wrote:

 On Fri, Apr 4, 2014 at 5:13 PM, Michael DeHaan mich...@ansible.com
 wrote:
 
  (B) This variable really ought to be templated at an earlier level
 anyway.
 

 Agree, is there something I could to do force the templating early, or
 is it something that can be done only inside ansible itself?

 --
 xmpp: berda...@gmail.com
 bitmessage: BM-2cTYXfGiSTsnx3righ6aHcJSWe4MV17jDP
 gpg fingerprint: 3F8D53518012716C4EEF7DF67B498306B3BF75A0 (used just
 for signing commits)

 --
 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/CAFdyfB2MfJkZ9G0%3D0y7t1ZCj_ZPsPRUunX2%2B5OnbT2cB0ZY8%3Dw%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/CAEVJ8QM9DqVDEkLvb%2BkmLAS43rwOj7SaacU%2BCtakFN_0aipvmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Another way to set the mysql root password

2014-04-04 Thread James Martin
In case you weren't aware, there is a pretty full featured mysql role on 
Ansible Galaxy.  That may give you some hints.

https://galaxy.ansible.com/list#/roles/1

- James

On Tuesday, April 1, 2014 11:49:36 AM UTC-4, Patrick Ogenstad wrote:

 I've just gotten started with Ansible. I must say it's ridiculously 
 simple. :)

 I've created a few playbooks and was setting up mysql. The module 
 documentation mentions editing ~/.my.cnf and some links on the net 
 recommend using the file in order to create a idempotent mysql playbook.

 However I didn't want to write the password in a textfile.

 Instead as a workaround I created two tasks in the playbook:

 # This task will fail the first time when the password
 # is blank
 - name: Ensure MySQL Root Password is changed, this task will fail the 
 first time
   mysql_user: name=root password={{ mysqlrootpass }} login_user=root 
 login_password={{ mysqlrootpass }} state=present
   register: mysqlwithpassword
   ignore_errors: True

 - name: Set MySQL root password
   mysql_user: name=root password={{ mysqlrootpass }} login_user=root 
 login_password='' state=present
   when: mysqlwithpassword|failed

 The first task will always fail on the first run and when it fail the 
 second task will run. Running the Playbook a second time won't change the 
 system making the playbook idempotent.

 Would this be considered bad form in a Ansible sort of way? :) Do you see 
 any downside to solving the problem in this way?



-- 
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/2636b30c-1867-4e3f-88bc-944a7d7ad91b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running remote playbooks within a play

2014-04-04 Thread Erik Anderson
On Thu, Apr 3, 2014 at 5:10 PM, Michael DeHaan mich...@ansible.com wrote:

 Yeah I'm not seeing where you need this yet.

 Depends on the scale of your infrastructure, but plenty of very very large
 setups are not doing this -- and really, if you are in that area, treating
 cloud like cloud and using Ansible to build images is often a great option.


Just to provide another perspective, we have a use case for running remote
playbooks, and are doing this this via the shell module.

We really have two Ansible use cases - one is using Ansible in a
traditional sense for provisioning servers, building images, etc. Our
second use case is, I guess, a bit nonstandard. That being the
configuration of on-premise server appliances installed in our customer's
datacenters. We let customers provide configuration information - this gets
saved to a local facts file, which is then used by a local playbook to
apply the configuration. Sometimes this playbook is executed in a
standalone fashion, independent of our centralized provisioning system,
but sometimes it is executed remotely via another centralized playbook.

-Erik

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


Re: [ansible-project] ec2_elb_lb module fails with trivial example

2014-04-04 Thread i iordanov
Hi Michael,

I just built Ansible from the latest devel branch and I'm still seeing
the same error. I don't quite understand whether I need to patch the
devel branch with anything before testing.

If not, I've already tested with the latest devel branch and this is a new bug.

Thanks!
iordan

On Fri, Apr 4, 2014 at 11:20 AM, Michael DeHaan mich...@ansible.com wrote:
 There have been some tickets open about ec2_elb recently:

 Please review the following and see if your issues are addressed by the
 latest on the development branch:

 https://github.com/ansible/ansible/search?q=ec2_elbref=cmdformtype=Issues

 If not and you are still seeing issues on the development branch, please
 open a new ticket.



 On Fri, Apr 4, 2014 at 11:17 AM, i iordanov iiorda...@gmail.com wrote:

 Hello!

 I may be doing something wrong, but I tried so many different things, I
 though it should report just in case. So far, I've tried Ansible 1.5 built
 from the repository and from Debian testing, and Ansible 1.6 (build from
 today's devel branch state). Also, I've tried with python-boto 2.9.x (from
 Ubuntu Saucy), 2.25 (Debian testing), and 2.27 (Debian unstable). The
 platform I'm running on is Debian Wheezy because I wanted everything else to
 be rock-solid.

 I've tried simplifying my DNS settings to just leaving nameserver
 8.8.8.8 just in case it was a DNS issue.

 Here is the absolutely trivial ec2_elb_lb configuration that fails and the
 error it fails with. This is the example almost straight out of the online
 manual. I started with a much more complicated config and eventually decided
 to trivialize it to see if the error still recurs, and indeed it does.

 ===
  name: Start load-balancers
   ec2_elb_lb:
 aws_access_key: {{ ec2_access_key }}
 aws_secret_key: {{ ec2_secret_key }}
 name: test-please-delete
 state: present
 zones:
   - us-east-1a
   - us-east-1d
 listeners:
   - protocol: http # options are http, https, ssl, tcp
 load_balancer_port: 80
 instance_port: 80
 ===

 When ansible gets to this task, it hangs for a while and then reports the
 following error. Since the error occurs in python-httplib2, I tried updating
 it from 0.7 (Debian wheezy) to 0.8 (Debian testing), but that didn't help
 either:

 TASK: [Start load-balancers]
 **
 failed: [localhost] = {failed: true, parsed: false}
 invalid output was: Traceback (most recent call last):
   File
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
 line 1880, in module
 main()
   File
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
 line 503, in main
 aws_secret_key, region=region)
   File
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
 line 210, in __init__
 self.elb = self._get_elb()
   File
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
 line 266, in _get_elb
 elbs = self.elb_conn.get_all_load_balancers()
   File /usr/lib/python2.7/dist-packages/boto/ec2/elb/__init__.py, line
 124, in get_all_load_balancers
 [('member', LoadBalancer)])
   File /usr/lib/python2.7/dist-packages/boto/connection.py, line 1143,
 in get_list
 response = self.make_request(action, params, path, verb)
   File /usr/lib/python2.7/dist-packages/boto/connection.py, line 1089,
 in make_request
 return self._mexe(http_request)
   File /usr/lib/python2.7/dist-packages/boto/connection.py, line 922, in
 _mexe
 request.body, request.headers)
   File /usr/lib/python2.7/httplib.py, line 962, in request
 self._send_request(method, url, body, headers)
   File /usr/lib/python2.7/httplib.py, line 996, in _send_request
 self.endheaders(body)
   File /usr/lib/python2.7/httplib.py, line 958, in endheaders
 self._send_output(message_body)
   File /usr/lib/python2.7/httplib.py, line 818, in _send_output
 self.send(msg)
   File /usr/lib/python2.7/httplib.py, line 780, in send
 self.connect()
   File /usr/lib/python2.7/dist-packages/boto/https_connection.py, line
 111, in connect
 sock.connect((self.host, self.port))
   File /usr/lib/python2.7/socket.py, line 224, in meth
 return getattr(self._sock,name)(*args)
 socket.gaierror: [Errno -2] Name or service not known


 FATAL: all hosts have already failed -- aborting

 PLAY RECAP
 

 Many Thanks!
 iordan

 --
 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
 

Re: [ansible-project] ec2_elb_lb module fails with trivial example

2014-04-04 Thread benno joy
Can you try passing region: foo as a parameter and see if that helps.




On Fri, Apr 4, 2014 at 8:57 PM, i iordanov iiorda...@gmail.com wrote:

 Hi Michael,

 I just built Ansible from the latest devel branch and I'm still seeing
 the same error. I don't quite understand whether I need to patch the
 devel branch with anything before testing.

 If not, I've already tested with the latest devel branch and this is a new
 bug.

 Thanks!
 iordan

 On Fri, Apr 4, 2014 at 11:20 AM, Michael DeHaan mich...@ansible.com
 wrote:
  There have been some tickets open about ec2_elb recently:
 
  Please review the following and see if your issues are addressed by the
  latest on the development branch:
 
 
 https://github.com/ansible/ansible/search?q=ec2_elbref=cmdformtype=Issues
 
  If not and you are still seeing issues on the development branch, please
  open a new ticket.
 
 
 
  On Fri, Apr 4, 2014 at 11:17 AM, i iordanov iiorda...@gmail.com wrote:
 
  Hello!
 
  I may be doing something wrong, but I tried so many different things, I
  though it should report just in case. So far, I've tried Ansible 1.5
 built
  from the repository and from Debian testing, and Ansible 1.6 (build from
  today's devel branch state). Also, I've tried with python-boto 2.9.x
 (from
  Ubuntu Saucy), 2.25 (Debian testing), and 2.27 (Debian unstable). The
  platform I'm running on is Debian Wheezy because I wanted everything
 else to
  be rock-solid.
 
  I've tried simplifying my DNS settings to just leaving nameserver
  8.8.8.8 just in case it was a DNS issue.
 
  Here is the absolutely trivial ec2_elb_lb configuration that fails and
 the
  error it fails with. This is the example almost straight out of the
 online
  manual. I started with a much more complicated config and eventually
 decided
  to trivialize it to see if the error still recurs, and indeed it does.
 
  ===
   name: Start load-balancers
ec2_elb_lb:
  aws_access_key: {{ ec2_access_key }}
  aws_secret_key: {{ ec2_secret_key }}
  name: test-please-delete
  state: present
  zones:
- us-east-1a
- us-east-1d
  listeners:
- protocol: http # options are http, https, ssl, tcp
  load_balancer_port: 80
  instance_port: 80
  ===
 
  When ansible gets to this task, it hangs for a while and then reports
 the
  following error. Since the error occurs in python-httplib2, I tried
 updating
  it from 0.7 (Debian wheezy) to 0.8 (Debian testing), but that didn't
 help
  either:
 
  TASK: [Start load-balancers]
  **
  failed: [localhost] = {failed: true, parsed: false}
  invalid output was: Traceback (most recent call last):
File
 
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
  line 1880, in module
  main()
File
 
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
  line 503, in main
  aws_secret_key, region=region)
File
 
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
  line 210, in __init__
  self.elb = self._get_elb()
File
 
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
  line 266, in _get_elb
  elbs = self.elb_conn.get_all_load_balancers()
File /usr/lib/python2.7/dist-packages/boto/ec2/elb/__init__.py, line
  124, in get_all_load_balancers
  [('member', LoadBalancer)])
File /usr/lib/python2.7/dist-packages/boto/connection.py, line 1143,
  in get_list
  response = self.make_request(action, params, path, verb)
File /usr/lib/python2.7/dist-packages/boto/connection.py, line 1089,
  in make_request
  return self._mexe(http_request)
File /usr/lib/python2.7/dist-packages/boto/connection.py, line 922,
 in
  _mexe
  request.body, request.headers)
File /usr/lib/python2.7/httplib.py, line 962, in request
  self._send_request(method, url, body, headers)
File /usr/lib/python2.7/httplib.py, line 996, in _send_request
  self.endheaders(body)
File /usr/lib/python2.7/httplib.py, line 958, in endheaders
  self._send_output(message_body)
File /usr/lib/python2.7/httplib.py, line 818, in _send_output
  self.send(msg)
File /usr/lib/python2.7/httplib.py, line 780, in send
  self.connect()
File /usr/lib/python2.7/dist-packages/boto/https_connection.py, line
  111, in connect
  sock.connect((self.host, self.port))
File /usr/lib/python2.7/socket.py, line 224, in meth
  return getattr(self._sock,name)(*args)
  socket.gaierror: [Errno -2] Name or service not known
 
 
  FATAL: all hosts have already failed -- aborting
 
  PLAY RECAP
  
 
  Many Thanks!
  iordan
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Ansible Project group.
  To 

[ansible-project] FATAL: all hosts have already failed -- aborting

2014-04-04 Thread Marc Petrivelli
I am getting

*FATAL: all hosts have already failed -- aborting *

even though none of the hosts are showing any errors.   This problem 
starting creeping up in the 1.5.x releases. Any ideas?

-- 
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/e171e42f-d802-444e-a74c-79ad02d93a5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variables in defaults/main.yml of a role are accessible from other roles. What if we have same {{ VAR }} names in several roles? Just wanted to check if this case is intended.

2014-04-04 Thread Marko_Lisica
Hello,

I guess I havent described good enough. variables get inherited from other
roles if they are stored in defaults.
And if I run playbook with tags, I dont want variables to be inherited from
the role that is not called with tags in the particular play.

Is that current behaviour? Or vars are inherited from every role in a play
regarding if they are actually called with a tag in specific play or not.


On Fri, Apr 4, 2014 at 5:21 PM, Michael DeHaan mich...@ansible.com wrote:

 Yes.

 Tags apply only to the tasks therein, not the variables themselves.


 On Fri, Apr 4, 2014 at 11:18 AM, Marko_Lisica titelskib...@gmail.comwrote:

 Thing is that I wanted to point out if I tag my roles, and run a play, is
 it intended to inherit vars from a role that is not in that particular play
 although it exists in playbook, but it is excluded in particular run
 because of tags.


 On Fri, Apr 4, 2014 at 5:10 PM, Michael DeHaan mich...@ansible.comwrote:

 Defaults load into inventory scope.

 What I said applies to things in vars/


 On Fri, Apr 4, 2014 at 3:11 AM, Marko_Lisica titelskib...@gmail.comwrote:

 Hi,

 That is 100% clear. But in this case one role does not have its own
 defaults and inherits defaults from the last role in a list regardles if
 that role is played or not.


 On Fri, Apr 4, 2014 at 12:16 AM, Michael DeHaan mich...@ansible.comwrote:

 It's entirely intended.  For instance, you might have a role that
 applies a particular configuration to machines that live in a particular
 datacenter, and one of the things that sets might be the port to use for
 the database
 server.  That port variable would then be available to other roles.

 While this sounds scary at first, Ansible contains safeguards to make
 sure the variables used in one role are absolutely used there and not
 clobbered by another.  Thus they have guaranteed scope to that role.

 As such, if you define a variable port in two places, each role is
 guaranteed to be able to read the local value.


 On Thu, Apr 3, 2014 at 10:09 AM, Marko Lisica 
 titelskib...@gmail.comwrote:

 Hi,

 I stumbled onto little mind game with ansible today : D .

 I have three roles that are tagged.

 - hosts: vagrant
   sudo: yes
   roles:
 - {role: ansible_users, tags: users}
 - {role: ansible_nginx, tags: nginx}
 - {role: ansible_mysql, tags: mysql}


 I have defaults/main.yml for ansible_users and ansible_mysql in
 their respective places.

 This is ansible_users defaults:

 ---
 users:
   - user: detlic
 webdir:
   - woodpecker
   - aligator
   - user: keder
 webdir: []


 This is ansible_mysql defaults:

 ---
 users:
   - user: detlic
 db:
   - aligatordb
   - woodpeckerdb
   - user: jazavac
 db:
   - badgerdb
   - ddaybdb


 I have left NGINX role without defaults. How I understand things is
 that NGINX will inherit defaults vars from other roles and use them 
 where
 it can. But in this case {{ VARS }} are named the same in both USER and
 MYSQL roles.

 NGINX role is before MYSQL from whoom it should inherit vars? In my
 test case it inherits it from the LAST role in the list. So in this case 
 it
 is MYSQL. If I remove MYSQL role from a list then everything is fine.

 Another thing is if I leave MYSQL role present BUT use TAGS and play
 roles with jsut USERS and NGINX tags, still NGINX inherits defaults 
 from
 MYSQL.

 Can someone comment on this.

 --
 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/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/y_Gucqc_3sE/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/CAEVJ8QPg4RQo6Ae-K0pLUAkyA6J2W7R53-nxGNmZPR%3DGKKM7iA%40mail.gmail.comhttps://groups.google.com/d/msgid/ansible-project/CAEVJ8QPg4RQo6Ae-K0pLUAkyA6J2W7R53-nxGNmZPR%3DGKKM7iA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 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 

Re: [ansible-project] file module: absent recurse=yes and Directory not empty

2014-04-04 Thread Matt Martz
I will mention that we use 'file' to recursively delete a directory, but it 
does require 'force=yes'
-- 
Matt Martz
m...@sivel.net

On April 4, 2014 at 8:48:36 AM, Maxim Odinintsev (gwynn@gmail.com) wrote:

Hello,

When I'm run this job, but on some hosts return output:
rmtree failed: [Errno 39] Directory not empty: 
'/home/master/www/static.master/images/posters'

Sure this directories is not empty, and I'm want remove it recursive. But why i 
can't do this with file module ?

- name: Cleaner
  hosts: all
  sudo: yes

  tasks:
    - name: get cache dirs
      shell: ls -1 /var/lib/nginx/cache/
      register: cache

    - name: Remove cache
      file: name=/var/lib/nginx/cache/{{ item }} state=absent recurse=yes
      with_items: cache.stdout_lines

    - name: get static dirs
      shell: ls -1 /home/master/www/static.master/
      register: static

    - name: Clean static
      file: name=/home/master/www/static.master/{{ item }} state=absent 
recurse=yes
      with_items: static.stdout_lines


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/468b6757-2798-4003-ab2a-d9e5e85b6cd4%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/etPan.533eddee.6b8b4567.f4e6%40mobiletuvix.rackspace.corp.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ec2_elb_lb module fails with trivial example

2014-04-04 Thread i iordanov
Hi Benno,

Thanks, that did help. Now I get further. So this is a documentation issue.

Now I am suffering from a lack of a feature which is a different
issue. With the current code, I am unable to place the ELB into a VPC
which is necessary for my use-case.

Cheers!
iordan

On Fri, Apr 4, 2014 at 11:44 AM, benno joy benno...@gmail.com wrote:

 Can you try passing region: foo as a parameter and see if that helps.




 On Fri, Apr 4, 2014 at 8:57 PM, i iordanov iiorda...@gmail.com wrote:

 Hi Michael,

 I just built Ansible from the latest devel branch and I'm still seeing
 the same error. I don't quite understand whether I need to patch the
 devel branch with anything before testing.

 If not, I've already tested with the latest devel branch and this is a new
 bug.

 Thanks!
 iordan

 On Fri, Apr 4, 2014 at 11:20 AM, Michael DeHaan mich...@ansible.com
 wrote:
  There have been some tickets open about ec2_elb recently:
 
  Please review the following and see if your issues are addressed by the
  latest on the development branch:
 
 
  https://github.com/ansible/ansible/search?q=ec2_elbref=cmdformtype=Issues
 
  If not and you are still seeing issues on the development branch, please
  open a new ticket.
 
 
 
  On Fri, Apr 4, 2014 at 11:17 AM, i iordanov iiorda...@gmail.com wrote:
 
  Hello!
 
  I may be doing something wrong, but I tried so many different things, I
  though it should report just in case. So far, I've tried Ansible 1.5
  built
  from the repository and from Debian testing, and Ansible 1.6 (build
  from
  today's devel branch state). Also, I've tried with python-boto 2.9.x
  (from
  Ubuntu Saucy), 2.25 (Debian testing), and 2.27 (Debian unstable). The
  platform I'm running on is Debian Wheezy because I wanted everything
  else to
  be rock-solid.
 
  I've tried simplifying my DNS settings to just leaving nameserver
  8.8.8.8 just in case it was a DNS issue.
 
  Here is the absolutely trivial ec2_elb_lb configuration that fails and
  the
  error it fails with. This is the example almost straight out of the
  online
  manual. I started with a much more complicated config and eventually
  decided
  to trivialize it to see if the error still recurs, and indeed it does.
 
  ===
   name: Start load-balancers
ec2_elb_lb:
  aws_access_key: {{ ec2_access_key }}
  aws_secret_key: {{ ec2_secret_key }}
  name: test-please-delete
  state: present
  zones:
- us-east-1a
- us-east-1d
  listeners:
- protocol: http # options are http, https, ssl, tcp
  load_balancer_port: 80
  instance_port: 80
  ===
 
  When ansible gets to this task, it hangs for a while and then reports
  the
  following error. Since the error occurs in python-httplib2, I tried
  updating
  it from 0.7 (Debian wheezy) to 0.8 (Debian testing), but that didn't
  help
  either:
 
  TASK: [Start load-balancers]
  **
  failed: [localhost] = {failed: true, parsed: false}
  invalid output was: Traceback (most recent call last):
File
 
  /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
  line 1880, in module
  main()
File
 
  /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
  line 503, in main
  aws_secret_key, region=region)
File
 
  /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
  line 210, in __init__
  self.elb = self._get_elb()
File
 
  /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
  line 266, in _get_elb
  elbs = self.elb_conn.get_all_load_balancers()
File /usr/lib/python2.7/dist-packages/boto/ec2/elb/__init__.py,
  line
  124, in get_all_load_balancers
  [('member', LoadBalancer)])
File /usr/lib/python2.7/dist-packages/boto/connection.py, line
  1143,
  in get_list
  response = self.make_request(action, params, path, verb)
File /usr/lib/python2.7/dist-packages/boto/connection.py, line
  1089,
  in make_request
  return self._mexe(http_request)
File /usr/lib/python2.7/dist-packages/boto/connection.py, line 922,
  in
  _mexe
  request.body, request.headers)
File /usr/lib/python2.7/httplib.py, line 962, in request
  self._send_request(method, url, body, headers)
File /usr/lib/python2.7/httplib.py, line 996, in _send_request
  self.endheaders(body)
File /usr/lib/python2.7/httplib.py, line 958, in endheaders
  self._send_output(message_body)
File /usr/lib/python2.7/httplib.py, line 818, in _send_output
  self.send(msg)
File /usr/lib/python2.7/httplib.py, line 780, in send
  self.connect()
File /usr/lib/python2.7/dist-packages/boto/https_connection.py,
  line
  111, in connect
  sock.connect((self.host, self.port))
File /usr/lib/python2.7/socket.py, line 224, in meth
  

Re: [ansible-project] ec2_elb_lb module fails with trivial example

2014-04-04 Thread Michael DeHaan
We should either add the region parameter as universally required or
provide sensible defaults.

Please do file a bug on this.

Thanks!


On Fri, Apr 4, 2014 at 12:36 PM, i iordanov iiorda...@gmail.com wrote:

 Hi Benno,

 Thanks, that did help. Now I get further. So this is a documentation issue.

 Now I am suffering from a lack of a feature which is a different
 issue. With the current code, I am unable to place the ELB into a VPC
 which is necessary for my use-case.

 Cheers!
 iordan

 On Fri, Apr 4, 2014 at 11:44 AM, benno joy benno...@gmail.com wrote:
 
  Can you try passing region: foo as a parameter and see if that helps.
 
 
 
 
  On Fri, Apr 4, 2014 at 8:57 PM, i iordanov iiorda...@gmail.com wrote:
 
  Hi Michael,
 
  I just built Ansible from the latest devel branch and I'm still seeing
  the same error. I don't quite understand whether I need to patch the
  devel branch with anything before testing.
 
  If not, I've already tested with the latest devel branch and this is a
 new
  bug.
 
  Thanks!
  iordan
 
  On Fri, Apr 4, 2014 at 11:20 AM, Michael DeHaan mich...@ansible.com
  wrote:
   There have been some tickets open about ec2_elb recently:
  
   Please review the following and see if your issues are addressed by
 the
   latest on the development branch:
  
  
  
 https://github.com/ansible/ansible/search?q=ec2_elbref=cmdformtype=Issues
  
   If not and you are still seeing issues on the development branch,
 please
   open a new ticket.
  
  
  
   On Fri, Apr 4, 2014 at 11:17 AM, i iordanov iiorda...@gmail.com
 wrote:
  
   Hello!
  
   I may be doing something wrong, but I tried so many different
 things, I
   though it should report just in case. So far, I've tried Ansible 1.5
   built
   from the repository and from Debian testing, and Ansible 1.6 (build
   from
   today's devel branch state). Also, I've tried with python-boto 2.9.x
   (from
   Ubuntu Saucy), 2.25 (Debian testing), and 2.27 (Debian unstable). The
   platform I'm running on is Debian Wheezy because I wanted everything
   else to
   be rock-solid.
  
   I've tried simplifying my DNS settings to just leaving nameserver
   8.8.8.8 just in case it was a DNS issue.
  
   Here is the absolutely trivial ec2_elb_lb configuration that fails
 and
   the
   error it fails with. This is the example almost straight out of the
   online
   manual. I started with a much more complicated config and eventually
   decided
   to trivialize it to see if the error still recurs, and indeed it
 does.
  
   ===
name: Start load-balancers
 ec2_elb_lb:
   aws_access_key: {{ ec2_access_key }}
   aws_secret_key: {{ ec2_secret_key }}
   name: test-please-delete
   state: present
   zones:
 - us-east-1a
 - us-east-1d
   listeners:
 - protocol: http # options are http, https, ssl, tcp
   load_balancer_port: 80
   instance_port: 80
   ===
  
   When ansible gets to this task, it hangs for a while and then reports
   the
   following error. Since the error occurs in python-httplib2, I tried
   updating
   it from 0.7 (Debian wheezy) to 0.8 (Debian testing), but that didn't
   help
   either:
  
   TASK: [Start load-balancers]
   **
   failed: [localhost] = {failed: true, parsed: false}
   invalid output was: Traceback (most recent call last):
 File
  
  
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
   line 1880, in module
   main()
 File
  
  
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
   line 503, in main
   aws_secret_key, region=region)
 File
  
  
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
   line 210, in __init__
   self.elb = self._get_elb()
 File
  
  
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
   line 266, in _get_elb
   elbs = self.elb_conn.get_all_load_balancers()
 File /usr/lib/python2.7/dist-packages/boto/ec2/elb/__init__.py,
   line
   124, in get_all_load_balancers
   [('member', LoadBalancer)])
 File /usr/lib/python2.7/dist-packages/boto/connection.py, line
   1143,
   in get_list
   response = self.make_request(action, params, path, verb)
 File /usr/lib/python2.7/dist-packages/boto/connection.py, line
   1089,
   in make_request
   return self._mexe(http_request)
 File /usr/lib/python2.7/dist-packages/boto/connection.py, line
 922,
   in
   _mexe
   request.body, request.headers)
 File /usr/lib/python2.7/httplib.py, line 962, in request
   self._send_request(method, url, body, headers)
 File /usr/lib/python2.7/httplib.py, line 996, in _send_request
   self.endheaders(body)
 File /usr/lib/python2.7/httplib.py, line 958, in endheaders
   self._send_output(message_body)
 

Re: [ansible-project] ec2_elb_lb module fails with trivial example

2014-04-04 Thread Michael DeHaan
I didn't mean defaults -- I mean we should set this as universally
required because we can't provide sensible defaults, or at least when the
module needs it


On Fri, Apr 4, 2014 at 2:07 PM, Michael DeHaan mich...@ansible.com wrote:

 We should either add the region parameter as universally required or
 provide sensible defaults.

 Please do file a bug on this.

 Thanks!


 On Fri, Apr 4, 2014 at 12:36 PM, i iordanov iiorda...@gmail.com wrote:

 Hi Benno,

 Thanks, that did help. Now I get further. So this is a documentation
 issue.

 Now I am suffering from a lack of a feature which is a different
 issue. With the current code, I am unable to place the ELB into a VPC
 which is necessary for my use-case.

 Cheers!
 iordan

 On Fri, Apr 4, 2014 at 11:44 AM, benno joy benno...@gmail.com wrote:
 
  Can you try passing region: foo as a parameter and see if that helps.
 
 
 
 
  On Fri, Apr 4, 2014 at 8:57 PM, i iordanov iiorda...@gmail.com wrote:
 
  Hi Michael,
 
  I just built Ansible from the latest devel branch and I'm still seeing
  the same error. I don't quite understand whether I need to patch the
  devel branch with anything before testing.
 
  If not, I've already tested with the latest devel branch and this is a
 new
  bug.
 
  Thanks!
  iordan
 
  On Fri, Apr 4, 2014 at 11:20 AM, Michael DeHaan mich...@ansible.com
  wrote:
   There have been some tickets open about ec2_elb recently:
  
   Please review the following and see if your issues are addressed by
 the
   latest on the development branch:
  
  
  
 https://github.com/ansible/ansible/search?q=ec2_elbref=cmdformtype=Issues
  
   If not and you are still seeing issues on the development branch,
 please
   open a new ticket.
  
  
  
   On Fri, Apr 4, 2014 at 11:17 AM, i iordanov iiorda...@gmail.com
 wrote:
  
   Hello!
  
   I may be doing something wrong, but I tried so many different
 things, I
   though it should report just in case. So far, I've tried Ansible 1.5
   built
   from the repository and from Debian testing, and Ansible 1.6 (build
   from
   today's devel branch state). Also, I've tried with python-boto 2.9.x
   (from
   Ubuntu Saucy), 2.25 (Debian testing), and 2.27 (Debian unstable).
 The
   platform I'm running on is Debian Wheezy because I wanted everything
   else to
   be rock-solid.
  
   I've tried simplifying my DNS settings to just leaving nameserver
   8.8.8.8 just in case it was a DNS issue.
  
   Here is the absolutely trivial ec2_elb_lb configuration that fails
 and
   the
   error it fails with. This is the example almost straight out of the
   online
   manual. I started with a much more complicated config and eventually
   decided
   to trivialize it to see if the error still recurs, and indeed it
 does.
  
   ===
name: Start load-balancers
 ec2_elb_lb:
   aws_access_key: {{ ec2_access_key }}
   aws_secret_key: {{ ec2_secret_key }}
   name: test-please-delete
   state: present
   zones:
 - us-east-1a
 - us-east-1d
   listeners:
 - protocol: http # options are http, https, ssl, tcp
   load_balancer_port: 80
   instance_port: 80
   ===
  
   When ansible gets to this task, it hangs for a while and then
 reports
   the
   following error. Since the error occurs in python-httplib2, I tried
   updating
   it from 0.7 (Debian wheezy) to 0.8 (Debian testing), but that didn't
   help
   either:
  
   TASK: [Start load-balancers]
   **
   failed: [localhost] = {failed: true, parsed: false}
   invalid output was: Traceback (most recent call last):
 File
  
  
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
   line 1880, in module
   main()
 File
  
  
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
   line 503, in main
   aws_secret_key, region=region)
 File
  
  
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
   line 210, in __init__
   self.elb = self._get_elb()
 File
  
  
 /root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb,
   line 266, in _get_elb
   elbs = self.elb_conn.get_all_load_balancers()
 File /usr/lib/python2.7/dist-packages/boto/ec2/elb/__init__.py,
   line
   124, in get_all_load_balancers
   [('member', LoadBalancer)])
 File /usr/lib/python2.7/dist-packages/boto/connection.py, line
   1143,
   in get_list
   response = self.make_request(action, params, path, verb)
 File /usr/lib/python2.7/dist-packages/boto/connection.py, line
   1089,
   in make_request
   return self._mexe(http_request)
 File /usr/lib/python2.7/dist-packages/boto/connection.py, line
 922,
   in
   _mexe
   request.body, request.headers)
 File /usr/lib/python2.7/httplib.py, line 962, in request
   

Re: [ansible-project] Using sudo as root

2014-04-04 Thread Michael DeHaan
Curious.  Perhaps a global config setting for
prevent_apparent_useless_sudo is needed.

IIRC, this caused problems with prompts in some cases -- but maybe it
didn't and someone was optimizing something that didn't need to be
optimized.


On Fri, Apr 4, 2014 at 11:42 AM, Dustin C. Hatch admiraln...@gmail.comwrote:

 On Fri, Apr 4, 2014 at 10:16 AM, Michael DeHaan mich...@ansible.com
 wrote:
  Unfortunately, it seems that
  Ansible thinks it is smarter than I am, and refuses to run my modules
  in sudo if the remote user is root, so everything fails with
  permission denied errors.
 
  This is true because sudo to the same user causes problems on lots of
  systems.
 
  This is the first I've heard of sudo to root from root giving different
  behavior than being root.
 
  Can you share some more details about your SELinux policy configuration?
 
 
 It's the default Gentoo strict policy. Essentially the problem is that
 when root logs in via ssh, it gets staff_r, and needs to transition to
 sysadm_r in order to actually do anything. Normally, one would use
 newrole to do the transition, but since root has no password, it can't
 authenticate. These machines have the following entry in sudoers:

 root ALL = (ALL) ROLE=sysadm_r TYPE=sysadm_t ALL

 This allows root to transition to sysadm_r in order to run commands,
 without needing to authenticate. It works perfectly from the command
 line, but since Ansible won't run through sudo, root can't get the
 sysadm_r role.

 --
 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/CAP8b%3DdxJrA4Kpd7rK7T_Sct6o0Z5ux2cZNOdOu3ussj%3DzWc%2B9Q%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/CAEVJ8QNf8radaWuHcZ4aTgVy0jT3CqD7mUFkyphmyvs1J7z_Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variables in defaults/main.yml of a role are accessible from other roles. What if we have same {{ VAR }} names in several roles? Just wanted to check if this case is intended.

2014-04-04 Thread Michael DeHaan
You've described it good enough, I'm saying it's meant to be that way.

I have also mentioned above about the protections in place on vars, but
because defaults are inventory scope (so inventory can override them)
they do not apply to defaults.

Namespace your variables by prefixing them with the role name will make
this basically go away.




On Fri, Apr 4, 2014 at 12:28 PM, Marko_Lisica titelskib...@gmail.comwrote:

 Hello,

 I guess I havent described good enough. variables get inherited from other
 roles if they are stored in defaults.
 And if I run playbook with tags, I dont want variables to be inherited
 from the role that is not called with tags in the particular play.

 Is that current behaviour? Or vars are inherited from every role in a play
 regarding if they are actually called with a tag in specific play or not.


 On Fri, Apr 4, 2014 at 5:21 PM, Michael DeHaan mich...@ansible.comwrote:

 Yes.

 Tags apply only to the tasks therein, not the variables themselves.


 On Fri, Apr 4, 2014 at 11:18 AM, Marko_Lisica titelskib...@gmail.comwrote:

 Thing is that I wanted to point out if I tag my roles, and run a play,
 is it intended to inherit vars from a role that is not in that particular
 play although it exists in playbook, but it is excluded in particular run
 because of tags.


 On Fri, Apr 4, 2014 at 5:10 PM, Michael DeHaan mich...@ansible.comwrote:

 Defaults load into inventory scope.

 What I said applies to things in vars/


 On Fri, Apr 4, 2014 at 3:11 AM, Marko_Lisica titelskib...@gmail.comwrote:

 Hi,

 That is 100% clear. But in this case one role does not have its own
 defaults and inherits defaults from the last role in a list regardles if
 that role is played or not.


 On Fri, Apr 4, 2014 at 12:16 AM, Michael DeHaan 
 mich...@ansible.comwrote:

 It's entirely intended.  For instance, you might have a role that
 applies a particular configuration to machines that live in a particular
 datacenter, and one of the things that sets might be the port to use for
 the database
 server.  That port variable would then be available to other roles.

 While this sounds scary at first, Ansible contains safeguards to make
 sure the variables used in one role are absolutely used there and not
 clobbered by another.  Thus they have guaranteed scope to that role.

 As such, if you define a variable port in two places, each role is
 guaranteed to be able to read the local value.


 On Thu, Apr 3, 2014 at 10:09 AM, Marko Lisica titelskib...@gmail.com
  wrote:

 Hi,

 I stumbled onto little mind game with ansible today : D .

 I have three roles that are tagged.

 - hosts: vagrant
   sudo: yes
   roles:
 - {role: ansible_users, tags: users}
 - {role: ansible_nginx, tags: nginx}
 - {role: ansible_mysql, tags: mysql}


 I have defaults/main.yml for ansible_users and ansible_mysql in
 their respective places.

 This is ansible_users defaults:

 ---
 users:
   - user: detlic
 webdir:
   - woodpecker
   - aligator
   - user: keder
 webdir: []


 This is ansible_mysql defaults:

 ---
 users:
   - user: detlic
 db:
   - aligatordb
   - woodpeckerdb
   - user: jazavac
 db:
   - badgerdb
   - ddaybdb


 I have left NGINX role without defaults. How I understand things
 is that NGINX will inherit defaults vars from other roles and use them
 where it can. But in this case {{ VARS }} are named the same in both 
 USER
 and MYSQL roles.

 NGINX role is before MYSQL from whoom it should inherit vars? In my
 test case it inherits it from the LAST role in the list. So in this 
 case it
 is MYSQL. If I remove MYSQL role from a list then everything is fine.

 Another thing is if I leave MYSQL role present BUT use TAGS and play
 roles with jsut USERS and NGINX tags, still NGINX inherits defaults 
 from
 MYSQL.

 Can someone comment on this.

 --
 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/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/y_Gucqc_3sE/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
 

Re: [ansible-project] file module: absent recurse=yes and Directory not empty

2014-04-04 Thread Michael DeHaan
Perhaps the force is causing extra checking?

If so, maybe it can be removed.


On Fri, Apr 4, 2014 at 12:29 PM, Matt Martz m...@sivel.net wrote:

 I will mention that we use 'file' to recursively delete a directory, but
 it does require 'force=yes'
 --
 Matt Martz
 m...@sivel.net

 On April 4, 2014 at 8:48:36 AM, Maxim Odinintsev (gwynn@gmail.com)
 wrote:

 Hello,

 When I'm run this job, but on some hosts return output:
 rmtree failed: [Errno 39] Directory not empty:
 '/home/master/www/static.master/images/posters'

 Sure this directories is not empty, and I'm want remove it recursive. But
 why i can't do this with file module ?

  - name: Cleaner
   hosts: all
   sudo: yes

   tasks:
 - name: get cache dirs
   shell: ls -1 /var/lib/nginx/cache/
   register: cache

 - name: Remove cache
   file: name=/var/lib/nginx/cache/{{ item }} state=absent recurse=yes
   with_items: cache.stdout_lines

 - name: get static dirs
   shell: ls -1 /home/master/www/static.master/
   register: static

 - name: Clean static
   file: name=/home/master/www/static.master/{{ item }} state=absent
 recurse=yes
   with_items: static.stdout_lines


 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/468b6757-2798-4003-ab2a-d9e5e85b6cd4%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/468b6757-2798-4003-ab2a-d9e5e85b6cd4%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/etPan.533eddee.6b8b4567.f4e6%40mobiletuvix.rackspace.corphttps://groups.google.com/d/msgid/ansible-project/etPan.533eddee.6b8b4567.f4e6%40mobiletuvix.rackspace.corp?utm_medium=emailutm_source=footer
 .

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


Re: [ansible-project] Using sudo as root

2014-04-04 Thread Dustin C. Hatch
On Fri, Apr 4, 2014 at 1:09 PM, Michael DeHaan mich...@ansible.com wrote:
 Curious.  Perhaps a global config setting for
 prevent_apparent_useless_sudo is needed.

 IIRC, this caused problems with prompts in some cases -- but maybe it didn't
 and someone was optimizing something that didn't need to be optimized.


I'm guessing this was a configuration issue (http://xkcd.com/1343/),
and maybe Ansible should try to work around it by default, but it
should not ignore what I've explicitly told it to do. If you're okay
with a configuration setting to override this behavior, I'll try to
get a patch that implements it.

Dustin C. Hatch
http://dustin.hatch.name/

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


Re: [ansible-project] FATAL: all hosts have already failed -- aborting

2014-04-04 Thread Marc Petrivelli
This is an interesting side effect of using local tasks vs plays with 
hosts: 127.0.0.1.

In my case I was running a playbook and on the command line limiting with 
-l command.

ansible-playbook -l host1 site.yml

in the play book I had the following play:

 hosts: localhost
  user: root
  tasks:
  - file: path=tmp/file1.txt state=absent
  - file: path=tmp/file2.txt state=absent


The plays in the playbook all finished successfully however at the end I 
got the error listed in the subject of this post: *FATAL: all hosts have 
already failed -- aborting.*

Looking at the source (lib/ansible/callbacks.py and 
lib/ansible/playbook/__init__.py) this error seems to be spit out when (but 
not only when) the the expected play_count/host_count minus the actual 
play_count/host_count is greater than the max fail pct (in my case 0).

I figured that having an explicit play with localhost might be confusing 
the counts.  So I changed my code to:

- hosts: dhcp_servers
  user: root
  tasks:
  - local_action: file path=tmp/file1.txt state=absent
  - local_action: file path=tmp/file2.txt state=absent

The FATAL at the end of the run disappeared.  Not sure if it matters but in 
my inventory file I do have this line:

localhost ansible_ssh_host=127.0.0.1 ansible_connection=local


Something doesn't seem right here.




On Friday, April 4, 2014 2:10:12 PM UTC-4, Michael DeHaan wrote:

 Without more context, it's impossible to tell what you mean, as this is 
 exactly the message you get after all the hosts have had failures.

 Please supply some more context about your playbook run, execution, and so 
 on, and we can discuss further.


 On Fri, Apr 4, 2014 at 12:02 PM, Marc Petrivelli 
 marc.pe...@gmail.comjavascript:
  wrote:

 I am getting

 *FATAL: all hosts have already failed -- aborting *

 even though none of the hosts are showing any errors.   This problem 
 starting creeping up in the 1.5.x releases. Any ideas?

 -- 
 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 javascript:.
 To post to this group, send email to ansible...@googlegroups.comjavascript:
 .
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/ansible-project/e171e42f-d802-444e-a74c-79ad02d93a5c%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/e171e42f-d802-444e-a74c-79ad02d93a5c%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/a80ffc1f-852f-4a5e-8b45-495025fa5e8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Galaxy Maintenance Tonight, 4/4/2014

2014-04-04 Thread James Cammarata
There will be a small maintenance window tonight for Galaxy starting at
10PM EDT to deploy a few bug fixes and the following two major items:

1) All roles starting with ansible-(role-) will be renamed so they no
longer contain that string. Also, moving forward, any roles that are
created will automatically have that stripped out as well.

2) Users can now permanently delete roles that they have deactivated.

We'll be sending a follow-up email once the maintenance window is done.
Please let us know if you have any questions.

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/CAFg%2Bn8Tf0HhLqTAnKYL-rj1jz%3DKqBc2whvap7YWt1zi0xt%3DhBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Using sudo as root

2014-04-04 Thread Michael DeHaan
A config setting seems reasonable.  I hate that I don't remember how we got
down this path, but I think there's a good chance in some cases extra-sudo
was causing issues for people.


On Fri, Apr 4, 2014 at 3:34 PM, Dustin C. Hatch admiraln...@gmail.comwrote:

 On Fri, Apr 4, 2014 at 1:09 PM, Michael DeHaan mich...@ansible.com
 wrote:
  Curious.  Perhaps a global config setting for
  prevent_apparent_useless_sudo is needed.
 
  IIRC, this caused problems with prompts in some cases -- but maybe it
 didn't
  and someone was optimizing something that didn't need to be optimized.
 
 
 I'm guessing this was a configuration issue (http://xkcd.com/1343/),
 and maybe Ansible should try to work around it by default, but it
 should not ignore what I've explicitly told it to do. If you're okay
 with a configuration setting to override this behavior, I'll try to
 get a patch that implements it.

 Dustin C. Hatch
 http://dustin.hatch.name/

 --
 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/CAP8b%3Ddzg%2BAYj_OrjtQ_TUX1Fhkud5zf7UxMWDu5YjBrWCgQnRw%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/CAEVJ8QMRK3C98FXtdR3pjbnaFm5fAPqyjbeBgKpzzvwfcH%3Dngw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] FATAL: all hosts have already failed -- aborting

2014-04-04 Thread Michael DeHaan
It could very well be that the implicit localhost magic doesn't sit well
with the failure percentage code -- please make sure we have a github
ticket on this one with details of how to repro.

Thanks!


On Fri, Apr 4, 2014 at 3:51 PM, Marc Petrivelli
marc.petrive...@gmail.comwrote:

 This is an interesting side effect of using local tasks vs plays with
 hosts: 127.0.0.1.

 In my case I was running a playbook and on the command line limiting with
 -l command.

 ansible-playbook -l host1 site.yml

 in the play book I had the following play:

  hosts: localhost
   user: root
   tasks:
   - file: path=tmp/file1.txt state=absent
   - file: path=tmp/file2.txt state=absent


 The plays in the playbook all finished successfully however at the end I
 got the error listed in the subject of this post: *FATAL: all hosts have
 already failed -- aborting.*

 Looking at the source (lib/ansible/callbacks.py and
 lib/ansible/playbook/__init__.py) this error seems to be spit out when (but
 not only when) the the expected play_count/host_count minus the actual
 play_count/host_count is greater than the max fail pct (in my case 0).

 I figured that having an explicit play with localhost might be confusing
 the counts.  So I changed my code to:

 - hosts: dhcp_servers
   user: root
   tasks:
   - local_action: file path=tmp/file1.txt state=absent
   - local_action: file path=tmp/file2.txt state=absent

 The FATAL at the end of the run disappeared.  Not sure if it matters but
 in my inventory file I do have this line:

 localhost ansible_ssh_host=127.0.0.1 ansible_connection=local


 Something doesn't seem right here.




 On Friday, April 4, 2014 2:10:12 PM UTC-4, Michael DeHaan wrote:

 Without more context, it's impossible to tell what you mean, as this is
 exactly the message you get after all the hosts have had failures.

 Please supply some more context about your playbook run, execution, and
 so on, and we can discuss further.


 On Fri, Apr 4, 2014 at 12:02 PM, Marc Petrivelli marc.pe...@gmail.comwrote:

 I am getting

 *FATAL: all hosts have already failed -- aborting *

 even though none of the hosts are showing any errors.   This problem
 starting creeping up in the 1.5.x releases. Any ideas?

 --
 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/e171e42f-d802-444e-a74c-
 79ad02d93a5c%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/e171e42f-d802-444e-a74c-79ad02d93a5c%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/a80ffc1f-852f-4a5e-8b45-495025fa5e8d%40googlegroups.comhttps://groups.google.com/d/msgid/ansible-project/a80ffc1f-852f-4a5e-8b45-495025fa5e8d%40googlegroups.com?utm_medium=emailutm_source=footer
 .

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


[ansible-project] Re: Galaxy Maintenance Tonight, 4/4/2014

2014-04-04 Thread James Cammarata
The maintenance has been completed, please let us know if you experience
any issues.

Thanks!


On Fri, Apr 4, 2014 at 4:30 PM, James Cammarata jcammar...@ansible.comwrote:

 There will be a small maintenance window tonight for Galaxy starting at
 10PM EDT to deploy a few bug fixes and the following two major items:

 1) All roles starting with ansible-(role-) will be renamed so they no
 longer contain that string. Also, moving forward, any roles that are
 created will automatically have that stripped out as well.

 2) Users can now permanently delete roles that they have deactivated.

 We'll be sending a follow-up email once the maintenance window is done.
 Please let us know if you have any questions.

 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/CAFg%2Bn8Sj%2BjN%3Dub6VjZ8o-enpUZ%2BjRDcXyp7qqKx_1iUk1osxtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.