Re: [ansible-project] Re: Passing arguments to a module

2014-11-12 Thread Tomasz Kontusz
ansible --version should not say 1.7.2 if you are using devel. Make you sure 
you did:
1. source /path/to/repo/hacking/env-setup
2. Clean your shell's binaries location cache (IIRC hash --help should tell you 
how in bash/zsh)

Or just use $(which ansible-playbook) to run your plays :-)

Dane Lipscombe  napisał:
>I am unable to use the 1.8 omit default either
>
>env={{item.container.env|default(omit)}}
>
>One or more undefined variables: 'omit' is undefined
>
>When using the dev version should ansible --version still say 1.7.2?
>
>the 'which ansible' command is pointing to my checkout...
>
>On Tuesday, 11 November 2014 19:16:30 UTC+9, Dane Lipscombe wrote:
>>
>> I would like to pass arguments to the docker module like so:
>>
>> - container:
>> name: 'testa'
>> image: 'testa'
>> - container:
>> name: 'testb'
>> image: 'testb'
>>
>> - name: Start docker containers
>>   docker:
>>   args: "{{item.container}}"
>>   with_items: run_docker_containers
>>
>> But i get the error:
>>
>> ERROR: args must be a dictionary, received {{item.container}} (> 'str'>)
>>
>> I saw that there was a bug here and tried the latest dev version
>still 
>> without success
>> https://github.com/ansible/ansible/issues/8810
>>
>> should the above issue have fixed the problem above?
>>
>
>-- 
>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/81af7f00-e3ce-4a87-8f12-b42e5d352fd3%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Wysłane za pomocą K-9 Mail.

-- 
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/4f1455f0-9595-40a6-940b-2e038d237aa2%40email.android.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Provision with Ansible from inside Docker

2014-11-12 Thread Victor Lin
Hey guys,

I am using Ansible and Docker in a very interesting way, I think it would 
be useful for others, so I wrote an article about it

http://victorlin.me/posts/2014/11/13/provision-with-ansible-from-inside-docker

The very basic idea is to pack all Ansible runtimes/roles/playbooks/plugins 
into a docker image, and then you have a container for provisioning. I 
think this is really powerful, for example, you can run sometime like this:

sudo docker pull ansible-open-stack-swift

and 

sudo docker run -it ansible-open-stack-swift 

then you can provision to either EC2 cluster or local machines, whatever 
you want. You even don't need to install the Ansible runtime on your 
machine. With this idea in mind, not only software can be shipped as a 
container, the software for deployment can also be shipped as a container. 
In the community, we can build many interesting stuff, like Ansible image 
for launching the different clusters.

-- 
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/f7137657-b0c4-474b-9edf-a5692bc05d1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Galaxy role versioning

2014-11-12 Thread Will Thames
Is it possible to request a specific tag/version when installing a role 
from galaxy.ansible.com? 

Obviously there is a workaround of pointing at the github repo and choosing 
a commit id, but I was curious whether the concept of versioning galaxy 
roles exists?

Perhaps there's not much call for it - perhaps roles in galaxy never 
change, or those changes are always backwards-compatible. 

Will

-- 
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/a39224ca-0fa8-471e-95d4-a181453dd12a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Galaxy filter roles by platform

2014-11-12 Thread Will Thames
Would it be possible to add some filters in Ansible Galaxy to browse by OS. 

You have to click through to each role to discover that it's not suitable 
for your platform. 

It needn't be on by default, but it would be a good option.

Will

-- 
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/02b211b2-edec-4adc-bfc0-8f3b31bc8979%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] groupname as variable?

2014-11-12 Thread linbo liao
Thanks.

I want setup multi cluster instance. So in the play I can't specify the 
detailed cluster node groups, what I can do is use variable to cluster node 
groups.

For example,

[idc1_master]
host1  cluster_node=idc1_node

[idc1_node]
host2
host3

[idc2_master]
hosti  cluster_node=idc2_node

