{"id":20696645,"url":"https://github.com/maxvalue/ansible-role-usersetup","last_synced_at":"2026-02-19T15:03:17.664Z","repository":{"id":158437982,"uuid":"634039676","full_name":"MaxValue/ansible-role-usersetup","owner":"MaxValue","description":"An Ansible Role that sets up my user account (and optional additional accounts) on Linux.","archived":false,"fork":false,"pushed_at":"2023-05-08T23:15:22.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T02:34:28.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/ui/standalone/roles/MaxValue/usersetup/","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/MaxValue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-04-28T22:00:57.000Z","updated_at":"2023-10-11T12:53:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"ee4910ae-0f2c-417c-8b7e-8e903980b68c","html_url":"https://github.com/MaxValue/ansible-role-usersetup","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MaxValue/ansible-role-usersetup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxValue%2Fansible-role-usersetup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxValue%2Fansible-role-usersetup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxValue%2Fansible-role-usersetup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxValue%2Fansible-role-usersetup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaxValue","download_url":"https://codeload.github.com/MaxValue/ansible-role-usersetup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxValue%2Fansible-role-usersetup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29619153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T13:04:20.082Z","status":"ssl_error","status_checked_at":"2026-02-19T13:03:33.775Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-17T00:14:41.538Z","updated_at":"2026-02-19T15:03:17.633Z","avatar_url":"https://github.com/MaxValue.png","language":null,"funding_links":["https://www.buymeacoffee.com/publicbetamax","https://de.liberapay.com/maxvalue/","https://ko-fi.com/publicbetamax"],"categories":[],"sub_categories":[],"readme":"# Ansible Role: Usersetup\n\nAn Ansible Role that sets up my user account (and optional additional accounts) on Linux.\n\n[TOC]\n\n## Requirements\n\n* [Python `passlib[bcrypt]` module](https://pypi.org/project/passlib/)\n\n## Role Variables\n\nAvailable variables are listed below, along with default values (see `defaults/main.yml`):\n\n### Main Variables\n\n    usersetup_packages:\n      - zsh\n\nThe optional variable `usersetup_packages` defines a list of packages which will be installed before configuring the users.\n\n    usersetup_factsdir: \"hostfacts\"\n\nThe optional variable `usersetup_factsdir` defines the path root on the ansible controller in which to store the facts for the created users,\nat the moment this is only the passwords.\n\n---\n\n    usersetup_users: []\n\nThe optional variable `usersetup_users` defines the list of users to be created or removed.\nThe possible keys for each user are as follows:\n\n        state: present\n\nThe `state` key is optional and defaults to 'present'. Set it to 'absent' to remove the user account with the given name.\n\n        name\n\nThe `name` key is mandatory.\n\n        group\n\nThe `group` key is optional and defaults to the value of the `name` key.\n\n        groups: []\n\nThe `groups` key is optional and defaults to an empty list.\n\n        password\n\nThe `password` key is optional and defines the password to be set for that user account.\nIf no password is given, a random one is generated.\nThe password will be stored beneath the path defined via `usersetup_factsdir` on the ansible controller.\n\n        keys: []\n\nThe `keys` key is optional and defaults to an empty list. Each item accepts the same values as the `key` parameter of the ansible.posix.authorized_key module.\n\n        exclusivekeys: false\n\nThe `exclusivekeys` key is optional and defaults to `false`. It follows the same behavior as the `exclusive` parameter of the ansible.posix.authorized_key module.\n\n        shell: /bin/zsh\n\nThe `shell` key is optional and defaults to '/bin/zsh', hence the 'zsh' which is installed beforehand.\nIt controls which shell will be set for that user.\n\n        ohmyzsh: false\n\nThe `ohmyzsh` key is optional and defaults to `false`. It controls whether Oh-My-ZSH will be installed for that user.\nThis only applies if the `shell` key is set to '/bin/zsh'.\n\n        comment\n\nThe `ohmyzsh` key is optional and will be omitted by default. It controls the GECOS field of the user account.\n(Follows the same rules as the `comment` parameter of the ansible.builtin.user module)\n\n---\n\n    usersetup_max:\n      name: max\n      groups:\n        - sudo\n      keys:\n        - https://gitlab.com/MaxValue.keys\n      appendkeys: false\n      ohmyzsh: true\n      comment: User for Max Fuxjäger\n\nThe optional variable `usersetup_max` defines the settings for my user. If you don't want to create this user, set this variable to an empty dictionary.\n\n    usersetup_nolog: true\n\nThe optional variable `usersetup_nolog` sets whether to log sensitive information or not.\n\n### Internal variables\n\nThese are variables internally created by the role. Please do not use them in your code.\n\n    _hostfactsdir: \"{{ usersetup_factsdir+'/'+inventory_hostname }}\"\n\nThe internal variable `_hostfactsdir` sets the actual path where the facts files will be stored.\n\n    _usersetup_users\n\nThe internal variable `_usersetup_users` defines the complete list of defined users.\nThese include the users which will be created/configured as well as the users which will be removed.\n\n    _usersetup_users_add\n\nThe internal variable `_usersetup_users_add` contains the list of users which will be added/configured.\n\n    _usersetup_users_add_pw\n\nThe internal variable `_usersetup_users_add_pw` contains the list of users which will be added/configured but every user entry is ensured to have a password configured.\n\n    _result_users_create\n\nThe internal variable `_result_users_create` contains the result of the user creation task and is used to find the home directory of each user later on.\n\n    _usersetup_users_remove\n\nThe internal variable `_usersetup_users_remove` contains the list of users which will be removed.\n\n## Dependencies\n\n* The community.general collection: `ansible-galaxy collection install --force community.general`\n\n## Example Playbooks\n\n### Normal usage\n\n    ---\n    # This creates the default set of users\n    - hosts: localhost\n      roles:\n        - maxvalue.usersetup\n    ...\n\n### Add only own users\n\n    ---\n    # This creates only your own custom defined users\n    - hosts: localhost\n      roles:\n        - role:\n            name: maxvalue.usersetup\n          vars:\n            usersetup_max:\n            usersetup_users:\n              - name: bob\n                groups:\n                  - sudo\n    ...\n\n## License\n\n[MIT](LICENSE.txt)\n\n## Sponsors\n\nYou can support the development of this role and other similar roles by donating to one of the accounts below.\n\n* [bymeacoffee](https://www.buymeacoffee.com/publicbetamax)\n* [liberapay](https://de.liberapay.com/maxvalue/)\n* [ko-fi](https://ko-fi.com/publicbetamax)\n* [Patreon](patreon.com/publicbetamax)\n\n## Author Information\n\nThis role was created in 2022 by Max Fuxjäger:\n* Mastodon: [@maxvalue@chaos.social](https://chaos.social/@maxvalue)\n* Matrix: @ypsilon:matrix.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxvalue%2Fansible-role-usersetup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxvalue%2Fansible-role-usersetup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxvalue%2Fansible-role-usersetup/lists"}