[ansible-project] Re: Unable to figure out arrays

2014-10-10 Thread mvermaes
Hi Michael, I think you want something like:

---
- name: Set up users
  hosts: localhost
  gather_facts: no

  vars:
users:
  alice:
name: Alice Appleworth
mail: al...@appleworth.com
pass: ..hash...
  bob:
name: Bob Bananarama
mail: b...@bananarama.com
pass: ..hash..

  tasks:
- name: Add user
  debug: msg=Add user {{ item.key }}  password {{ item.value.pass }}
  with_dict: users


Here's the section of the docs you want - 
http://docs.ansible.com/playbooks_loops.html#looping-over-hashes

On Friday, October 10, 2014 7:36:25 AM UTC+8, Michael Bushey wrote:

 I would like to be able to put my users into a list and be able to select 
 what user has access to each machine.

 ---
 - name: Set up users
   hosts: localhost
   gather_facts: no


   vars:
 - alice:
 name: Alice Appleworth
 mail: al...@appleworth.com javascript:
 pass: ..hash...
 - bob:
 name: Bob Bananarama
 mail: b...@bananarama.com javascript:
 pass: ..hash..
 mail:

   tasks:
 - name: Add user
   debug: msg=Add user {{ item.key }}  password {{ item.pass }}
   with_items:
 - {{ alice }}


 I am not able to figure out how to get the user name, ie alice as 
 item.key is not valid. I think this is because using {{ alice }} does not 
 preserve the name. Does anyone know how I can structure this? I've tried 
 putting them all under users, but with_items: users.alice does not work.

 Thanks in advance for any help. The docs do not seem to cover this and 
 I've Googled Ansible arrays and dicts to the point where I'm not finding 
 any new pages.




-- 
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/90226003-8d97-4e92-8bb5-c8ec56b3717c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Unable to figure out arrays

2014-10-10 Thread Michael Bushey
Thanks for your response Michael. I've already read through that page
a few times. It does not work for me because I need an array of users,
and  then I need to be able to select which user have access to each
class of server. This method would give every user access to every
machine. I need to be able to specify something like with items -
users.alice - users.bob and not have carol included.





On Thu, Oct 9, 2014 at 11:20 PM, mvermaes mverm...@gmail.com wrote:
 Hi Michael, I think you want something like:

 ---
 - name: Set up users
   hosts: localhost
   gather_facts: no

   vars:
 users:
   alice:
 name: Alice Appleworth
 mail: al...@appleworth.com
 pass: ..hash...
   bob:
 name: Bob Bananarama
 mail: b...@bananarama.com
 pass: ..hash..

   tasks:
 - name: Add user
   debug: msg=Add user {{ item.key }}  password {{ item.value.pass }}
   with_dict: users


 Here's the section of the docs you want -
 http://docs.ansible.com/playbooks_loops.html#looping-over-hashes

 On Friday, October 10, 2014 7:36:25 AM UTC+8, Michael Bushey wrote:

 I would like to be able to put my users into a list and be able to select
 what user has access to each machine.

 ---
 - name: Set up users
   hosts: localhost
   gather_facts: no


   vars:
 - alice:
 name: Alice Appleworth
 mail: al...@appleworth.com
 pass: ..hash...
 - bob:
 name: Bob Bananarama
 mail: b...@bananarama.com
 pass: ..hash..
 mail:

   tasks:
 - name: Add user
   debug: msg=Add user {{ item.key }}  password {{ item.pass }}
   with_items:
 - {{ alice }}


 I am not able to figure out how to get the user name, ie alice as
 item.key is not valid. I think this is because using {{ alice }} does not
 preserve the name. Does anyone know how I can structure this? I've tried
 putting them all under users, but with_items: users.alice does not work.

 Thanks in advance for any help. The docs do not seem to cover this and
 I've Googled Ansible arrays and dicts to the point where I'm not finding any
 new pages.


 --
 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/-TzTFS57j7A/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/90226003-8d97-4e92-8bb5-c8ec56b3717c%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/CAPJTyAX%3DA%2Bv8YkX42UNvpJGmjr%2B9QCLy1BDUdr1nypcEriyErQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] syntax error in vars bubstution [ shell module ]

