This commit is contained in:
Mike McFetridge
2026-07-20 09:23:17 -04:00
parent c1315882da
commit 72272e4006
3179 changed files with 562960 additions and 14 deletions
@@ -0,0 +1,24 @@
---
- name: Add SSH authorized keys
hosts: all
become: true
tasks:
- name: Install SSH public key
ansible.posix.authorized_key:
user: "<< target_user >>"
state: present
key: "<< ssh_public_key >>"
manage_dir: true
<%- if configure_passwordless_sudo %>
- name: Enable passwordless sudo for the sudo group
ansible.builtin.copy:
dest: /etc/sudoers.d/90-sudo-nopasswd
content: |
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
owner: root
group: root
mode: "0440"
validate: /usr/sbin/visudo -cf %s
<%- endif %>
@@ -0,0 +1,55 @@
{
"slug": "ubuntu-add-sshkey",
"kind": "ansible",
"metadata": {
"name": "Add SSH Key and Configure Sudoers",
"description": "Installs a single SSH public key for a target user on the workload-selected hosts and can enable passwordless sudo for the Ubuntu sudo group.",
"tags": [],
"icon": {
"provider": "simple-icons",
"id": "ansible"
},
"draft": false,
"version": {
"name": "1.0.0",
"source_dep_name": "manual/ubuntu-add-sshkey"
}
},
"variables": [
{
"title": "Access",
"name": "access",
"items": [
{
"name": "target_user",
"type": "str",
"title": "Target User",
"required": false,
"default": "ubuntu",
"description": "Linux user account that should receive the authorized SSH keys.",
"config": {
"placeholder": "ubuntu"
}
},
{
"name": "ssh_public_key",
"type": "str",
"title": "SSH Public Key",
"required": true,
"description": "SSH public key to add to the target user's authorized_keys file.",
"config": {
"textarea": true,
"placeholder": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBExampleKey user@laptop"
}
},
{
"name": "configure_passwordless_sudo",
"type": "bool",
"title": "Passwordless Sudo",
"required": false,
"default": true
}
]
}
]
}