[idc2_node]
hostj
hostk


idc1-master requires idc1_node groups, idc2_master requires idc2_node 
groups. If playbook use idc1_node, idc2 cluster will use idc1_node, which 
is not correct.


在 2014年11月12日星期三UTC+8下午9时56分28秒,Brian Coca写道:
>
> I believe this is what you want:
>
> in the inventory:
> [idc1_node]
> 
>
> in the play:
>
> - name: add nodes
>   debug:  msg={{item}}
>   with_items: groups['idc1_node']
>   tags:
>   - add-node
>
>
> -- 
> Brian Coca
>  

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


Re: [ansible-project] copy module ignores --check flag for file params when md5sums are the same -- Not Cool!

2014-11-12 Thread Sean McGowan
i am unable to pull the development branch at work.  if i have a chance i 
will pull it down and test it at home.  it is my hope to get involved with 
this project because i think it is awesome; however, there are still a few 
hurdles (e.g. no real spare time right now :) ).

anyhow... let me know if you want me to put it up as a bug in github.  if 
not, then i will just set a reminder to look at this sometime in the future.

thanks!

On Wednesday, November 12, 2014 10:41:09 AM UTC-5, tkuratomi wrote:
>
> It is a bug.  However, I think there have been several fixes to the 
> file/copy module regarding check mode recently.  For instance: 
> https://github.com/ansible/ansible/issues/8639 
>
> I've just tested a very simple copy module playbook and it incorrectly 
> changed the mode with ansible-1.7.2 but did not set the mode with the 
> code in the ansible devel branch.  So I believe this has been fixed. 
> If you want to confirm with your more complex case you could check out 
> the repository from https://github.com/ansible/ansible and give it a 
> try. 
>
> -Toshio 
>
> On Tue, Nov 11, 2014 at 12:27 PM, Sean McGowan  > wrote: 
> > following up on this... is this a bug or an expected behaviour? 
> > 
> > 
> > On Friday, November 7, 2014 9:43:45 AM UTC-5, Sean McGowan wrote: 
> >> 
> >> 
> >> 
> >> On Friday, November 7, 2014 9:25:43 AM UTC-5, Michael DeHaan wrote: 
> >>> 
> >>> Can you please be explicit about what the "not a very cool behavior" 
> is ? 
> >> 
> >> 
> >> no problem.  what the example below shows is that when using the copy 
> >> module with file parameters (e.g. mode, owner, group) that the --check 
> flag 
> >> works if and only if the src and dest checksums do not match.  When 
> they are 
> >> equal, ansible happily makes the file parameter changes, regardless of 
> >> --check usage.  I updated to 1.7.2 from 1.5 and this behavior did not 
> exist 
> >> before.  In 1.5, if the files were the same and the mode was different 
> (for 
> >> example), ansible would flag it as changed, but not make the change 
> when 
> >> using the --check flag.  This, in my opinion, is the correct and 
> expected 
> >> behavior. 
> >> 
> >> Thanks! 
> >>> 
> >>> 
> >>> I'm having trouble parsing your intent from the above. 
> >>> 
> >>> Thanks! 
> >>> 
> >>> On Thu, Nov 6, 2014 at 4:46 PM, Sean McGowan  
> wrote: 
>  
>  I am using ansible 1.7.2 on RedHat 
>  
>  Note that I am super happy that I was doing something somewhat 
>  innocuous; however, this did just make a large number of changes 
> across 600+ 
>  hosts...  not a very cool behavior...  this did not exist in 1.5, 
> which is 
>  the version from which i upgraded. 
>  
>  thanks in advance... 
>  
>  relevant play: 
>  #  roles/common/tasks/main.yml 
>  --- 
>  - name: Read hosts table variables 
>    include_vars:  "hosts_{{ ansible_distribution }}.yml" 
>    tags: hosts 
>  
>  - name: debug test 
>    debug: msg="Here is my hosts {{ hosts }}" 
>    tags: hosts 
>  
>  - name: Copy hosts table 
>    copy: src={{ hosts }} dest={{ hosts_target }} 
>    owner=root group={{ hosts_group }} mode=0644 
>    tags: hosts 
>  
>  
>  ## roles/common/vars/hosts_Redhat.yml 
>  --- 
>  hosts_target: /etc/hosts 
>  hosts_group: root 
>  
>  ## roles/common/vars/hosts_Solaris.yml 
>  --- 
>  hosts_target: /etc/inet/hosts 
>  hosts_group: sys 
>  
>  
>  ###  Correct configuration ( this is a solaris host ) 
>  [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "ls -ltr 
>  /etc/inet/hosts" 
>  -rw-r--r--   1 root sys  444 Nov  6 21:22 /etc/inet/hosts 
>  
>  [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "digest -a md5 
>  /etc/inet/hosts" 
>  93049f5cbfe5c796b82ff256e4cd5639 
>  [root@padishah1 ansible]# md5sum 
>  roles/common/files/hosts/hosts.swdw43.scs.iwcs.net 
>  93049f5cbfe5c796b82ff256e4cd5639 
>  roles/common/files/hosts/hosts.swdw43.scs.iwcs.net 
>  
>  ansible-playbook sdlw_block1.yml -i west --tags=hosts 
> --limit="swdw43*" 
>  --check 
>  
>    
>  < PLAY [sdlw_block1] > 
>    
>  \   ^__^ 
>   \  (oo)\___ 
>  (__)\   )\/\ 
>  ||w | 
>  || || 
>  
>  
>   _ 
>  < GATHERING FACTS > 
>   - 
>  \   ^__^ 
>   \  (oo)\___ 
>  (__)\   )\/\ 
>  ||w | 
>  || || 
>  
>  
>  ok: [swdw43.scs.iwcs.net] 
>   ___ 
>  < TASK: common | Read hosts table variables > 
>   --- 
>  \   ^__^ 
>   \  (oo)\___ 
> >

