From 425ea2cba4eca9b917f4dd3a8546773b313aa5d0 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Mon, 23 Jan 2023 16:33:27 +0100 Subject: [PATCH] FQCN && module sudoers --- setup.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/setup.yml b/setup.yml index 666b960..197ac0c 100644 --- a/setup.yml +++ b/setup.yml @@ -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: