# User Management Ansible Role
Add/remove user dynamically

- Create a JSON file that includes the variables

Example: 

File: `/var/tmp/user.json`

```
{
   "community": {
      "experimenter": [
         {
            "username": "jdoe",
            "name": "John Doe,,,,jdoe@email.com",
            "shell": "/sbin/nologin",
            "groups": "",
            "state": "present",
            "remove": "yes",
            "force": "yes",
            "create_home": "yes",
            "fabric_role": "regular",
            "ssh_key": [
               {
                  "key": "ssh-rsa   gburdell@fabric",
                  "state": "present",
               },
               {
                  "key": "ssh-rsa   gburdell@gatech",
                  "state": "absent",
               }
            ]
         }
      ]
   }
}

```

- Adding and removing user accounts is controlled by setting `state` to `present` or `absent`. This includes
manipulating both /etc/passwd and /etc/group
- Adding and removing keys is controlled by setting `state` in `ssh_key` to `present` or `absent`
- `name` can be just full name, however preferred to be formatted as a GECOS field

- Execute ansible task
```
ansible-playbook site.yml --tags "user-experimenter-dynamic" --extra-vars "@/tmp/user.json"
```
