FQCN && module sudoers

This commit is contained in:
2023-01-23 16:33:27 +01:00
parent 4a72838034
commit 425ea2cba4

View File

@@ -3,14 +3,14 @@
hosts: cibles
tasks:
- name: warn people
lineinfile:
ansible.builtin.lineinfile:
path: /etc/motd
create: yes
line: "Host is managed by ansible, manual interaction not recommended"
state: present
- name: history
lineinfile:
ansible.builtin.lineinfile:
path: /etc/history
line: "{{ '%Y-%m-%d' | strftime }} - {{ ansible_play_name }}"
state: present
@@ -24,17 +24,18 @@
become: false
- name: create account
user:
ansible.builtin.user:
name: ansible
password: "{{ '123Soleil%' | password_hash('sha512',65534|random(seed=inventory_hostname) | string) }}"
create_home: yes
home: /home/ansible
- name: configure sudo
copy:
content: "ansible ALL=(ALL) NOPASSWD: ALL"
dest: /etc/sudoers.d/ansible
validate: "/usr/sbin/visudo -cf %s"
community.general.sudoers:
name: ansible
user: ansible
commands: ALL
nopassword: true
- name: deploy ssh key
authorized_key: