aboutsummaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorspmfox <spmfox@foxwd.com>2025-07-30 18:19:35 -0400
committerspmfox <spmfox@foxwd.com>2025-07-30 18:19:35 -0400
commit073042cae96e01a5e5ecbe434f00ef3ebf86e9b8 (patch)
treedcd14640b3fb6d826a09ea1c5ae20e6d836f8ce2 /roles
parent167b3da9926db3a4f507533427b72933c008dee6 (diff)
changed ssh-key to ssh-keys, now supports adding multiple keysHEADmain
Diffstat (limited to 'roles')
-rw-r--r--roles/guest-configure/tasks/user.yml5
-rw-r--r--roles/guest-configure/vars/main.yml2
-rw-r--r--roles/libvirt/templates/kickstart/el10.ks4
-rw-r--r--roles/libvirt/templates/kickstart/el8.ks4
-rw-r--r--roles/libvirt/templates/kickstart/el9.ks4
-rw-r--r--roles/libvirt/templates/kickstart/f38.ks4
-rw-r--r--roles/libvirt/vars/main.yml4
7 files changed, 18 insertions, 9 deletions
diff --git a/roles/guest-configure/tasks/user.yml b/roles/guest-configure/tasks/user.yml
index 2458ccf..7bfe85d 100644
--- a/roles/guest-configure/tasks/user.yml
+++ b/roles/guest-configure/tasks/user.yml
@@ -12,8 +12,9 @@
ansible.posix.authorized_key:
user: "{{ guest_configure_user }}"
state: present
- key: "{{ guest_configure_ssh_key }}"
- when: guest_configure_ssh_key | length > 0
+ key: "{{ item }}"
+ loop: "{{ guest_configure_ssh_keys }}"
+ when: guest_configure_ssh_keys | length > 0
- name: RedHat block
when: ansible_os_family == "RedHat"
diff --git a/roles/guest-configure/vars/main.yml b/roles/guest-configure/vars/main.yml
index 77c2cac..5c7abef 100644
--- a/roles/guest-configure/vars/main.yml
+++ b/roles/guest-configure/vars/main.yml
@@ -4,7 +4,7 @@ ansible_ssh_password: "{{ root_password if root_password is defined }}"
guest_configure_user: "{{ user if user is defined }}"
guest_configure_user_shell: "{{ shell if shell is defined }}"
-guest_configure_ssh_key: "{{ ssh_key if ssh_key is defined }}"
+guest_configure_ssh_keys: "{{ ssh_keys if ssh_keys is defined }}"
guest_configure_packages_preq: "{{ pre_packages if pre_packages is defined }}"
guest_configure_packages: "{{ packages if packages is defined }}"
guest_configure_services: "{{ services if services is defined }}"
diff --git a/roles/libvirt/templates/kickstart/el10.ks b/roles/libvirt/templates/kickstart/el10.ks
index 5a95014..253496b 100644
--- a/roles/libvirt/templates/kickstart/el10.ks
+++ b/roles/libvirt/templates/kickstart/el10.ks
@@ -39,7 +39,9 @@ rootpw --iscrypted {{ libvirt_kickstart_root_password | password_hash("sha512")
mkdir -m0700 /root/.ssh/
cat <<EOF >/root/.ssh/authorized_keys
-{{ libvirt_kickstart_root_ssh_key }}
+{% for ssh_key in libvirt_kickstart_root_ssh_keys %}
+{{ ssh_key }}
+{% endfor %}
EOF
chmod 0600 /root/.ssh/authorized_keys
diff --git a/roles/libvirt/templates/kickstart/el8.ks b/roles/libvirt/templates/kickstart/el8.ks
index 5097c0d..56055fa 100644
--- a/roles/libvirt/templates/kickstart/el8.ks
+++ b/roles/libvirt/templates/kickstart/el8.ks
@@ -39,7 +39,9 @@ rootpw --iscrypted {{ libvirt_kickstart_root_password | password_hash("sha512")
mkdir -m0700 /root/.ssh/
cat <<EOF >/root/.ssh/authorized_keys
-{{ libvirt_kickstart_root_ssh_key }}
+{% for ssh_key in libvirt_kickstart_root_ssh_keys %}
+{{ ssh_key }}
+{% endfor %}
EOF
chmod 0600 /root/.ssh/authorized_keys
diff --git a/roles/libvirt/templates/kickstart/el9.ks b/roles/libvirt/templates/kickstart/el9.ks
index b37bcf0..afb050f 100644
--- a/roles/libvirt/templates/kickstart/el9.ks
+++ b/roles/libvirt/templates/kickstart/el9.ks
@@ -39,7 +39,9 @@ rootpw --iscrypted {{ libvirt_kickstart_root_password | password_hash("sha512")
mkdir -m0700 /root/.ssh/
cat <<EOF >/root/.ssh/authorized_keys
-{{ libvirt_kickstart_root_ssh_key }}
+{% for ssh_key in libvirt_kickstart_root_ssh_keys %}
+{{ ssh_key }}
+{% endfor %}
EOF
chmod 0600 /root/.ssh/authorized_keys
diff --git a/roles/libvirt/templates/kickstart/f38.ks b/roles/libvirt/templates/kickstart/f38.ks
index de0adb8..0d4c40e 100644
--- a/roles/libvirt/templates/kickstart/f38.ks
+++ b/roles/libvirt/templates/kickstart/f38.ks
@@ -38,7 +38,9 @@ rootpw --iscrypted {{ libvirt_kickstart_root_password | password_hash("sha512")
mkdir -m0700 /root/.ssh/
cat <<EOF >/root/.ssh/authorized_keys
-{{ libvirt_kickstart_root_ssh_key }}
+{% for ssh_key in libvirt_kickstart_root_ssh_keys %}
+{{ ssh_key }}
+{% endfor %}
EOF
chmod 0600 /root/.ssh/authorized_keys
diff --git a/roles/libvirt/vars/main.yml b/roles/libvirt/vars/main.yml
index 1f2c7dc..0cbc96f 100644
--- a/roles/libvirt/vars/main.yml
+++ b/roles/libvirt/vars/main.yml
@@ -11,6 +11,6 @@ libvirt_vm_destination: "{{ parent_dataset_mount if parent_dataset_mount is defi
libvirt_vm_network: "{{ network if network is defined else 'default' }}"
libvirt_kickstart_hostname: "{{ inventory_hostname }}"
libvirt_kickstart_timezone: "{{ timezone if timezone is defined else 'Etc/GMT' }}"
-libvirt_kickstart_root_ssh_key: "{{ ssh_key if ssh_key is defined }}"
+libvirt_kickstart_root_ssh_keys: "{{ ssh_keys if ssh_keys is defined }}"
libvirt_kickstart_root_password: "{{ root_password if root_password is defined else lookup('password', '/dev/null length=32 chars=ascii_letters,digits') }}"
-libvirt_kickstart_allow_root_ssh: "{{ '' if ssh_key is defined else 'echo PermitRootLogin yes > /etc/ssh/sshd_config.d/01-permitrootlogin.conf' }}"
+libvirt_kickstart_allow_root_ssh: "{{ '' if ssh_keys is defined else 'echo PermitRootLogin yes > /etc/ssh/sshd_config.d/01-permitrootlogin.conf' }}"