Re: [ansible-project] possible to use boto and ec2.py to return instance IDs instead of IP addresses?

2014-11-12 Thread Paul Stivers
Thanks, Wawrzek,

Also I'm seeing this in ec2.py. Makes me hopeful. Newb to Ansible and 
python so will take me a little while to figure out.

https://raw.githubusercontent.com/ansible/ansible/devel/plugins/inventory/ec2.py

def __init__(self):
''' Main execution path '''

# Inventory grouped by instance IDs, tags, security groups, regions,
# and availability zones
self.inventory = self._empty_inventory()

# Index of hostname (address) to instance ID
self.index = {}


Paul


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


Re: [ansible-project] msg: Failed to lock apt for exclusive operation

2014-11-12 Thread Greg Andrews
When I get that error, it's usually because Ansible didn't try to sudo to
the root user, or Ansible's attempt to sudo was not successful.

Does invoking lots of verbose messages with the - option to the
ansible-playbook command show a successful sudo?

  -Greg

On Wed, Nov 12, 2014 at 3:38 AM,  wrote:

> Hi folks.
>
> I try to run such yaml using *ansible 1.8 *via Web-UI Tower:
> ---
> - name: setup steps that are not specific to a particular role or project
>   hosts: all
>   sudo: True
>   user: rnd
>   gather_facts: True
>
>   tasks:
>
> - name: update apt cache
>   apt:
> update_cache: yes
>
> - name: ensure required base packages are present
>   apt:
> pkg: "{{ item }}"
> state: latest
> update_cache: yes
> cache_valid_time: 600
>   with_items:
> - chrony
> - python-mysqldb
> - python-software-properties
>
>
> And have such result:
> SSH password:
> sudo password [defaults to SSH password]:
> PLAY [setup steps that are not specific to a particular role or project]
>  ** GATHERING FACTS
> ***
>  ok:
>  [172.20.6.85] TASK: [update apt cache]
> **
>
> failed: [172.20.6.85] => {"failed": true}
>
> *msg: Failed to lock apt for exclusive operation*
>
> FATAL: all hosts have already failed -- aborting
> PLAY RECAP
> 
> to retry, use: --limit @/var/lib/awx/openstack.yaml.retry 172.20.6.85 : ok
> =1 changed=0 unreachable=0 failed=1
>
> Could you please suggest me how to solve this problem.
>
> 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/ab84f2b8-545d-47db-9aa9-b6f79820843a%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/CAPdwyX4RfCHGtYe%3DJ_K_djnPeUgkqJFAcxAu96VDPuaLw1eRmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] howto use multiple environments with multiple groups?

