2023-09-02 09:42:37 +02:00
|
|
|
- name: create administrator
|
|
|
|
user:
|
|
|
|
name: administrator
|
|
|
|
update_password: on_create
|
|
|
|
password: "{{ user_administrator_initial_password | password_hash('sha512') }}"
|
|
|
|
create_home: yes
|
|
|
|
generate_ssh_key: yes
|
|
|
|
ssh_key_type: rsa
|
|
|
|
ssh_key_bits: 8192
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_user_administrator is not defined
|
2024-01-02 08:28:00 +01:00
|
|
|
|
|
|
|
- name: "set correct rights for {{path_administrator_home}}"
|
|
|
|
file:
|
|
|
|
path: "{{path_administrator_home}}"
|
|
|
|
state: directory
|
|
|
|
owner: administrator
|
|
|
|
group: administrator
|
|
|
|
mode: 0700
|
|
|
|
when: run_once_user_administrator is not defined
|
|
|
|
|
2023-09-02 09:42:37 +02:00
|
|
|
- name: "create {{path_administrator_scripts}}"
|
|
|
|
file:
|
|
|
|
path: "{{path_administrator_home}}scripts"
|
|
|
|
state: directory
|
|
|
|
owner: administrator
|
|
|
|
group: administrator
|
|
|
|
mode: 0700
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_user_administrator is not defined
|
2023-09-02 09:42:37 +02:00
|
|
|
|
2023-04-26 14:38:02 +02:00
|
|
|
- name: create {{path_administrator_home}}.ssh/authorized_keys
|
2020-12-25 15:38:42 +01:00
|
|
|
copy:
|
2023-04-26 14:38:02 +02:00
|
|
|
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}{{path_administrator_home}}.ssh/authorized_keys"
|
|
|
|
dest: "{{path_administrator_home}}.ssh/authorized_keys"
|
2020-12-25 15:38:42 +01:00
|
|
|
owner: administrator
|
|
|
|
group: administrator
|
|
|
|
mode: '0644'
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_user_administrator is not defined
|
2020-12-25 15:38:42 +01:00
|
|
|
|
2020-12-31 17:01:47 +01:00
|
|
|
- name: grant administrator sudo rights with password
|
2020-12-25 15:38:42 +01:00
|
|
|
copy:
|
2021-01-01 12:51:40 +01:00
|
|
|
src: "administrator"
|
|
|
|
dest: /etc/sudoers.d/administrator
|
|
|
|
mode: '0644'
|
|
|
|
owner: root
|
|
|
|
group: root
|
2021-01-10 19:37:44 +01:00
|
|
|
notify: sshd restart
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_user_administrator is not defined
|
2021-10-18 18:46:58 +02:00
|
|
|
|
2023-04-26 14:38:02 +02:00
|
|
|
- name: "create {{path_administrator_home}}volumes/"
|
2021-10-18 18:46:58 +02:00
|
|
|
file:
|
2023-04-26 14:38:02 +02:00
|
|
|
path: "{{path_administrator_home}}volumes"
|
2021-10-18 18:46:58 +02:00
|
|
|
state: directory
|
|
|
|
owner: administrator
|
|
|
|
group: administrator
|
|
|
|
mode: 0700
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_user_administrator is not defined
|
|
|
|
|
|
|
|
- name: run the user_administrator tasks once
|
|
|
|
set_fact:
|
|
|
|
run_once_user_administrator: true
|
|
|
|
when: run_once_user_administrator is not defined
|