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