2014-11-12 Thread Tristan van Bokkem
Hi,

As explained 
here 
http://docs.ansible.com/intro_inventory.html#splitting-out-host-and-group-specific-data
 
we are using multiple environments (acceptance / production) with 
ansible-playbooks and have set it up as follow:

deploy.yml
inventory
|_ inventory-production
|_inventory-acceptance
group_vars/
|_ acceptance/group1
|_ acceptance/group2
|_ production/group1
|_ production/group2
host_vars/
|_ host1.accept
|_ host2.accept
|_ host1.prod
|_ host2.prod
...

We have for instance some iptables vars defined in group1 and group2. Each 
specific for their group of hosts.
Now when we run the ansible playbook deploy.yml together with the 
inventory-production inventory it soon start to work on a host in group1. 
It will run the tasks for the iptables role and the taks will need vars 
from the group_vars directory. However it seems it is using the vars that 
has been combined of both groups and it will use the vars which are 
alphabetical last. Which in this case is group2. So it is using the wrong 
vars.

Any idea why this is going wrong?

-- 
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/b25c4dd2-04dd-4779-848e-f1482ec77214%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Using group module; "Failed to find required executable groupadd"

2014-11-12 Thread Joshua Burke
Hello All, 

I found that the problem was my use of the "-c local" flag in my CLI 
invocation of the playbook.
Additionally I upgraded from Ansible version 1.7.1 to version 1.7.2

Originally the command that failed was:

*ansible-playbook -v -c local -i localhost someplaybook.yml*

After changing the command to 
*ansible-playbook -v -i localhost someplaybook.yml*

The playbook ran as expected.

Just wanted to post a solution for everyone, in case of future similar 
problems.

On Tuesday, November 11, 2014 2:40:59 PM UTC-5, Joshua Burke wrote:
>
> Hello, 
>
> While attempting to provision a Digital Ocean virtual server my playbook 
> needs to create two groups:
>   - sudousers
>   - sshusers
>
> Creation of the virtual server is successful however creating the groups 
> fails with the message:
>
>> msg: Failed to find required executable groupadd
>
>
> The OS is Ubuntu 14.04 LTS, freshly provisioned. 
>
> Sending the which groupadd command after SSH to the server yeilds:
> > which groupadd 
>  /usr/sbin/groupadd
>
> Sending the command groupadd results in a help page, so the executable is 
> definitely there. 
>
> Ansible versions:
>   - ansible 1.7.1
>   - ansible-playbook 1.7.1
>
> Any ideas what I may be doing wrong here?
>

-- 
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/b9f9a4d7-168c-405d-83fc-d44271c4226c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Three questions regarding asynchronous jobs

2014-11-12 Thread Ingmar Schlecht
Hi there,

just three short questions regarding async jobs.

1.) How can I check the async_status of a "fire and forget" job on all my 
servers at once? So instead of checking a specific server's job id 
115503716196.18657 (mind the dot) I would like to basically check 
115503716196.*, which doesn't work. Also just "115503716196" doesn't work.

2.)  Is there a way to kill "fire and forget" async jobs?

3.) Is there some sort of garbage collection being done for the 
~/.ansible_async/ directory or does that grow forever?