2014-10-10 Thread olga
Hi Michael,

Quoting also did not work. I added sh before the {{ and it worked.

  tasks:
  - name: stop tomcat
shell: sh {{ tomcat_home }}/bin/shutdown.sh
  - name: start tomcat
shell: sh {{ tomcat_home }}/bin/startup.sh

Thanks for the link.

Regards,
Olga

On Thursday, October 9, 2014 1:33:15 AM UTC+5:30, Michael Peters wrote:

 Try quoting the templated part. The {{ }} syntax markers mess up the 
 yaml parsing - http://docs.ansible.com/YAMLSyntax.html#gotchas 

 On Wed, Oct 8, 2014 at 3:41 PM, olga osu...@gmail.com javascript: 
 wrote: 
  Hi, 
  
  --- 
  - hosts: service 
vars: 
  app_service_port: 8080 
  tomcat_home: /opt/apache-tomcat-8.0.9 
remote_user: deploy 
tasks: 
- name: stop tomcat 
  shell: {{ tomcat_home }}/bin/shutdown.sh 
- name: start tomcat 
  shell: {{ tomcat_home }}/bin/startup.sh 
  
  When i run this play, i get 
  
  ERROR: Syntax Error while loading YAML script, test.yml 
  Note: The error may actually appear before this position: line 8, column 
 28 
  
tasks: 
- shell: {{ tomcat_home}}/bin/shutdown.sh 
  
  is variable substitution not allowed in shell module. 
  
  These are custom installed tomcat dir, so i have to use shell command to 
  start and stop the tomcat. Also, has anyone verified if the java process 
 got 
  killed. I have seen some times that after shutdown, the java process 
 still 
  run. OR is there any easy method in ansible to do this. 
  
  Thanks, 
  olaga 
  
  -- 
  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.com 
 javascript:. 
  To view this discussion on the web visit 
  
 https://groups.google.com/d/msgid/ansible-project/72a6af6d-d972-4747-bb6f-21eb0c63350b%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/7cc0daa5-8d6e-46d8-ba2b-1f35ff8acdc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Playbook failing due to EC2 delays

2014-10-10 Thread Peter Palmieri
I have a simple playbook that:

1 - starts an EC2 instance
2 - configures it
3 - creates an AMI from it
4 - terminates it

Over the last few days, I've been seeing the job fail quite frequently on 
step 4, because it's taking AWS too long to shut down the instance:

TASK: [destroy all instances] **
***
failed: ] = (item=) = {failed: true, item: 0}
msg: wait for instance termination timeout on Fri Oct 10 06:39:56 2014

It seem obvious that this us an EC2 issue, but is there any way to change 
how long Ansible will wait for an instance to terminate? 

-- 
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/675a5990-66de-4d04-b82b-2f735ae81e0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Globbing with Lookup

2014-10-10 Thread Navid Paya
Hi all
Not sure if this is even the right tile. So I have a set of SSH keys, I 
want to be used as authorized keys for users. I've put all of them in a 
directory and am trying to do the job but nothing happens. So I did some 
debugging. This is what I do when not using a variable:

- name: Some debugging
  debug: msg={{ lookup('file', 'public_ssh_keys/navid.pub') }}

And it returns what I expect. Now I try doing a loop:

- name: Some debugging
  debug: msg={{ lookup('file', 'public_ssh_keys/{{ item }}.pub') }}
  with_items:
- navid

But this time it returns this:

TASK: [base-ami | Some debugging] 
*
ok: [default] = (item=navid) = {
item: navid,
msg: 
}

So how am I supposed to have it return what I expect? I think it's probably 
a matter of using the single and double quotes right but how?

Regards

Navid

-- 
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/733e3c63-80c1-4fba-bf72-e1ebca70e45b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Unable to figure out arrays

2014-10-10 Thread Brian Coca
for that just do :

 vars:
  
allowed_users_host1: ['alice,'bob']

- name: Add user
  debug: msg=Add user {{ item.key }}  password {{ item.value.pass }}
  with_dict: users
  when: item.key in allowed_users_host1

On Fri, Oct 10, 2014 at 2:59 AM, Michael Bushey corw...@gmail.com wrote:
 Thanks for your response Michael. I've already read through that page
 a few times. It does not work for me because I need an array of users,
 and  then I need to be able to select which user have access to each
 class of server. This method would give every user access to every
 machine. I need to be able to specify something like with items -
 users.alice - users.bob and not have carol included.





 On Thu, Oct 9, 2014 at 11:20 PM, mvermaes mverm...@gmail.com wrote:
 Hi Michael, I think you want something like:

 ---
 - name: Set up users
   hosts: localhost
   gather_facts: no

   vars:
 users:
   alice:
 name: Alice Appleworth
 mail: al...@appleworth.com
 pass: ..hash...
   bob:
 name: Bob Bananarama
 mail: b...@bananarama.com
 pass: ..hash..

   tasks:
 - name: Add user
   debug: msg=Add user {{ item.key }}  password {{ item.value.pass }}
   with_dict: users


 Here's the section of the docs you want -
 http://docs.ansible.com/playbooks_loops.html#looping-over-hashes

 On Friday, October 10, 2014 7:36:25 AM UTC+8, Michael Bushey wrote:

 I would like to be able to put my users into a list and be able to select
 what user has access to each machine.

 ---
 - name: Set up users
   hosts: localhost
   gather_facts: no


   vars:
 - alice:
 name: Alice Appleworth
 mail: al...@appleworth.com
 pass: ..hash...
 - bob:
 name: Bob Bananarama
 mail: b...@bananarama.com
 pass: ..hash..
 mail:

   tasks:
 - name: Add user
   debug: msg=Add user {{ item.key }}  password {{ item.pass }}
   with_items:
 - {{ alice }}


 I am not able to figure out how to get the user name, ie alice as
 item.key is not valid. I think this is because using {{ alice }} does not
 preserve the name. Does anyone know how I can structure this? I've tried
 putting them all under users, but with_items: users.alice does not work.

 Thanks in advance for any help. The docs do not seem to cover this and
 I've Googled Ansible arrays and dicts to the point where I'm not finding any
 new pages.


 --
 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/-TzTFS57j7A/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/90226003-8d97-4e92-8bb5-c8ec56b3717c%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/CAPJTyAX%3DA%2Bv8YkX42UNvpJGmjr%2B9QCLy1BDUdr1nypcEriyErQ%40mail.gmail.com.
 For more options, visit https://groups.google.com/d/optout.



-- 
Brian Coca
Stultorum infinitus est numerus
0111011100100110010101101110001001110111011000010110011101010010011100110110110101110111001001110111
Pedo mellon a minno

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


Re: [ansible-project] Globbing with Lookup

2014-10-10 Thread Brian Coca
mustaches don't stack!

you want:
{{ lookup('file', 'public_ssh_keys/' +  item + '.pub') }}

On Fri, Oct 10, 2014 at 3:50 AM, Navid Paya m...@navidpaya.com wrote:
 Hi all
 Not sure if this is even the right tile. So I have a set of SSH keys, I want
 to be used as authorized keys for users. I've put all of them in a directory
 and am trying to do the job but nothing happens. So I did some debugging.
 This is what I do when not using a variable:

 - name: Some debugging
   debug: msg={{ lookup('file', 'public_ssh_keys/navid.pub') }}

 And it returns what I expect. Now I try doing a loop:

 - name: Some debugging
   debug: msg={{ lookup('file', 'public_ssh_keys/{{ item }}.pub') }}
   with_items:
 - navid

 But this time it returns this:

 TASK: [base-ami | Some debugging]
 *
 ok: [default] = (item=navid) = {
 item: navid,
 msg: 
 }

 So how am I supposed to have it return what I expect? I think it's probably
 a matter of using the single and double quotes right but how?

 Regards

 Navid

 --
 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/733e3c63-80c1-4fba-bf72-e1ebca70e45b%40googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



-- 
Brian Coca
Stultorum infinitus est numerus
0111011100100110010101101110001001110111011000010110011101010010011100110110110101110111001001110111
Pedo mellon a minno

-- 
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/CADn%2BHsy8KTsp6xXUvAxu5p3nJGX2g-4qMQ2vDpY%2BBv%2B73q-19A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Best practice for roles with per item configuration

2014-10-10 Thread André
Are there any examples for a configuration like this?

I can't find good examples of modular, reusable roles which can be used in 
conjunction with other roles.

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


Re: [ansible-project] Re: Unable to figure out arrays

2014-10-10 Thread Adam Heath

- name: foo
  shell: echo {{ users[item].name }}
  with_items:
   - alice
   - bob

On 10/10/2014 01:59 AM, Michael Bushey wrote:

Thanks for your response Michael. I've already read through that page
a few times. It does not work for me because I need an array of users,
and  then I need to be able to select which user have access to each
class of server. This method would give every user access to every
machine. I need to be able to specify something like with items -
users.alice - users.bob and not have carol included.





On Thu, Oct 9, 2014 at 11:20 PM, mvermaes mverm...@gmail.com wrote:

Hi Michael, I think you want something like:

---
- name: Set up users
   hosts: localhost
   gather_facts: no

   vars:
 users:
   alice:
 name: Alice Appleworth
 mail: al...@appleworth.com
 pass: ..hash...
   bob:
 name: Bob Bananarama
 mail: b...@bananarama.com
 pass: ..hash..

   tasks:
 - name: Add user
   debug: msg=Add user {{ item.key }}  password {{ item.value.pass }}
   with_dict: users


Here's the section of the docs you want -
http://docs.ansible.com/playbooks_loops.html#looping-over-hashes

On Friday, October 10, 2014 7:36:25 AM UTC+8, Michael Bushey wrote:

I would like to be able to put my users into a list and be able to select
what user has access to each machine.

---
- name: Set up users
   hosts: localhost
   gather_facts: no


   vars:
 - alice:
 name: Alice Appleworth
 mail: al...@appleworth.com
 pass: ..hash...
 - bob:
 name: Bob Bananarama
 mail: b...@bananarama.com
 pass: ..hash..
 mail:

   tasks:
 - name: Add user
   debug: msg=Add user {{ item.key }}  password {{ item.pass }}
   with_items:
 - {{ alice }}


I am not able to figure out how to get the user name, ie alice as
item.key is not valid. I think this is because using {{ alice }} does not
preserve the name. Does anyone know how I can structure this? I've tried
putting them all under users, but with_items: users.alice does not work.

Thanks in advance for any help. The docs do not seem to cover this and
I've Googled Ansible arrays and dicts to the point where I'm not finding any
new pages.



--
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/-TzTFS57j7A/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/90226003-8d97-4e92-8bb5-c8ec56b3717c%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/54380AE6.3070902%40brainfood.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Unable to figure out arrays

2014-10-10 Thread Michael Bushey
Awesome! Thank you so much for your responses Michael, Brian, and
Adam. Both solutions from Brian and Adam work, thank you! If any of
you get to Los Angeles I owe you a drink!

This is working great:

  - name: Users | create .gitconfig
shell: git config --global user.name '{{ item.value.name }}'; git
config --global user.email '{{ item.value.mail }}'
args:
  creates: /home/{{ item.key }}/.gitconfig
sudo: yes
sudo_user: {{ item.key }}
with_dict: users
when: item.key in allowed_users_dev
tags: git

What I like about the with_dict approach is I can do when: item.key
not in allowed_users_dev with user: name={{ item.key }}
state=absent.



On Fri, Oct 10, 2014 at 9:35 AM, Adam Heath a...@brainfood.com wrote:
 - name: foo
   shell: echo {{ users[item].name }}
   with_items:
- alice
- bob


 On 10/10/2014 01:59 AM, Michael Bushey wrote:

 Thanks for your response Michael. I've already read through that page
 a few times. It does not work for me because I need an array of users,
 and  then I need to be able to select which user have access to each
 class of server. This method would give every user access to every
 machine. I need to be able to specify something like with items -
 users.alice - users.bob and not have carol included.





 On Thu, Oct 9, 2014 at 11:20 PM, mvermaes mverm...@gmail.com wrote:

 Hi Michael, I think you want something like:

 ---
 - name: Set up users
hosts: localhost
gather_facts: no

vars:
  users:
alice:
  name: Alice Appleworth
  mail: al...@appleworth.com
  pass: ..hash...
bob:
  name: Bob Bananarama
  mail: b...@bananarama.com
  pass: ..hash..

tasks:
  - name: Add user
debug: msg=Add user {{ item.key }}  password {{ item.value.pass
 }}
with_dict: users


 Here's the section of the docs you want -
 http://docs.ansible.com/playbooks_loops.html#looping-over-hashes

 On Friday, October 10, 2014 7:36:25 AM UTC+8, Michael Bushey wrote:

 I would like to be able to put my users into a list and be able to
 select
 what user has access to each machine.

 ---
 - name: Set up users
hosts: localhost
gather_facts: no


vars:
  - alice:
  name: Alice Appleworth
  mail: al...@appleworth.com
  pass: ..hash...
  - bob:
  name: Bob Bananarama
  mail: b...@bananarama.com
  pass: ..hash..
  mail:

tasks:
  - name: Add user
debug: msg=Add user {{ item.key }}  password {{ item.pass }}
with_items:
  - {{ alice }}


 I am not able to figure out how to get the user name, ie alice as
 item.key is not valid. I think this is because using {{ alice }} does
 not
 preserve the name. Does anyone know how I can structure this? I've tried
 putting them all under users, but with_items: users.alice does not work.

 Thanks in advance for any help. The docs do not seem to cover this and
 I've Googled Ansible arrays and dicts to the point where I'm not finding
 any
 new pages.


 --
 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/-TzTFS57j7A/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/90226003-8d97-4e92-8bb5-c8ec56b3717c%40googlegroups.com.

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


 --
 You received this message because you are subscribed to a topic in the
 Google Groups Ansible Project group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/ansible-project/-TzTFS57j7A/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/54380AE6.3070902%40brainfood.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/CAPJTyAUM4oS-oAnmgKTtgzoVXMy5xEtZjjo265B%3DQD5HYvqp_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Gathering facts just hung to infinity for my AWS hosts

2014-10-10 Thread Steven Truong
Hi all,

I worked around and tried not to use any facts so I disabled fact gathering 
in my playbook.  I now ran into a strange problem and even for a simplest 
task such as running a shell command the whole thing would just hung...


 TASK: bash | cp /usr/local/bin/help to /usr/local/bin/help.old 
 
\   ^__^
 \  (oo)\___
(__)\   )\/\
||w |
|| ||


mysever ESTABLISH CONNECTION FOR USER: user
mysever REMOTE_MODULE command cp /bin/bash /bin/bash.old #USE_SHELL
mysever EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', 
'-o', 'ControlPersist=60s', '-o', 
'ControlPath=/home/steven/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 
'StrictHostKeyChecking=no', '-o', 
'IdentityFile=/home/steven/.ssh/key-user', '-o', 
'KbdInteractiveAuthentication=no', '-o', 
'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', 
'-o', 'PasswordAuthentication=no', '-o', 'User=user', '-o', 
'ConnectTimeout=10', 'mysever', /bin/sh -c 'mkdir -p 
$HOME/.ansible/tmp/ansible-tmp-1412960308.87-49429622058592  chmod a+rx 
$HOME/.ansible/tmp/ansible-tmp-1412960308.87-49429622058592  echo 
$HOME/.ansible/tmp/ansible-tmp-1412960308.87-49429622058592']
mysever PUT /tmp/tmpVCdj27 TO 
/home/user/.ansible/tmp/ansible-tmp-1412960308.87-49429622058592/command
mysever EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', 
'-o', 'ControlPersist=60s', '-o', 
'ControlPath=/home/steven/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 
'StrictHostKeyChecking=no', '-o', 
'IdentityFile=/home/steven/.ssh/key-user', '-o', 
'KbdInteractiveAuthentication=no', '-o', 
'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', 
'-o', 'PasswordAuthentication=no', '-o', 'User=user', '-o', 
'ConnectTimeout=10', 'mysever', u'/bin/sh -c \'su root -c /bin/sh -c 
\'\'\'echo SUDO-SUCCESS-jqiqepwwyueomscsvvidoflkvqfxpkff; 
LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python 
/home/user/.ansible/tmp/ansible-tmp-1412960308.87-49429622058592/command; 
rm -rf /home/user/.ansible/tmp/ansible-tmp-1412960308.87-49429622058592/ 
/dev/null 21\'\'\'\'']

