"and it only works for me with the $ in front of accounts_to_add"
Are you sure you are running 1.5? (see ansible --version?) I use list variables without a prefix all of the time and it's fine. with_items: imalist etc On Sat, Dec 7, 2013 at 9:17 PM, BrianAI <[email protected]> wrote: > Thanks for the follow up Pete! > > I have not gotten a chance to check any further into this, especially > since it's working with the $$ and not throwing warnings, I've moved ahead > with this solution until I can upgrade / it starts warning. > > However it's interesting that your 1.5 version still functions the same as > my 1.3.x version. > > > > > On Wednesday, December 4, 2013 2:32:26 PM UTC-5, Pete Emerson wrote: >> >> I just followed this example with: >> >> ansible 1.5 (devel 7aa35d64c2) last updated 2013/12/04 19:15:46 (GMT +000) >> >> and it only works for me with the $ in front of accounts_to_add. >> >> GATHERING FACTS ****************************** >> ********************************* >> ok: [ubuntu-01] >> >> TASK: [Add group {{item.name}}] ****************************** >> ***************** >> fatal: [ubuntu-01] => One or more undefined variables: 'unicode object' >> has no attribute 'name' >> >> On Saturday, November 30, 2013 5:02:45 AM UTC-8, Michael DeHaan wrote: >>> >>> "* 11 with_items: $accounts_to_add"* >>> >>> *Legacy variable usage, which 1.4 will rightfully warn you about. >>> Correct:* >>> >>> *with_items: accounts_to_add* >>> >>> >>> On Fri, Nov 29, 2013 at 11:03 PM, BrianAI <[email protected]> wrote: >>> >>>> OK, I got it working, but would still like to see if someone could view >>>> and see if it's the "right" way of doing it. Since I'm still learning, I'd >>>> like to learn the proper way of doing it (I'm assuming this has something >>>> to do with roles? >>>> >>>> >>>> 1) users.yaml >>>> >>>> >>>> *$ cat /etc/ansible/users.yaml * >>>>> *all_users:* >>>>> >>>>> * - user1* >>>>> >>>>> * - user2* >>>>> >>>>> * - user3** - user4* >>>>> * - user5* >>>>> * - user6* >>>>> >>>>> *Ops:* >>>>> >>>>> * - user1* >>>>> >>>>> * - user2* >>>>> >>>>> * - user3** - user4* >>>>> >>>> >>>>> >>>> *databaseTeam:* >>>>> * - user5* >>>>> * - user6* >>>>> >>>> >>>> 2) add_users.yaml >>>> >>>> * 1 ---* >>>>> * 2 - hosts: all* >>>>> * 3 vars_files:* >>>>> * 4 - /etc/ansible/users.yaml* >>>>> >>>>> * 5 tasks:* >>>>> * 6 - name: Create user.* >>>>> * 7 user: home=/home/{{ item }} name={{ item }} shell=/bin/bash >>>>> state=present* >>>>> * 8 with_items: $accounts_to_add* >>>>> * 9 - name: copy per-user ssh key (authorized_keys2) to the >>>>> destination server* >>>>> * 10 action: copy src=/usr/share/ansible/files/ssh/{{ item >>>>> }}/authorized_keys2 dest=/home/{{ item }}/.ssh/authorized_keys2 mode=755* >>>>> * 11 with_items: $accounts_to_add* >>>>> >>>> >>>> 3) xyz_boxes.yaml >>>> >>>> * 1 ---* >>>>> * 2 #NTP* >>>>> * 3 - include: ntp.yaml* >>>>> * 4 * >>>>> * 5 #USERS* >>>>> * 6 - include: add_users.yaml accounts_to_add=databaseTeam* >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> 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 [email protected]. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> >>> >>> -- >>> Michael DeHaan <[email protected]> >>> CTO, AnsibleWorks, Inc. >>> http://www.ansibleworks.com/ >>> >>> -- > 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 [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- Michael DeHaan <[email protected]> CTO, AnsibleWorks, Inc. http://www.ansibleworks.com/ -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