Here's a bit more explanation regarding just my first question, how I can 
check the async_status of a job on all my servers at once:

Say I'm executing an async job like that:

ansible all -B 90 -P 0 -a "sleep 80"

I get a confirmation of successful start like this:

background launch...

ip_srv1 | success >> {
"ansible_job_id": "115503716196.18657",
"results_file": "/home/ubuntu/.ansible_async/115503716196.18657",
"started": 1
}

ip_srv2 | success >> {
"ansible_job_id": "115503716196.6532",
"results_file": "/home/ubuntu/.ansible_async/115503716196.6532",
"started": 1
}


Now, is there a way to check the status of the job on all servers at once?

I tried the obvious choice first and did:

ansible all -m async_status -a "jid=115503716196"

However, this just results in:

ip_srv1 | FAILED >> {
"ansible_job_id": "115503716196",
"failed": true,
"msg": "could not find job"
}

ip_srv2 | FAILED >> {
"ansible_job_id": "115503716196",
"failed": true,
"msg": "could not find job"
}

Only if I do:

ansible all -m async_status -a "jid=115503716196.18657"

I get what I want - but of course only for the server of which I typed in 
the concret job id.


54.171.202.93 | success >> {
"ansible_job_id": "115503716196.18657",
"changed": false,
"results_file": "/home/ubuntu/.ansible_async/115503716196.18657",
"started": 1
}

54.72.229.37 | FAILED >> {
"ansible_job_id": "115503716196.18657",
"failed": true,
"msg": "could not find job"
}

Cheers
Ingmar


-- 
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/c9921296-7411-4ae3-b078-95897c287a73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Velocity Barcelona

2014-11-12 Thread Mark Phillips
Hello Folks,

We are a sponsor at Velocity Barcelona next week - so if you're going along, 
come say hello to us. It'll be me manning the booth. 

I think we'll have some goodies too :)

--Mark

-- 
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/2a3ce488-bb4f-4eeb-80a2-6e58e38eeab8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] msg: Failed to lock apt for exclusive operation

2014-11-12 Thread nataliia . mazur
Hi folks.

I try to run such yaml using *ansible 1.8 *via Web-UI Tower:
---
- name: setup steps that are not specific to a particular role or project
  hosts: all
  sudo: True
  user: rnd
  gather_facts: True

  tasks:

- name: update apt cache
  apt:
update_cache: yes

- name: ensure required base packages are present
  apt:
pkg: "{{ item }}"
state: latest
update_cache: yes
cache_valid_time: 600
  with_items:
- chrony
- python-mysqldb
- python-software-properties


And have such result:
SSH password: 
sudo password [defaults to SSH password]:
PLAY [setup steps that are not specific to a particular role or project]
 ** GATHERING FACTS 
***
 ok:
 [172.20.6.85] TASK: [update apt cache] 
**

failed: [172.20.6.85] => {"failed": true} 

*msg: Failed to lock apt for exclusive operation*

FATAL: all hosts have already failed -- aborting 
PLAY RECAP 
 
to retry, use: --limit @/var/lib/awx/openstack.yaml.retry 172.20.6.85 : ok=1 
changed=0 unreachable=0 failed=1 

Could you please suggest me how to solve this problem.

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/ab84f2b8-545d-47db-9aa9-b6f79820843a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Using group module; "Failed to find required executable groupadd"

2014-11-12 Thread Joshua Burke
Hello, 

While attempting to provision a Digital Ocean virtual server my playbook 
needs to create two groups:
  - sudousers
  - sshusers

Creation of the virtual server is successful however creating the groups 
fails with the message:

> msg: Failed to find required executable groupadd


The OS is Ubuntu 14.04 LTS, freshly provisioned. 

Sending the which groupadd command after SSH to the server yeilds:
> which groupadd 
 /usr/sbin/groupadd

Sending the command groupadd results in a help page, so the executable is 
definitely there. 

