{"id":16780577,"url":"https://github.com/monolithprojects/ansible-user_management","last_synced_at":"2025-07-06T14:07:07.978Z","repository":{"id":46202085,"uuid":"223456218","full_name":"MonolithProjects/ansible-user_management","owner":"MonolithProjects","description":"Ansible role for users and ssh keys management on Linux machines","archived":false,"fork":false,"pushed_at":"2021-11-07T15:46:21.000Z","size":40,"stargazers_count":4,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-30T08:51:08.723Z","etag":null,"topics":["management","manager","ssh-key","ssh-keys","user","user-management","users"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/monolithprojects/user_management","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MonolithProjects.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-22T17:48:42.000Z","updated_at":"2025-04-06T16:02:08.000Z","dependencies_parsed_at":"2022-09-25T06:00:54.920Z","dependency_job_id":null,"html_url":"https://github.com/MonolithProjects/ansible-user_management","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/MonolithProjects/ansible-user_management","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonolithProjects%2Fansible-user_management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonolithProjects%2Fansible-user_management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonolithProjects%2Fansible-user_management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonolithProjects%2Fansible-user_management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MonolithProjects","download_url":"https://codeload.github.com/MonolithProjects/ansible-user_management/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonolithProjects%2Fansible-user_management/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263914453,"owners_count":23529078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["management","manager","ssh-key","ssh-keys","user","user-management","users"],"created_at":"2024-10-13T07:35:27.536Z","updated_at":"2025-07-06T14:07:07.955Z","avatar_url":"https://github.com/MonolithProjects.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# User Management\n\n[![Last version](https://img.shields.io/github/v/release/MonolithProjects/ansible-user_management)](https://github.com/MonolithProjects/ansible-user_management)\n[![Galaxy Quality](https://img.shields.io/ansible/quality/44861?style=flat\u0026logo=ansible)](https://galaxy.ansible.com/monolithprojects/user_management)\n[![Galaxy Downloads](https://img.shields.io/ansible/role/d/44861?style=flat\u0026logo=ansible)](https://galaxy.ansible.com/monolithprojects/user_management)\n[![GitHub Actions](https://github.com/MonolithProjects/ansible-user_management/workflows/molecule%20test/badge.svg?branch=master)](https://github.com/MonolithProjects/ansible-user_management/actions)\n\nThis Ansible role is for managing (creating, editing, deleting) Linux users.\nManagement includes also the ssh keys keys distribution.\n\n## How it works\n\nThis role is using local facts on the each host to store the user names listed in `user_management`. Only these users are managed by this role. Once you will remove the user from `user_management` list, the user and the home directory will be deleted from the host. The users not listed in the `user_management` list (users not created by this Ansible Role) will remain untouched.\n\n## This role is able to\n\n- create users\n- delete users\n- edit users\n- manage ssh keys\n\n## Requirements\n\n- Supported Linux distros:\n  - CentOS/RHEL 7,8\n  - Debian 9,10\n  - Fedora 29,30,31,32\n  - Ubuntu 16,18,20\n\n  **Note:** These are the weekley tested Linux distributions. The Role will most likely run also on different Linux distros just fine.\n\n## Role Variables\n\nThis is a copy from `defaults/main.yml`\n\n```yaml\nlocal_facts_file: linux_users.fact\nlocal_facts_path: /etc/ansible/facts.d\nuser_management:\n#   - name: userx                       \u003c\u003c\u003c User name (Required).\n#     comment: User X                   \u003c\u003c\u003c (Optional) User description.\n#     groups:                           \u003c\u003c\u003c (Optional) List of groups user will be added to.\n#       - games\n#       - video\n#     ssh_keys:                         \u003c\u003c\u003c (Optional) List of Authorized public keys.\n#       - 'ssh-ed25519 xxxx something'\n#     shell: /bin/bash                  \u003c\u003c\u003c (Optional) User shell (default value \"/bin/bash\")\n#     expires: -1                       \u003c\u003c\u003c (Optional) User expiration date in Epoch format (default value \"-1\").\n#     create_home: yes                  \u003c\u003c\u003c (Optional) Create home directory (default value \"yes\").\n#     system: no                        \u003c\u003c\u003c (Optional) Create a system account (default value \"no\").\n```\n\n## Playbook example:\n\nIn this example the Ansible will create (or eventually edit - if this is not the first run) 3 users. `user1` with comment, `zsh` as a default shell, user will expire in `1640991600` Unix epoch time, user will be added to user groups `sudo` and `docker`, and finally add two ssh public keys. `user2` will be created with defaults.`appuser` will be created as a system user.\n\n```yaml\n---\n- name: User Management\n  hosts: all\n  user: ubuntu\n  gather_facts: yes\n  become: yes\n  vars:\n  \n    user_management:\n      - name: user1\n        comment: My Test User\n        shell: /bin/zsh\n        expires: 1640991600\n        groups:\n          - sudo\n          - docker\n        ssh_keys:\n          - 'ssh-ed25519 xxxxxx my_user_key'\n          - 'ssh-rsa xxxxxx my_user_key'\n\n      - name: user2\n\n      - name: appuser\n        system: yes\n        create_home: no\n\n  roles:\n      - ansible-user_management\n```\n\n## License\n\nMIT  \n\n## Author Information\n\nCreated in 2020 by Michal Muransky\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonolithprojects%2Fansible-user_management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonolithprojects%2Fansible-user_management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonolithprojects%2Fansible-user_management/lists"}