On the aws server:

$ date
Fri Oct 10 19:27:02 UTC 2014
$ ps axuw|grep python
root  7691  0.0  0.0 143044  1056 pts/1Ss+  16:58   0:00 su root -c 
/bin/sh -c 'echo SUDO-SUCCESS-jqiqepwwyueomscsvvidoflkvqfxpkff; 
LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python 
/home/adsymp/.ansible/tmp/ansible-tmp-1412960308.87-49429622058592/command; 
rm -rf /home/user/.ansible/tmp/ansible-tmp-1412960308.87-49429622058592/ 
/dev/null 21'
root 17783  0.0  0.1 331228 13320 ?SN2012   0:00 
/usr/bin/python -tt /usr/sbin/yum-updatesd

As you can see, I let it to run from 16:58 UTC until 19:27 UTC and it is 
still there.

I would like to know how to fix this as this is a show stopper for me. 

The weird thing is that I could use -m setup or -m shell -a uptime but 
not through the playbook's tasks.

By they way, in our Ansible community, do we have a tool to capture the 
environments (ansible facts might do) to provide information for 
troubleshooting.

Steven.

On Tuesday, October 7, 2014 11:55:12 AM UTC-7, Steven Truong wrote:

 Hi,

 I have a mixed or Amazon Linux and CentOS 6.5 on AWS but I just recently 
 have had this problem.  Running the setup scripts directly worked but 
 Ansible gathering facts just hung. 


 # pwd
 /home/adsymp/.ansible

  # su root -c /bin/sh -c 'echo 
 SUDO-SUCCESS-dhyqcckwxzuthyzxqniggbjvfxvuewha; LANG=en_US.UTF-8 
 LC_CTYPE=en_US.UTF-8 /usr/bin/python 
 /home/adsymp/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294/setup'
 SUDO-SUCCESS-dhyqcckwxzuthyzxqniggbjvfxvuewha
 /home/adsymp/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294/setup:2922:
  
 DeprecationWarning: object.__new__() takes no parameters
   return super(cls, subclass).__new__(subclass, *arguments, **keyword)
 {verbose_override: true, changed: false, ansible_facts: 
 {ansible_product_serial: , ansible_form_factor: , 
 ansible_product_version: , ansible_swaptotal_mb: 0, 
 ansible_user_id: root, module_setup: true, ansible_userspace_bits: 
 64, ansible_distribution_version:
 .


 Ansible verbose 

 EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 
 'ControlPersist=60s', '-o', 
 'ControlPath=/home/steven/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 
 'StrictHostKeyChecking=no', '-o', 
 'IdentityFile=/home/steven/.ssh/key-user', '-o', 
 'KbdInteractiveAuthentication=no', '-o', 
 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', 
 '-o', 'PasswordAuthentication=no', '-o', 'User=user', '-o', 
 'ConnectTimeout=10', 'ip-10-123', /bin/sh -c 'mkdir -p 
 $HOME/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294  chmod a+rx 
 $HOME/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294  echo 
 $HOME/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294']
 ip-10-123-71-225 PUT /tmp/tmpLdghlG TO 
 

[ansible-project] Re: Gathering facts just hung to infinity for my AWS hosts

2014-10-10 Thread Steven Truong
Well, you do not have to guess.  I feel very stupid and spent times looking 
into this. 

Apparently I used the wrong options for ansible-playbook

ansible-playbook base.yml --tags useful -i hosts.awse --limit awse-c 
--private-key ~/.ssh/key-user -u user -s

This works.

Sorry to all..
Steven.

On Tuesday, October 7, 2014 11:55:12 AM UTC-7, Steven Truong wrote:

 Hi,

 I have a mixed or Amazon Linux and CentOS 6.5 on AWS but I just recently 
 have had this problem.  Running the setup scripts directly worked but 
 Ansible gathering facts just hung.

 # pwd
 /home/adsymp/.ansible

  # su root -c /bin/sh -c 'echo 
 SUDO-SUCCESS-dhyqcckwxzuthyzxqniggbjvfxvuewha; LANG=en_US.UTF-8 
 LC_CTYPE=en_US.UTF-8 /usr/bin/python 
 /home/adsymp/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294/setup'
 SUDO-SUCCESS-dhyqcckwxzuthyzxqniggbjvfxvuewha
 /home/adsymp/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294/setup:2922:
  
 DeprecationWarning: object.__new__() takes no parameters
   return super(cls, subclass).__new__(subclass, *arguments, **keyword)
 {verbose_override: true, changed: false, ansible_facts: 
 {ansible_product_serial: , ansible_form_factor: , 
 ansible_product_version: , ansible_swaptotal_mb: 0, 
 ansible_user_id: root, module_setup: true, ansible_userspace_bits: 
 64, ansible_distribution_version:
 .


 Ansible verbose 

 EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 
 'ControlPersist=60s', '-o', 
 'ControlPath=/home/steven/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 
 'StrictHostKeyChecking=no', '-o', 
 'IdentityFile=/home/steven/.ssh/key-user', '-o', 
 'KbdInteractiveAuthentication=no', '-o', 
 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', 
 '-o', 'PasswordAuthentication=no', '-o', 'User=user', '-o', 
 'ConnectTimeout=10', 'ip-10-123', /bin/sh -c 'mkdir -p 
 $HOME/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294  chmod a+rx 
 $HOME/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294  echo 
 $HOME/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294']
 ip-10-123-71-225 PUT /tmp/tmpLdghlG TO 
 /home/user/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294/setup
 ip-10-123-71-225 EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 
 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 
 'ControlPath=/home/steven/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 
 'StrictHostKeyChecking=no', '-o', 
 'IdentityFile=/home/steven/.ssh/key-user', '-o', 
 'KbdInteractiveAuthentication=no', '-o', 
 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', 
 '-o', 'PasswordAuthentication=no', '-o', 'User=user', '-o', 
 'ConnectTimeout=10', 'ip-10-123.', u'/bin/sh -c \'su root -c /bin/sh 
 -c \'\'\'echo SUDO-SUCCESS-dhyqcckwxzuthyzxqniggbjvfxvuewha; 
 LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python 
 /home/adsymp/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294/setup; 
 rm -rf /home/adsymp/.ansible/tmp/ansible-tmp-1412705402.97-194667564226294/ 
 /dev/null 21\'\'\'\'']


 Amazon Linux
 #rpm -q openssh
 openssh-5.3p1-15.12.amzn1.x86_64
 # python --version
 Python 2.6.5

 CentOS:
 $ rpm -q openssh
 openssh-6.4p1.el6-1.x86_64
 $ python --version
 Python 2.6.6

 I am using ansible 1.7.1.

 Please help as this is really strange.  I ran the setup with python -m 
 trace --trace and nothing seems to stand out for causing the issue.

 Thanks,
 Steven.




-- 
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/a677587a-e7ce-42ae-adb0-6a73498ed452%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.