What is correct syntax for user module?

1,909 views
Skip to first unread message

Dave Thacker

unread,
Aug 21, 2014, 5:52:40 PM8/21/14
to ansible...@googlegroups.com
Hello!
Beginner here.  My goal is to use a simple play book to create a new user.    I found this example in the modules pages at ansible.com
# Add the user 'johnd' with a specific uid and a primary group of 'admin'
- user: name=johnd comment="John Doe" uid=1040 group=admin
I used that example and tried this:
---
- hosts: dev
  sudo: yes

  - name: create oracle user
- user: name=oracle uid=500 group=oinstall description=Oracle Service Account home=/u01/home/oracle
I got this error : ERROR: 'action' or 'local_action' attribute missing in task "create oracle user"
My second playbook iteration looked like this:

---
- hosts: dev
  sudo
: yes

  tasks
:
#  - name: create oinstall group
#    action: group name=oinstall gid=501

 
- name: create oracle user
    action
: user name=oracle uid=500 group=oinstall description=Oracle Service Account home=/u01/home/oracle
And I got this error:
PLAY [dev] ********************************************************************

GATHERING FACTS
***************************************************************
ok
: [10.53.153.81]

TASK
: [create oracle user] ****************************************************
failed
: [10.53.153.81] => {"failed": true}
msg
: this module requires key=value arguments (['name=oracle', 'uid=500', 'group=oinstall', 'description=Oracle', 'Service', 'Account', 'home=/u01/home/oracle'])

FATAL
: all hosts have already failed -- aborting

Do the key=value pairs need to be enclosed in a different way. Which syntax is correct?
THanks in advance
Dave






Matt Silverlock

unread,
Aug 21, 2014, 8:06:09 PM8/21/14
to ansible...@googlegroups.com
description="Oracle Service Account"
You need to wrap this in quotes - because otherwise it sees "description=Oracle" and then two keys without values (Service, and Account).
Reply all
Reply to author
Forward
0 new messages