{"id":20947826,"url":"https://github.com/alphahydrae/ansible-ssh-key","last_synced_at":"2026-03-17T23:03:28.429Z","repository":{"id":66264870,"uuid":"61547474","full_name":"AlphaHydrae/ansible-ssh-key","owner":"AlphaHydrae","description":"Ansible role that generates an SSH key for a user.","archived":false,"fork":false,"pushed_at":"2024-09-21T22:15:51.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-13T04:42:54.392Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/AlphaHydrae.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":"2016-06-20T12:52:45.000Z","updated_at":"2024-09-21T22:15:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"b228768f-496a-44d6-9f93-d6233c2960de","html_url":"https://github.com/AlphaHydrae/ansible-ssh-key","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/AlphaHydrae/ansible-ssh-key","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fansible-ssh-key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fansible-ssh-key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fansible-ssh-key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fansible-ssh-key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlphaHydrae","download_url":"https://codeload.github.com/AlphaHydrae/ansible-ssh-key/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fansible-ssh-key/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30635093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T22:38:22.569Z","status":"ssl_error","status_checked_at":"2026-03-17T22:38:11.804Z","response_time":56,"last_error":"SSL_read: 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-19T00:13:24.128Z","updated_at":"2026-03-17T23:03:28.392Z","avatar_url":"https://github.com/AlphaHydrae.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible SSH Key\n\n[Ansible](https://www.ansible.com) role that generates an SSH key for a user.\n\nSetting the `ssh_key_root_link` to `true` will also symlink the key into the root user's .ssh directory.\n\n\n\n## Role Variables\n\n**SSH key properties**\n\n* `ssh_key_user` (or `user`) - **required** - The user for which to generate an SSH key (defaults to the value of the `user` variable).\n* `ssh_key_bits` `[integer]` - The number of bits in the generated key (defaults to 8192).\n* `ssh_key_comment` - The comment at the end of the SSH key block (defaults to `{{ ssh_key_user }}@{{ ansible_hostname }}`, e.g. `jdoe@mycomputer`).\n\n**Non-root user's SSH key location**\n\n* `ssh_key_dir` - The .ssh directory where the key will be generated (defaults to `{{ host_user_homes }}/{{ ssh_key_user }}/.ssh`, where `host_user_homes` is provided by the AlphaHydrae.multipass role).\n* `ssh_key_file` - The location of the SSH key file (defaults to `{{ ssh_key_dir }}/id_rsa`).\n\n**Root user's SSH key location**\n\n* `ssh_key_root_dir` - The .ssh directory of the root user (defaults to `{{ host_root_home }}/.ssh`; the `host_root_home` variable is provided by the AlphaHydrae.multipass role).\n* `ssh_key_root_file` - The location of the root user's SSH key file (defaults to `{{ ssh_key_root_dir }}/id_rsa`).\n\n**Root symlink variables**\n\n* `ssh_key_root_link` `[boolean]` - Whether to symlink the generated key into the root user's .ssh directory (defaults to `false`; has no effect if `ssh_key_user` is the root user).\n\n\n\n## Dependencies\n\nThe [AlphaHydrae.multipass](https://github.com/AlphaHydrae/ansible-multipass) role is used to determine the base directory where user home directories are located.\nThe role sets the following facts to reasonable defaults depending on the target host's platform:\n\n* `host_root_user` - The username of the root user (e.g. `root`).\n* `host_root_group` - The group of the root user (e.g. `root`).\n* `host_root_home` - The home directory of the root user (e.g. `/root`).\n* `host_user_homes` - The base directory where user home directories are located (e.g. `/home` on Linux or `/Users` on OS X).\n\n\n\n## Example Playbook\n\n    - hosts: servers\n      roles:\n        - role: AlphaHydrae.ssh-key\n          ssh_key_user: jdoe\n\n**Custom SSH key properties**\n\n    - hosts: servers\n      roles:\n        - role: AlphaHydrae.ssh-key\n          ssh_key_user: jdoe\n          ssh_key_bits: 2048\n          ssh_key_comment: my-key\n\n**With a default user defined (e.g. at the playbook level)**\n\n    - hosts: servers\n      vars:\n        user: jdoe\n      roles:\n        - role: AlphaHydrae.ssh-key\n\n**Symlink the key into the root user's .ssh directory**\n\n    - hosts: servers\n      roles:\n        - role: AlphaHydrae.ssh-key\n          ssh_key_user: jdoe\n          ssh_key_root_link: true\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphahydrae%2Fansible-ssh-key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falphahydrae%2Fansible-ssh-key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphahydrae%2Fansible-ssh-key/lists"}