Creating group and user

44 views
Skip to first unread message

Wojciech Pietrzak

unread,
Apr 18, 2014, 8:53:14 AM4/18/14
to ansible...@googlegroups.com
Hi,

I'm trying to create a "www" group and a "web" user who should be a member of this "www" group.

---
- name: create group for deloyment and web
 group:
   state=present
   name=web
   system=yes
- name: create user for deployment and web
 user:
   state=present
   name=web
   group=www
   home=/home/web
   createhome=yes
   generate_ssh_key=yes
   ssh_key_bits=4096
   ssh_key_type=rsa
   ssh_key_comment="web user"

I got a error message, group www doesn't exists, but it is present on the host when I ssh into the box after running this code.

Here is the error message:

PLAY [webservers] *************************************************************
GATHERING FACTS ***************************************************************
ok: [web.vagrant.box]
TASK: [deployment | create group for deloyment and web] ***********************
ok: [web.vagrant.box]
TASK: [deployment | create user for deployment and web] ***********************
failed: [web.vagrant.box] => {"failed": true, "item": ""}
msg: Group www does not exist
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
          to retry, use: --limit @/Users/wopi/webserver.retry
web.vagrant.box            : ok=2    changed=0    unreachable=0    failed=1

What is the cause ?

Regards,
Wojciech

Adam Morris

unread,
Apr 18, 2014, 12:22:56 PM4/18/14
to ansible...@googlegroups.com
Are sure?  What you show creates a "web" group and a "web" user who is a member of the "www" group.

I would expect the error message that a www group doesn't exist.

Adam
Reply all
Reply to author
Forward
0 new messages