Ansible versions:
  - ansible 1.7.1
  - ansible-playbook 1.7.1

Any ideas what I may be doing wrong here?

-- 
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/ca1f579b-8d0f-48c3-8bac-5b5b2fcd96ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible and continuous integration

2014-11-12 Thread Thomas Clauwaert


I'm wondering if anyone here, has ever had some experience (or has a setup) 
with continuous integration and/with ansible.


There has been a lot of discussion on how usefull testing would be (with 
ansible) and while I am pretty interested in this I'm actually more curious 
how and which tests (acceptance, unit, (maybe others?)) u all do on your 
infrastructures. This way I want to look what the community actually does 
to go from a testing environment to production.


I am really researching to have a fluid pipeline where it would be possible 
to have 1 automatisation, i.e a clean CI setup with ansible.

Any hints, tools or experiences would be very much appreciated.


Thx in advance!

-- 
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/d0d690c5-e106-472b-8aca-415e14bba254%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] template error

2014-11-12 Thread simonq
I get* template error while templating string: unexpected '.' *when running 
this task using ansible 1.8 (devel fa953e162e). Used to work with previous 
version I was running (1d04e4b3d2). Any thoughts?

- name: Get image id
  command: >
docker inspect -f '{% raw %}{{ .Image }}{% endraw %}' nginx
  register: container_image

- name: Do something with image
  command: echo {{ container_image.stdout }}

-- 
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/54a84789-542a-4a09-92b5-d1baa7fdb979%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] msg: Failed to lock apt for exclusive operation

2014-11-12 Thread natalja mazur
Hi.

I try to run yaml via Web-UI Tower using ansible 1.8:

---
- name: setup steps that are not specific to a particular role or project
  hosts: all
  sudo: True
  user: rnd
  gather_facts: True

  tasks:

- name: update apt cache
  apt:
update_cache: yes



SSH password:
sudo password [defaults to SSH password]:
PLAY [setup steps that are not specific to a particular role or project]
 ** GATHERING FACTS 
*** 
ok:
 [172.20.6.85] TASK: [ensure required base packages are present] 
* 
failed: [172.20.6.85] => 
(item=chrony,python-mysqldb,python-software-properties) => {"failed": true, 
"item": "chrony,python-mysqldb,python-software-properties"}
 msg: Failed to lock apt for exclusive operation
FATAL: all hosts have already failed -- aborting 
PLAY RECAP 
 to 
retry,
use: --limit @/var/lib/awx/openstack.yaml.retry 172.20.6.85 : ok=1 
changed=0 unreachable=0 failed=1 

What is the problem?

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/aaa3053f-41b7-4aea-99aa-cba022fbf098%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Accessing extra-vars inside playbook

2014-11-12 Thread Kenny Garland
I would like to access the string values used at runtime from the 
ansible-playbook -e argument. In this case the user passes in 
"public_subnet" which renders to the value subnet-12345678 from group_vars. 
I would like to take actions based on the string value "public_subnet"

playbook.yml

vpc_subnet_id: "{{ subnet }}"
assign_public_ip: "{% if subnet == public_subnet %}True{% endif %}"



group_vars/dev

public_subnet: subnet-12345678


command line
ansible-playbook -i inventory/local playbook.yml -v -e 
"subnet=public_subnet"


-- 
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/d4852b95-1e16-4a1c-a8c1-f24d1d4568c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] copy module ignores --check flag for file params when md5sums are the same -- Not Cool!

2014-11-12 Thread Toshio Kuratomi
It is a bug.  However, I think there have been several fixes to the
file/copy module regarding check mode recently.  For instance:
https://github.com/ansible/ansible/issues/8639

I've just tested a very simple copy module playbook and it incorrectly
changed the mode with ansible-1.7.2 but did not set the mode with the
code in the ansible devel branch.  So I believe this has been fixed.
If you want to confirm with your more complex case you could check out
the repository from https://github.com/ansible/ansible and give it a
try.

