Re: [ansible-project] Creating subgroup of ec2 dynamic inventory

2014-05-11 Thread Igor Cicimov
Thanks Michael your suggestions noted. I did some more testing and looks like only one single instance, assuming the last instance, from the inventory is being added to the group, and this is without any conditions. Very simple playbook example: --- - hosts: ec2 gather_facts: False connect

[ansible-project] Re: variable names of variables holding environment variables :)

2014-05-11 Thread Mikhail Koshelev
It depends on context of your actual task. Adding top-level hash will do if you can put definitions for all *_var data in a single unit. For multiple units (f.e. per-role definitions) you may try to set "hash_behaviour=merge" in ansible.cfg, though this is generally not recommended. - hosts: lo

[ansible-project] Re: Complex data types with nested lists

2014-05-11 Thread Strahinja Kustudić
If you specify user SSH keys as a list of keys, you can use them like this using *with_subelements*: - name: User SSH keys authorized_key: user="{{ item.0.username }}" key="{{ item.1 }}" when: item.0.username in users_add with_subelements: - users - ssh_key This works for me without a probl

Re: [ansible-project] Complex data types with nested lists

2014-05-11 Thread Strahinja Kustudić
If you specify user SSH keys as a list of keys, you can user them like this using with_subelements: - name: User SSH keys authorized_key: user="{{ item.0.username }}" key="{{ item.1 }}" when: item.0.username in users_add with_subelements: - users - ssh_key This works for me without a probl

Re: [ansible-project] Reusing roles with different configuration files

2014-05-11 Thread Strahinja Kustudić
When I think about it, I would probably go with something like that with the combination what Maciej suggested. On Sunday, May 11, 2014 3:02:27 PM UTC+2, Brian Coca wrote: > > You can add the multiple config files to the role and chose the correct > one based on a single parameter > > Brian Coca

Re: [ansible-project] Variable interpolation in task name

2014-05-11 Thread Strahinja Kustudić
I see what you are saying. Since the tasks run in parallel for multiple servers and if servers have different values for the same variable in the inventory, or host_vars, Ansible wouldn't know how to name that task. Makes sense. On Sunday, May 11, 2014 3:04:14 PM UTC+2, Brian Coca wrote: > > Th

Re: [ansible-project] Variable interpolation in task name

2014-05-11 Thread Brian Coca
The problem with "any variable" is that hosts share the task name, that is the main reason inventory variables don't work 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 fro

Re: [ansible-project] Reusing roles with different configuration files

2014-05-11 Thread Brian Coca
You can add the multiple config files to the role and chose the correct one based on a single parameter 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 emai

Re: [ansible-project] Variable interpolation in task name

2014-05-11 Thread Strahinja Kustudić
But, this should be possible to implement into Ansible? I would also like to use any variable which works in a task, to work in the task name. If you don't have anything against this, I would like to create an issue on github, maybe someone takes it and implements it. On Friday, May 9, 2014 9:1

Re: [ansible-project] Reusing roles with different configuration files

2014-05-11 Thread Strahinja Kustudić
Thanks for the suggestions how to solve this problem. Maciej's solution is great, since you don't have to modify a role nor create a new one, you just pass different variables and you are good to go, but the problem I have with that solution is that it makes it harder to read what you configure