Skip to content

Commit

Permalink
Added a feature to toggle whether an ssh key is exclusive when creati…
Browse files Browse the repository at this point in the history
…ng Unix accounts with `accounts` role
  • Loading branch information
AllRWeak authored and bl0way committed Jan 11, 2024
1 parent 1492a24 commit 58600cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions nova/core/roles/accounts/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sudo_requires_password: true
use_ssh_agent_for_sudo: false
accounts_remove_stale: true # Compares the accounts list with the users on the system created by this role and removes any that are not in the accounts list
fresh_deploy: false # Checks if the machine has just been created, required for setting correct connection parameters for AWS machines
accounts_exclusive_ssh_key: true # If true, only the specified ssh key will be allowed for the account, otherwise the key will be appended to the authorized_keys file

# The default lookup paths are Vault's KV v2 secret engine and a secrets name under that.
pregenerated_password: "{{ lookup('community.hashi_vault.hashi_vault', vault_lookup_fragment + 'secret=' + secrets_vault_engine_path | default(environment_name) + '/data/' + secrets_vault_secrets_path | default(project_fullname) + ':' + inventory_hostname + '_' + item.username) }}"
Expand Down
2 changes: 1 addition & 1 deletion nova/core/roles/accounts/tasks/unix_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
user: "{{ item.username }}"
state: present
key: "{{ item.ssh_key }}"
exclusive: "yes"
exclusive: "{{ item.ssh_key_exclusive | default(accounts_exclusive_ssh_key) }}"
loop: "{{ local_accounts_list }}"
loop_control:
label: "{{ item.username }}"
Expand Down

0 comments on commit 58600cc

Please sign in to comment.