Creating group and user

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

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