-Toshio

On Tue, Nov 11, 2014 at 12:27 PM, Sean McGowan  wrote:
> following up on this... is this a bug or an expected behaviour?
>
>
> On Friday, November 7, 2014 9:43:45 AM UTC-5, Sean McGowan wrote:
>>
>>
>>
>> On Friday, November 7, 2014 9:25:43 AM UTC-5, Michael DeHaan wrote:
>>>
>>> Can you please be explicit about what the "not a very cool behavior" is ?
>>
>>
>> no problem.  what the example below shows is that when using the copy
>> module with file parameters (e.g. mode, owner, group) that the --check flag
>> works if and only if the src and dest checksums do not match.  When they are
>> equal, ansible happily makes the file parameter changes, regardless of
>> --check usage.  I updated to 1.7.2 from 1.5 and this behavior did not exist
>> before.  In 1.5, if the files were the same and the mode was different (for
>> example), ansible would flag it as changed, but not make the change when
>> using the --check flag.  This, in my opinion, is the correct and expected
>> behavior.
>>
>> Thanks!
>>>
>>>
>>> I'm having trouble parsing your intent from the above.
>>>
>>> Thanks!
>>>
>>> On Thu, Nov 6, 2014 at 4:46 PM, Sean McGowan  wrote:

 I am using ansible 1.7.2 on RedHat

 Note that I am super happy that I was doing something somewhat
 innocuous; however, this did just make a large number of changes across 
 600+
 hosts...  not a very cool behavior...  this did not exist in 1.5, which is
 the version from which i upgraded.

 thanks in advance...

 relevant play:
 #  roles/common/tasks/main.yml
 ---
 - name: Read hosts table variables
   include_vars:  "hosts_{{ ansible_distribution }}.yml"
   tags: hosts

 - name: debug test
   debug: msg="Here is my hosts {{ hosts }}"
   tags: hosts

 - name: Copy hosts table
   copy: src={{ hosts }} dest={{ hosts_target }}
   owner=root group={{ hosts_group }} mode=0644
   tags: hosts


 ## roles/common/vars/hosts_Redhat.yml
 ---
 hosts_target: /etc/hosts
 hosts_group: root

 ## roles/common/vars/hosts_Solaris.yml
 ---
 hosts_target: /etc/inet/hosts
 hosts_group: sys


 ###  Correct configuration ( this is a solaris host )
 [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "ls -ltr
 /etc/inet/hosts"
 -rw-r--r--   1 root sys  444 Nov  6 21:22 /etc/inet/hosts

 [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "digest -a md5
 /etc/inet/hosts"
 93049f5cbfe5c796b82ff256e4cd5639
 [root@padishah1 ansible]# md5sum
 roles/common/files/hosts/hosts.swdw43.scs.iwcs.net
 93049f5cbfe5c796b82ff256e4cd5639
 roles/common/files/hosts/hosts.swdw43.scs.iwcs.net

 ansible-playbook sdlw_block1.yml -i west --tags=hosts --limit="swdw43*"
 --check

  
 < PLAY [sdlw_block1] >
  
 \   ^__^
  \  (oo)\___
 (__)\   )\/\
 ||w |
 || ||


  _
 < GATHERING FACTS >
  -
 \   ^__^
  \  (oo)\___
 (__)\   )\/\
 ||w |
 || ||


 ok: [swdw43.scs.iwcs.net]
  ___
 < TASK: common | Read hosts table variables >
  ---
 \   ^__^
  \  (oo)\___
 (__)\   )\/\
 ||w |
 || ||


 ok: [swdw43.scs.iwcs.net]
  ___
 < TASK: common | debug test >
  ---
 \   ^__^
  \  (oo)\___
 (__)\   )\/\
 ||w |
 || ||


 ok: [swdw43.scs.iwcs.net] => {
 "msg": "Here is my hosts hosts/hosts.swdw43.scs.iwcs.net"
 }
  _
 < TASK: common | Copy hosts table >
  -
 \   ^__^
  \  (oo)\___
 (__)\   )\/\
 ||w |
 || ||


 ok: [swdw43.scs.iwcs.net]
  
 < PLAY RECAP >
  
 \   ^__^
 

