See also "with_items" ...
On Thu, May 15, 2014 at 6:35 PM, James Cammarata <[email protected]>wrote: > You cannot specify multiple user entries under the one name. You need to > modify it to do the following: > > - name: add user1 > user: ... > - name: add user2 > user: ... > etc. > > > > On Thu, May 15, 2014 at 10:18 AM, <[email protected]> wrote: > >> I am using ansible 1.5.5. The server/clients are centos 6.5 and RHEL 6.5 >> >> >> On Wednesday, May 14, 2014 6:20:15 PM UTC-4, Michael DeHaan wrote: >> >>> What OS are you targetting and what ansible version are you using? >>> >>> >>> >>> >>> On Wed, May 14, 2014 at 4:15 PM, <[email protected]> wrote: >>> >>>> ok I have been working with the user module for the last week. I >>>> really want to like ansible because it does not have any additional client >>>> requirements except ssh. The problem I am having is that I am getting >>>> inconsistent results when using the user module. >>>> >>>> I add in the user to the play, and most of the time if I add a new user >>>> it will create it, but if I change the comment, or password, or shell or >>>> anything like that it is very unpredictable if it actually works, but it >>>> most likely will not work and will just give me the >>>> : ok=2 changed=0 unreachable=0 failed=0 >>>> for all servers after a change was made to a play. >>>> >>>> Example play file >>>> >>>> --- >>>> - hosts: serverone:servertwo >>>> sudo: yes >>>> tasks: >>>> - name: add local user >>>> user: name=newguy comment="first last" uid=2222 group=users >>>> home=/home/newguy shell=/bin/bash password=$6$rounds=40000$ >>>> SkYFjKIU7FhnFu2B$jGUr0hLkBeIB5Oi6kZyEcos3mwT78DfsW9LhDdd14Kx/T/VzYyyyyy >>>> state=absent update_password=always force=yes >>>> user: name=testtwo comment="test guy" uid=5002 group=users >>>> home=/home/testtwo shell=/bin/bash password=$6$rounds=40000$ >>>> 3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/ >>>> 0tVCESX0IhdHUCuxQba2MUPwQLrqFUaKIfhkXsFqB13l0. state=present >>>> update_password=always force=yes >>>> user: name=testthree comment="test guy" uid=5003 group=users >>>> home=/home/testthree shell=/bin/bash password=$6$rounds=40000$ >>>> 3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/ >>>> 0tVCESX0IhdH4xjQbua72jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present >>>> update_password=always force=yes >>>> user: name=testfour comment="test guy" uid=5004 group=users >>>> home=/home/testfour shell=/bin/bash password=$6$rounds=40000$ >>>> 3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/ >>>> 0tVCESX0IhdH4emCuxQua2jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present >>>> update_password=always force=yes >>>> user: name=testfive comment="test guy" uid=5005 group=users >>>> home=/home/testfive shell=/bin/bash password=$6$rounds=40000$ >>>> 3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/ >>>> 0tVCESX0IhdH4eu72jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present >>>> update_password=always force=yes >>>> user: name=testsix comment="test what" uid=5006 group=users >>>> home=/home/testsix shell=/bin/bash password=$6$rounds=40000$ >>>> 3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/ >>>> 0tVCESX0IhdH4emUa72jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present >>>> update_password=always force=yes >>>> user: name=testseven comment="test seven" uid=5007 group=users >>>> home=/home/testseven shell=/bin/bash password=$6$rounds=40000$ >>>> 3K4vP/lTWYvxKbLd$./c2g.TaXfyJsDPBCVMGWP/0tVCESX0IhdH4emU8CQbua72jMHUsPGwQLrqFUaKIfhkXsFqB13l0. >>>> state=present update_password=always force=yes >>>> >>>> Am I missing something, because according to the user doc the only >>>> field that is a requirement is "name" so ansible should be keying off that >>>> field, and all other fields should be able to change. >>>> >>>> I have tried removing all test* accounts from the systems and then run >>>> the play and one of two of the seven accounts are actually added back. >>>> >>>> -- >>>> 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]. >>>> To post to this group, send email to [email protected]. >>>> >>>> To view this discussion on the web visit https://groups.google.com/d/ >>>> msgid/ansible-project/389bff9d-6b58-4ee1-8adf- >>>> 0270f027bc5e%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/389bff9d-6b58-4ee1-8adf-0270f027bc5e%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> 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 [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/72e1de94-9d9a-4d83-ade5-0bf94ca84d62%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/72e1de94-9d9a-4d83-ade5-0bf94ca84d62%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAMFyvFgVYQ9k5j_kcQzt69e-WcSGsc8Z9vFaj05hezx-OQWKPA%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAMFyvFgVYQ9k5j_kcQzt69e-WcSGsc8Z9vFaj05hezx-OQWKPA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyecFrxBxbT6Q6U8B9Aitc-CzpQgPQJbKUnFQb_BW_6xw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
