{"id":19704650,"url":"https://github.com/luckylittle/ansible-role-create-user","last_synced_at":"2026-05-15T09:11:01.827Z","repository":{"id":109044844,"uuid":"516263490","full_name":"luckylittle/ansible-role-create-user","owner":"luckylittle","description":"ansible-role-create-user","archived":false,"fork":false,"pushed_at":"2022-10-12T06:42:05.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-10T12:02:31.806Z","etag":null,"topics":["ansible","ansible-role","create-user","passwordless","passwordless-ssh","public-key","rhel","ssh","sudo","sudoers","user"],"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/luckylittle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"luckylittle","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-07-21T07:08:17.000Z","updated_at":"2022-07-27T04:35:52.000Z","dependencies_parsed_at":"2023-03-31T19:42:59.438Z","dependency_job_id":null,"html_url":"https://github.com/luckylittle/ansible-role-create-user","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckylittle%2Fansible-role-create-user","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckylittle%2Fansible-role-create-user/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckylittle%2Fansible-role-create-user/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckylittle%2Fansible-role-create-user/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luckylittle","download_url":"https://codeload.github.com/luckylittle/ansible-role-create-user/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241020181,"owners_count":19895381,"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","ansible-role","create-user","passwordless","passwordless-ssh","public-key","rhel","ssh","sudo","sudoers","user"],"created_at":"2024-11-11T21:23:49.251Z","updated_at":"2026-05-15T09:11:01.770Z","avatar_url":"https://github.com/luckylittle.png","language":null,"funding_links":["https://github.com/sponsors/luckylittle"],"categories":[],"sub_categories":[],"readme":"ansible-role-create-user\n=========\n\nAdds user to a brand new RHEL system for use with Ansible. It automatically creates a local user with defined password and also distributes the SSH public key of the user who runs this role (it assumes `~/.ssh/id_rsa.pub`).\n\nRequirements\n------------\n\n* It is expected, that you have a brand new RHEL system and have `root` access. In order for this role to be able to work, the following changes need to be made first:\n\n```bash\n# Log in as root and run. This role will revert this back at the end, so don't worry:\nsed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config\nsystemctl reload sshd\nexit\n\n# Copy SSH key from your workstation to your root user on target host\nssh-copy-id root@host\n\n# Test if Ansible ping works now without a password\nansible seedbox -m ping -i host, -u root\n```\n\nRole Variables\n--------------\n\n`defaults/main.yml`:\n\n* `add_user` - defines the user to be added, default is `redhat`\n* `add_user_passwd` - defines the password of the newly created user, default is `r3dh4t`\n\nDependencies\n------------\n\nNone\n\nExample Playbook\n----------------\n\nIncluding an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:\n\n```yaml\n---\n- hosts: seedbox\n  remote_user: root\n  vars:\n    add_user: seedbox\n    add_user_passwd: supersecretpassword\n  roles:\n    - ansible-role-create-user\n```\n\nThen run:\n\n```bash\necho 'password1' \u003e password\n```\n\n```bash\nansible-playbook -i inventory --vault-password-file=password site.yml\n```\n\nAnother example of the same:\n\n```bash\nansible-playbook -i 192.168.1.1, -e add_user=seedbox -e add_user_passwd=supersecretpassword site.yml\n```\n\nLicense\n-------\n\nMIT\n\nAuthor Information\n------------------\n\nLucian Maly \u003c\u003clmaly@redhat.com\u003e\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckylittle%2Fansible-role-create-user","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluckylittle%2Fansible-role-create-user","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckylittle%2Fansible-role-create-user/lists"}