Re: [ansible-project] Re: Add stdout and stdout_lines to the results registered by the yum module

2014-11-12 Thread Brian Coca
Actually the yum module output is more consistent with what you would
expect registering a var using with_items. Both modules use a special
optimization in which they slurp the whole list instead of executing it one
at a time.

Also I think you are comparing outputs on different operations. In any case
a quick workaround is to add .split() to the yum output to get the same
output as stdout_lines.


-- 
Brian Coca

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


Re: [ansible-project] groupname as variable?

2014-11-12 Thread Brian Coca
I believe this is what you want:

in the inventory:
[idc1_node]


in the play:

- name: add nodes
  debug:  msg={{item}}
  with_items: groups['idc1_node']
  tags:
  - add-node


-- 
Brian Coca

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


Re: [ansible-project] groupname as variable?

2014-11-12 Thread linbo liao
Yes, want to add all nodes from cluster-node group to cluster.

在 2014年11月10日星期一UTC+8下午9时34分53秒,Brian Coca写道:
>
> The variable there is defined for a host, not a group, also avoid using 
> dashes (-) in variable names.
>
> It is not clear what you are trying to do here, do you want to add all 
> hosts of a cluster? just the master nodes?
>
>
> ​
>

-- 
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/192d47ab-27f6-4a00-813c-992ba92662ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Add stdout and stdout_lines to the results registered by the yum module

2014-11-12 Thread Sankalp Khare


Hi Brian,

I am concerned with ansible-playbook, and so I'll restrict my observations 
to the context of playbook executions only.

I examined the source code and there is a marked difference in the way the 
apt and yum modules deal with the outputs captured from their respective 
actions. The difference is in what is passed to the  exit_json() call which 
passes information back to playbook.

   1. apt.py sends stdout in a key called stdout and stderr in a key called 
   stderr
   2. yum.py, on the other hand, puts stdout into a results key and stderr 
   into the msg key

playbook/__init__.py contains instructions to split anything returned as 
stdout into lines, and put that into stdout_lines, which is what we want.

Therefore I feel that the yum module is behaving in a non-standard way here 
and its information returning style must be revised to make it more aligned 
with what the apt module does. If this seems like the right course of 
action, I can work on the yum module code and submit a PR.

Awaiting your comments/suggestions.

Regards,
Sankalp

On Tuesday, 11 November 2014 07:25:12 UTC-6, Brian Coca wrote:
>
> open a feature request on github for the ansible-modules-core project, 
> this should not be hard to add
>
> On Mon, Nov 10, 2014 at 9:21 PM, Sankalp Khare  > wrote:
>
> In comparison, here is the output of the apt module, with the stdout_lines 
> field that I find readable:
>
> TASK: [apt upgrade=dist] 
> **
>
> changed: [ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com]
>
>
> TASK: [debug var=apt_out] 
> *
>
> ok: [ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com] => {
>
> "apt_out": {
>
> "changed": true,
>
> "invocation": {
>
> "module_args": "upgrade=dist",
>
> "module_name": "apt"
>
> },
>
> "msg": "Reading package lists...\nBuilding dependency 
> tree...\nReading state information...\nThe following NEW packages will be 
> installed:\n  linux-headers-3.13.0-39 linux-headers-3.13.0-39-generic\n 
>  linux-image-3.13.0-39-generic\nThe following packages will be upgraded:\n 
>  accountsservice apport apt apt-transport-https apt-utils base-files 
> bsdutils\n  byobu cloud-init curl dbus dpkg file gcc-4.9-base 
> gir1.2-glib-2.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/95b4a868-2c51-471a-9f65-89c4a1ae1689%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.