Skip to content

Commit

Permalink
πŸ› skip ssh key add when user absent
Browse files Browse the repository at this point in the history
  • Loading branch information
srajasimman committed Jul 2, 2024
1 parent e214a38 commit 5262d86
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ansible/roles/users/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
user: "{{ item.key }}"
key: "{{ item.value.ssh_public_key | default(omit) }}"
manage_dir: true
state: present
state: "{{ item.value.state | default('present') }}"
when: item.value.state
loop: "{{ users | dict2items }}"

- name: Add users into sudoers for no password
Expand All @@ -33,5 +34,5 @@
mode: 0440
owner: root
group: root
when: item.value.sudo_no_password | default(false)
when: item.value.sudo_no_password | default(false) and item.value.state
loop: "{{ users | dict2items }}"

0 comments on commit 5262d86

Please sign in to comment.