{"id":21976863,"url":"https://github.com/stuartapp/ansible-ssh-authorized-keys","last_synced_at":"2026-04-28T21:03:38.448Z","repository":{"id":86222056,"uuid":"149762750","full_name":"StuartApp/ansible-ssh-authorized-keys","owner":"StuartApp","description":"Ansible role to manage authorized SSH keys in a server/image/instance","archived":false,"fork":false,"pushed_at":"2018-09-25T15:58:11.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":54,"default_branch":"master","last_synced_at":"2025-01-28T03:30:45.652Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StuartApp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-09-21T12:49:54.000Z","updated_at":"2018-09-25T15:58:05.000Z","dependencies_parsed_at":"2023-03-12T17:30:54.608Z","dependency_job_id":null,"html_url":"https://github.com/StuartApp/ansible-ssh-authorized-keys","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Fansible-ssh-authorized-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Fansible-ssh-authorized-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Fansible-ssh-authorized-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Fansible-ssh-authorized-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StuartApp","download_url":"https://codeload.github.com/StuartApp/ansible-ssh-authorized-keys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245037435,"owners_count":20550870,"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-29T16:12:30.238Z","updated_at":"2026-04-28T21:03:33.398Z","avatar_url":"https://github.com/StuartApp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stuart SSH authorized keys role\n\n## Usage example:\n\n```\nssh_authorized_keys_users:\n  username1:\n    - ssh-rsa key1 comment1\n    - ssh-rsa key2 comment2\n  username2:\n    - ssh-rsa key3 comment3\n    - ssh-rsa key4 comment4\n```\n\n**WARNING**: *more than 1 level of nested groups won't work*\n\n```\nssh_authorized_keys_groups:\n  groupname1:\n    - username1\n    - username2\n  groupname2:\n    - username3\n    - groupname1\n```\n\n```\nssh_authorized_keys:\n  \u003cusername\u003e:\n    path: \u003cpath of the authotized_keys file\u003e # optional\n    manage_dir: \u003ctrue|false\u003e # optional, defaults to ssh_authorized_keys_manage_dir\n    exclusive: \u003ctrue|false\u003e # optional, defaults to ssh_authorized_keys_exclusive\n    auth_keys:\n      - groupname1\n      - username3\n```\n\nThere is also `ssh_authorized_keys_default`. This has the same structure as `ssh_authorized_keys`, and both are always `deepmerge`d\n\n## `deepmerge` filter\n\nThis role also adds a new filter named `deepmerge` which does what `combine` does but it also\nmerges lists inside dictionaries. Example:\n\n```\ndict1:\n  a:\n    ab:\n      - 1\n      - 2\n\ndict2:\n  a:\n    ab:\n      - 3\n  b:\n    ba:\n      - 1\n```\n\nWhen using combine like this `dict1 | combine(dict2)` we get:\n\n```\na:\n  ab:\n    - 3\nb:\n  ba:\n    - 1\n```\n\nSo the list in `ab` is overwritten. `deepmerge` *fixes* this. Running this `dict1 | deepmerge(dict2)` we get:\n\n```\na:\n  ab:\n    - 1\n    - 2\n    - 3\nb:\n  ba:\n    - 1\n```\n\nNow `ab` has a list with all elements of both lists appended.\n\n`deepmerge` filter can be use anywhere **if** the *ssh_authorized_keys* role is loaded. For variables it is evaluated after the role is included, for other roles, these have to be called *after* *ssh_authorized_keys*.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuartapp%2Fansible-ssh-authorized-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstuartapp%2Fansible-ssh-authorized-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuartapp%2Fansible-ssh-authorized-keys/lists"}