Re: [ansible-project] loops and variables

2014-05-23 Thread Makimoto Marakatti
> A host can be in lots of groups, so you shouldn't rely on the group_names variable to tell you what you are looping over. Well that was why I was using "my_groups". I do have a lot of groups in the inventory... Your suggestion seems to be like something that could work. I'll try to adapt tha

Re: [ansible-project] loops and variables

2014-05-23 Thread Michael DeHaan
You could make a backup role and do something like this: - hosts: group1 roles: - { role: backup, path: 'group1' } - hosts: group2 roles: - { role: backup, path: 'group2' } A host can be in lots of groups, so you shouldn't rely on the group_names variable to tell you what you are l

Re: [ansible-project] loops and variables

2014-05-23 Thread Michael DeHaan
Or make a group that contains those groups as children, so it's cleaner :) On Thu, May 22, 2014 at 11:51 AM, Brian Coca wrote: > you can try just rewriting my_groups this way: > > my_groups: "0dm-sap:dev-sap:tst-sap:pre-sap:pro-sap" > > -- > You received this message because you are subscrib

Re: [ansible-project] loops and variables

2014-05-23 Thread Brian Coca
yeah, didn't realize you were reusing it for the task also, my 'fix' would work only for hosts: entry.​ -- 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 ansibl

Re: [ansible-project] loops and variables

2014-05-23 Thread Makimoto Marakatti
Brian: Unfortunately that yields this: changed: [hostA] => {"changed": true, "dest": "/backup/ *0dm-sap:dev-sap:tst-sap:pre-sap:pro-sap/hostA/hostA*/root/.bash_profile", "md5sum": "bab947e752b87add49020919a078", "remote_md5sum": "bab947e752b87add49020919a078"} I also failed to make this

Re: [ansible-project] loops and variables

2014-05-22 Thread Brian Coca
you can try just rewriting my_groups this way: my_groups: "0dm-sap:dev-sap:tst-sap:pre-sap:pro-sap" -- 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-p

Re: [ansible-project] loops and variables

2014-05-22 Thread Makimoto Marakatti
Well it does work... but for the 'wrong' groups. Let me explain: There's another layer of groups in the inventory to define in which datacentre a particular host is. So in a group like dev-group1 we might have 2 machines in datacentre-A and other 2 hosts in datacentre-B. In this case I'm not int

Re: [ansible-project] loops and variables

2014-05-22 Thread Makimoto Marakatti
Thanks for the insightful answer. I'm definitely going to try this and will write here how it goes On Thursday, 22 May 2014 13:04:59 UTC, ams wrote: > > At 2014-05-22 05:21:35 -0700, maki...@gmail.com wrote: > > > > So I made an attempt to loop over each group: > > I'm sorry, my earlier answe

Re: [ansible-project] loops and variables

2014-05-22 Thread Abhijit Menon-Sen
At 2014-05-22 05:21:35 -0700, makim...@gmail.com wrote: > > So I made an attempt to loop over each group: I'm sorry, my earlier answer was short-sighted. I started thinking about loops because your Subject said "loop", but you were right to not use an Ansible loop in the first place—at least not o

[ansible-project] loops and variables

2014-05-22 Thread Makimoto Marakatti
Hi all Could someone lend me a hand to figure looping over variables? I've got a number of hosts which are grouped in the inventory quite strictly in a rather traditional way: dev-group1 hostA hostB tst-group1 hostC hostD pre-group1 hostE hostF pro-group1 hostG hostH dev-group2