tpsio/Ansible/confsrv.yml
“cameron.desrayaud” 338f2079d2 ansible eval
2021-11-24 10:01:37 +01:00

44 lines
1.0 KiB
YAML
Executable File

---
- hosts: srv
remote_user: root
tasks:
- name: création de sioadm
user:
name: sioadm
state: present
generate_ssh_key: yes
password: "{{ 'sioadm' | password_hash('sha512') }}"
uid: 1200
groups: sudo
append: yes
register: mavar
- name: debug
debug:
msg: "{{ mavar }}"
- name: export clé publique
authorized_key:
user: "{{ sioadm }}"
key: /sioadm/.ssh/id_rsa.pub
state: present
- name: désinstaller paquets wpasupplicant
apt :
name : wpasupplicant
state: absent
- name: désinstaller paquets rpcbindd
apt :
name : rpcbind
state: absent
- name: copie fichier resolv.conf
copy:
src:resolv.conf
dest:/etc
- name: disable SSH access for root
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^(.*)#PermitRootLogin prohibit-password(.*)$"
replace: "PermitRootLogin prohibit-password"
- name: copie fichier sshd_config
copy:
src:sshd_config
dest:/etc/ssh/