{"id":20330997,"url":"https://github.com/cans/user-make","last_synced_at":"2026-04-20T14:36:05.282Z","repository":{"id":139898555,"uuid":"89170255","full_name":"cans/user-make","owner":"cans","description":"Ansible role to create a bunch of users on target hosts","archived":false,"fork":false,"pushed_at":"2019-08-24T08:15:05.000Z","size":47,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T15:24:18.270Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cans.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.rst","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":"2017-04-23T20:26:35.000Z","updated_at":"2019-08-24T07:41:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"a6efaa84-c712-4981-9211-1c04d280d93d","html_url":"https://github.com/cans/user-make","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cans%2Fuser-make","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cans%2Fuser-make/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cans%2Fuser-make/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cans%2Fuser-make/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cans","download_url":"https://codeload.github.com/cans/user-make/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241845806,"owners_count":20029936,"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":[],"created_at":"2024-11-14T20:18:25.952Z","updated_at":"2025-12-01T16:01:30.962Z","avatar_url":"https://github.com/cans.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"cans.user-make\n==============\n\n[![Build Status](https://travis-ci.org/cans/user-make.svg?branch=master)](https://travis-ci.org/cans/user-make)\n[![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-cans.user--make-blue.svg?style=flat-square)](https://galaxy.ansible.com/cans/user-make)\n[![License](https://img.shields.io/badge/license-GPLv2-brightgreen.svg?style=flat-square)](LICENSE)\n\nAnsible role to create a bunch of users on target hosts\n\n\n### How does it work ?\n\nEach user to create has to be defined with an item as follows:\n\n```yaml\nusermake_users:\n  - name: \"johndoe\"                # mandatory\n    gecos: \"John Doe,,,\"           # default: omit\n    groups: \"sudo,adm\"             # default: omit\n    passwordless_sudo: true        # default: usermake_sudoer_passwordless\n    ssh_key_create: false          # default: true\n    ssh_key_upload_to_ec2: true    # default: usermake_ssh_key_upload_to_ec2\n    ssh_key_download: true         # default: usermake_ssh_key_download\n    suoder: true                   # default: usermake_sudoer\n    system: false                  # default: false\n    upload_my_key: false           # default: usermake_upload_ssh_key_to_target\n    remove: false                  # default: omit or usermake_remove\n    home_dir: \"/home/jdoe\"         # default: usermake_home_base_dir/name\n```\n\nHere is the meaning of each varbiable found in the item:\n\n- `name`: the login name to give to the new user;\n- `gecos`: then [GECOS](https://en.wikipedia.org/wiki/Gecos_field) data\n  to attach to the new user;\n- `groups`: the list of groups the user should belong to. Groups listed\n  here are supposed to exist *a priori* (cf. also the [next section](#cannotdo))\n- `passwordless_sudo`:  when set to `true` the user will be allowed to assume\n  other user identy without typing in any password;\n- `remove`: when the item *state* value is *'absent'* tells whether to\n  remove the files owned by the user when its account is deleted (can be slow);\n- `ssh_key_create`: whether to generate a SSH key pair for the new user;\n- `ssh_key_download`: whether to download the user's generated SSH\n  public key to a folder on the local machine (see also the\n  `usermake_ssh_key_download_dir` defined below).\n- `ssh_key_upload_to_ec2`: whether to upload the user's generated SSH\n  public key to AWS EC2 key management system.\n- `remove`\n- `state`: whether to create ) or delete () the user indicated with the\n  values *'present'* or *'absent'* respectively (default: *'present'*);\n- `sudoer`: if set to true the user will gain sudo privileges (see also\n  the `usermake_sudoer` variable);\n- `system`: whether the user should be a system user (w. a low UID\n  number and disabled login);\n- `upload_my_key`: whether to upload your local ssh key to the target\n  host.\n\nAll these values, if defined, will override the default define in the\n[role variables](#role-variables) section below.\n\n\n### What this role cannot do ? \u003ca name=\"cannotdo\"\u003e\u003c/a\u003e\n\nIt cannot append users to new groups, it will override the user's groups\nwith the given list of group(s).\n\n\nRequirements\n------------\n\nThis role has no specific requirement.\n\n\nRole Variables \u003ca name=\"role-variables\"\u003e\u003c/a\u003e\n--------------\n\nAll the variable names used in this role are namespaced with the prefix\n`usermake_`.\n\n- `usermake_home_base_dir`: let's you override the path of the directory\n  where users home are created (default: `/home`);\n- `usermake_remove`: whether to remove users home directory when they\n  are deleted (default: *false*);\n- `usermake_ssh_key_create`: whether to create an ssh key pair for the\n  new users by default (default: *true*);\n- `usermake_ssh_key_download`: whether to download created users' ssh\n  keys locally;\n- `usermake_ssh_key_download_dir`: the directory where to store downloaded\n  public SSH keys (default: *`{{ playbook_dir }}/collected-keys`*);\n- `usermake_ssh_key_download_dir_mode`: the mode of the directory where\n  to store downloaded public SSH keys (default: *0750*);\n- `usermake_ssh_key_passphrase`: the default passphrases to encrypt ssh\n  private keys. It is not recommanded to rely on this. You should provide\n  passphrases by other means. (default: `omit` [no passphrase]);\n- `usermake_sudoer`: whether the created users should be sudoers by\n  default (default: *false*);\n  Note: before granting elevated privileges to any user with this,\n  consider distros provide a sudo package that defines a `sudo` or\n  `sudoers` group that already grants some privileges to its members.\n  The present mecanism is more intended for pre-setting high privilege\n  user on disk images to enable easy setup and provisioning. Not to\n  manage fine grain user or application privileges;\n- `usermake_sudoer_dir`: directory on the target machines in which place\n  the sudoer rule files (default: `/etc/sudoers.d`)\n- `usermake_system`: whether the created users should be system users\n  by default (default: *false*);\n- `usermake_upload_ssh_key_to_target`: whether to upload the local user's\n  SSH public key to the target host. Useful if you plan to perform tasks\n  as that user in the next tasks or roles of your playbook (default: *true*);\n- `usermake_upload_ssh_key_file`: when `usermake_upload_ssh_key_to_target`\n  or a user's item `upload_my_key` value is `true`, points to the file where\n  read the public key to upload (default: `~/.ssh/id_rsa.pub`);\n- `usermake_user_groups`: the groups to assign the created users to by\n  default (default: `omit`);\n- `usermake_users`: the list of users to create, defined with items as\n  described above (default: `[]`);\n\n\nDependencies\n------------\n\nThis role has no dependency\n\n\nExample Playbook\n----------------\n\nCreating some users:\n\n\n```yaml\n- hosts: servers\n  roles:\n     - role: cans.user-make\n       usermake_users:\n         - name: \"alice\"\n           groups: \"sudo,adm\"\n           system: \"no\"\n           ssh_key_create: \"yes\"\n         - name: \"bob\"\n           gecos: \"Bob no sponge,,,\"\n           system: \"yes\"\n           ssh_key_create: true\n```\n\nDeleting some users:\n\n```yaml\n- hosts: servers\n  roles:\n    - role: cans.user-make\n      usermake_users:\n        - name: \"alice\"\n          state: \"absent\"\n          remove: true  # Remove all users files\n        - name: \"bob\"\n          state: \"absent\"\n```\n\nYou might also want to have a look at the tests found in\n`tests/test.yml` for many more (hopefully exhaustive) usage\nexamples of this role.\n\n\nTodo\n----\n\nImplement integration testing for AWS key upload.\n\n\nLicense\n-------\n\nGPLv2\n\n\nAuthor Information\n------------------\n\nCopyright © 2017, Nicolas CANIART.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcans%2Fuser-make","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcans%2Fuser-make","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcans%2Fuser-make/lists"}