From 5a4ae55d1f74206e960de75cf3ed344eb0841670 Mon Sep 17 00:00:00 2001 From: IDEZ Ugo Date: Wed, 24 Nov 2021 09:16:09 +0100 Subject: [PATCH] Controle Ansible --- sio2/sisr/ctrlansible/hosts | 2 ++ sio2/sisr/ctrlansible/resolv.conf | 4 ++++ sio2/sisr/ctrlansible/user.yml | 38 +++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 sio2/sisr/ctrlansible/hosts create mode 100644 sio2/sisr/ctrlansible/resolv.conf create mode 100644 sio2/sisr/ctrlansible/user.yml diff --git a/sio2/sisr/ctrlansible/hosts b/sio2/sisr/ctrlansible/hosts new file mode 100644 index 0000000..3aa7bb0 --- /dev/null +++ b/sio2/sisr/ctrlansible/hosts @@ -0,0 +1,2 @@ +[user] +srv diff --git a/sio2/sisr/ctrlansible/resolv.conf b/sio2/sisr/ctrlansible/resolv.conf new file mode 100644 index 0000000..352c7b7 --- /dev/null +++ b/sio2/sisr/ctrlansible/resolv.conf @@ -0,0 +1,4 @@ +search sio.lan +domain sio.lan +nameserver 10.121.38.7 +nameserver 10.121.38.8 diff --git a/sio2/sisr/ctrlansible/user.yml b/sio2/sisr/ctrlansible/user.yml new file mode 100644 index 0000000..bb401c4 --- /dev/null +++ b/sio2/sisr/ctrlansible/user.yml @@ -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 +