Controle Ansible

This commit is contained in:
IDEZ Ugo 2021-11-24 09:16:09 +01:00
parent e2b84b2da0
commit 5a4ae55d1f
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,2 @@
[user]
srv

View File

@ -0,0 +1,4 @@
search sio.lan
domain sio.lan
nameserver 10.121.38.7
nameserver 10.121.38.8

View File

@ -0,0 +1,38 @@
---
- hosts: srv
vars:
password: Azerty1+
tasks:
- name: creation de l'utilisateur sioadm
user:
name: sioadm
state: present
generate_ssh_key: yes
uid: 1200
groups: sudo
append: yes
password: "{{ password }}"
register: mavar
- name: debug
debug:
msg: "{{ mavar }}"
- name: desinstaller le paquet wpasupplicant
apt:
name: wpasupplicant
state: absent
- name: desinstaller le paquet rpcbind
apt:
name: rpcbind
state: absent
- name: copier le fichier /etc/resolv.conf
copy:
src: resolv.conf
dest: /etc/resolv.conf
- name: rajouter PermitRootLogin prohibit-password dans /etc/ssh/sshd_config
lineinfile:
path: /etc/ssh/sshd_config
line: 'PermitRootLogin prohibit-password'
create: yes