{"id":24402027,"url":"https://github.com/alimehraji/ansible-role-users","last_synced_at":"2025-04-23T02:11:44.710Z","repository":{"id":268444630,"uuid":"902260317","full_name":"AliMehraji/ansible-role-users","owner":"AliMehraji","description":"Ansible role for managing users and groups in both RedHat and Debian Based Linux distibutions","archived":false,"fork":false,"pushed_at":"2025-03-17T11:35:48.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T02:11:37.311Z","etag":null,"topics":["ansible-role","debian","group-management","linux","redhat","user-management"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AliMehraji.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-12T08:15:34.000Z","updated_at":"2025-03-17T11:35:52.000Z","dependencies_parsed_at":"2024-12-16T20:34:07.238Z","dependency_job_id":"907ea7fc-f753-4b88-9ab4-b4ca85beb854","html_url":"https://github.com/AliMehraji/ansible-role-users","commit_stats":null,"previous_names":["alimehraji/ansible-role-users"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliMehraji%2Fansible-role-users","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliMehraji%2Fansible-role-users/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliMehraji%2Fansible-role-users/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliMehraji%2Fansible-role-users/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AliMehraji","download_url":"https://codeload.github.com/AliMehraji/ansible-role-users/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250354512,"owners_count":21416751,"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":["ansible-role","debian","group-management","linux","redhat","user-management"],"created_at":"2025-01-20T00:58:13.000Z","updated_at":"2025-04-23T02:11:44.697Z","avatar_url":"https://github.com/AliMehraji.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Users\n\nAnsible role for managing users and groups on Linux hosts.\n\n## Requirements\n\n- install requirements\n\n  ```bash\n  pip3 install -r requirements.txt\n  ```\n\n- [community.posix](https://galaxy.ansible.com/ui/repo/published/ansible/posix/) ansible collection\n- install `ansible collection` requirements\n\n  ```bash\n  ansible-galaxy install -r requirements.yml\n  ```\n\n## Role Variables\n\n### users_groups\n\nCreate and manage user groups on target hosts.\n\nWhen a group is removed from this variable, the associated group on the hosts will be deleted.\n\nEach entry in the users_groups list can contain the following keys:\n\n- `name`: The name of the group to create or manage. **Required**.\n- `gid`: The group ID number. If not specified, the system assigns the next available GID.\n- `system`: Specifies whether the group is a system group. Default: `false`.\n- `local`: Forces the use of \"local\" command alternatives on platforms that implement it. Default: `false`\n- `state`: state of group, \"present\" group creation, \"absent\" group deletion. . Default: `present`\n\n### users_users\n\nCreate and manage users on target hosts.\n\nWhen a user is removed from this variable, the associated user on the hosts will be deleted.\n\nEach entry in the users_users list can contain the following keys:\n\n**Note**:\n\u003e When adding a user to an additional group or granting `sudo` privileges, ensure that the `append` option is set to `true` (which is the default). If you do not want to append the user to additional group or assign `sudo` rights, set append to `false`.\u003c/br\u003e\n\u003e Using append: `false` will remove the user from all other groups, which might lead to loss of necessary permissions or access. Ensure this is the intended behavior before applying.\n\n- `name`: The username of the account to create or manage. **Required**.\n- `password`: The encrypted user password.\n- `update_password`: Specifies when to update the password. Can be `always` or `on_create`.\n- `shell`: The user's login shell. Default: `/bin/bash`.\n- `uid`: The user ID number. If not specified, the system assigns the next available UID.\n- `comment`: The GECOS field.\n- `home`: Path to the user's home directory.\n- `create_home`: Create the home directory if it doesn't exist.\n- `expires`: Account expiration date in epoch. Can be removed by specifying a `-1`.\n- `group`: User's primary group name.\n- `groups`: List of additional groups the user belongs to.\n- `sudoer`: Make user sudoer. Default: `false`.\n- `append`: Whether to append to the groups list or replace it. Default: `false`.\n- `non_unique`: Allow duplicate UIDs. Default: `false`.\n- `system`: Create a system account. Default: `false`.\n- `local`: Forces the use of \"local\" command alternatives on platforms that implement it. Default: `false`.\n- `state`: state of user, \"present\" user creation, \"absent\" user deletion. . Default: `present`\n- `ssh_key`: SSH public key to add to authorized_keys. Can be multiline.\n- `ssh_key_options`: SSH options for the key.\n- `ssh_comment`: A comment for the SSH key.\n- `ssh_exclusive`: Remove all other keys from the authorized_keys file.\n\n### users_remove_home\n\nDefines whether the home directory will be deleted when the user is deleted. Default: `false`.\n\n### users_remove_force_user\n\nForced deletion of a user, associated directories and groups. Default: `false`.\n\n### users_remove_force_group\n\nForced deletion of a group. Default: `false`.\n\n## Example Playbook\n\n```yaml\n- hosts: all\n  vars:\n    users_groups:\n      - name: old-developers\n        state: absent\n      - name: developers\n        gid: 5001\n      - name: old-admins\n        state: absent\n      - name: admins\n        gid: 599\n        system: true\n    users_users:\n      - name: alice\n        password: 'Secret123'\n        shell: /bin/zsh\n        group: users\n        groups: developers\n        sudoer: true\n        append: true\n        update_password: on_create\n        ssh_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIADg2n4v733gUH/dC4PZyQlvpFdjQyF8thJwe4mfn8qm alice@example.com\n        ssh_key_options: no-port-forwarding,no-agent-forwarding\n      - name: bob\n        groups: admins,developers\n        ssh_key: |\n          ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDdv1ycIBDsz5tavDqyaG9qRFYcvOzRteOy534MvHDy7BHu/\n          ikIOnuUAqT8axjrOxfkosheqTL9wTFIZWRxQJFKgFC7Z8BMAvq1SeU/InPBGJZHBy5LlKz7ZJiH32R1vNjJd4\n          T51EXXr9FgdzjPFc4KkgMuMHFXqP/n7CF7MpNO461YernikpCxU4pmDSfEFFR2bsJkA3BH3EMT0TfhfEFeTlX\n          +xNPUNGj5kbpoaz43lDTzNNflGHDoR8CcnSMTYNuHQAozecyg6gVsEpavPtvATKBj7rdbHpqhhvBRsA058FunJ\n          0exTYyrxP9+z+gu1CErN1UT3vItDI25Ays6PsQxcC2WjBghxaF3MmRClM63xilvw/7km38X8nK03b/+cy3NwyZC\n          7/FteW9mPs1wzkSp65Y+dkRLDofAsJASe1qK7M1/uq1fbCzb2USV7R4HgtYvyx8v14iScCCEKhu0Djm+HLrRq9\n          Sc1l8IfjTkRsV2pCJe5QiA8PRp+iNBmc1gwDs=\n        ssh_comment: bob@example.com\n      - name: rachael\n        state: absent\n  roles:\n    - users\n```\n\n## License\n\n[MIT](LICENSE)\n\n## Author Information\n\nCreated and maintained by Ali Mehraji \u003ca.mehraji75@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falimehraji%2Fansible-role-users","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falimehraji%2Fansible-role-users","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falimehraji%2Fansible-role-users/lists"}