Adding option for configuring a secondary account

This commit is contained in:
Tyler Hale 2022-08-25 09:30:20 -06:00
parent c1656f82ec
commit 17d06adb73
Signed by: Tyler
GPG key ID: C7CC4B910D88EF96
4 changed files with 34 additions and 24 deletions

View file

@ -8,12 +8,18 @@
# General
# =======
# User that should have the authorized keys added
# User that should be configured for future management
base_core_management_user: "{{ ansible_user }}"
# Secondary user that may be configured for future management
base_core_secondary_user: ""
# If enabled, the password for the management user account will be disabled
base_core_management_user_disable_password: false
# If enabled, the password for the secondary user account will be disabled
base_core_secondary_user_disable_password: false
# Install all available updates at runtime
base_core_install_updates: true
@ -53,9 +59,6 @@ base_core_root_ca_url: ""
# SSH
# ===
# Added the public keys to an additional user if defined
base_core_ssh_public_keys_user: ""
# Allow ssh root login
base_core_ssh_permit_root_login: false

View file

@ -83,3 +83,9 @@
name: "{{ base_core_management_user }}"
password_lock: yes
when: base_core_management_user_disable_password == true
- name: Disable password for secondary management account
user:
name: "{{ base_core_secondary_user }}"
password_lock: yes
when: base_core_secondary_user != "" and base_core_secondary_user_disable_password == true

View file

@ -30,12 +30,12 @@
- name: Setup authorized keys for secondary user
authorized_key:
user: "{{ base_core_ssh_public_keys_user }}"
user: "{{ base_core_secondary_user }}"
state: present
key: '{{ lookup("file", item) }}'
with_fileglob:
- "public_keys/*"
when: base_core_ssh_public_keys_user != ""
when: base_core_secondary_user != ""
tags:
- authorized_key