formatting

This commit is contained in:
uumas
2023-09-04 02:13:17 +03:00
parent 699c667a45
commit 4e9f127210
18 changed files with 60 additions and 55 deletions

View File

@@ -1,11 +1,11 @@
---
- name: Ensure sudo is installed
package:
ansible.builtin.package:
name: sudo
- name: Fail if removing the current user
fail:
ansible.builtin.fail:
msg: Refusing to delete the user used to run this play
when:
- item.name == ansible_user_id
@@ -15,7 +15,7 @@
become: false
- name: Ensure users in correct state
user:
ansible.builtin.user:
name: "{{ item.name }}"
password: "{{ item.password }}"
shell: "{{ item.shell | default('/bin/bash') }}"
@@ -25,14 +25,14 @@
loop: "{{ users }}"
- name: Set ssh authorized keys for users
authorized_key:
ansible.posix.authorized_key:
user: "{{ item.name }}"
key: "{{ item.ssh_pubkey }}"
when: item.state | default('present') == 'present'
loop: "{{ users }}"
- name: Disable login as root with ssh key
file:
ansible.builtin.file:
path: /root/.ssh/authorized_keys
state: absent
when: ansible_user | default('') != 'root'