Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What is the cleanest way of doing this? Tried adding the user to the sudo group with the users module but Ansible reports it can't find the sudo group.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Instead of

- name: create a new user
    user: name=user
          state=present
          groups="group1, group2"
          password={{ password }}
          comment="Comment"

I did

- name: create a new user
    user: name=user
          state=present
          group=primary-group
          groups="sudo"
          password={{ password }}
          comment="Comment"

And the user was added to the sudo group.

share|improve this answer
add comment

groups="admin" will create user add in admin groups

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.