-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsite_before_roles.yaml
More file actions
67 lines (65 loc) · 1.56 KB
/
site_before_roles.yaml
File metadata and controls
67 lines (65 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
- hosts: all
become: yes
pre_tasks:
- name: Installer les mises à jour
tags: always
package:
#upgrade: dist
#update_cache: yes
- hosts: all
become: yes
tasks:
- name: Créer l'utilisateur simon
tags: user
user:
name: simon
groups: root
- name: Ajouter la clé SSH pour simon
tags: ssh_key
authorized_key:
user: simon
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFme0Xj5BjYOYj+OM/pdPelZLYZ1Zylx3tD1wX0JoaAb ansible"
- name: Ajouter simon aux sudoers
tags: sudo
copy:
src: sudoers_simon
dest: /etc/sudoers.d/simon
owner: root
group: root
mode: 0440
#- name: Supprimer l'utilisateur simon
# tags: user
# user:
# name: simon
# state: absent
# remove: yes
- hosts: monitoring
become: yes
tasks:
- name: Assurer que le paquet htop est installé
tags: htop
package:
name: htop
state: present
when: ansible_distribution in ['Debian', 'Ubuntu']
- name: Assurer que le paquet htop est supprimé
package:
name: htop
state: absent
when: ansible_distribution == 'Debian'
- name: Copier fichier HTML vers /tmp
copy:
src: default_site.html
dest: /tmp/ansible.html
owner: root
group: root
mode: 0644
- name: Stopper Apache
tags: apache2
service:
name: apache2
state: stopped
enabled: no
register: httpd
when: ansible_distribution in ['Debian']