config ansible di base per installare nginx. Queste sono solo prove per capirci qualcosa con ansible
This commit is contained in:
parent
7a33d651bd
commit
f7723e72dc
4 changed files with 26 additions and 0 deletions
2
inventory.ini
Normal file
2
inventory.ini
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[xmpp]
|
||||||
|
10.10.0.21 ansible_user=root ansible_ssh_private_key_file=~/.ssh/ansible
|
5
playbook.yml
Normal file
5
playbook.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
- name: Configura container di base
|
||||||
|
hosts: xmpp #dice che deve applicare le seguenti cose al gruppo xmpp definito nell'inventory.ini
|
||||||
|
become: true #esegue da root
|
||||||
|
roles:
|
||||||
|
- nginx
|
4
roles/nginx/handlers/main.yml
Normal file
4
roles/nginx/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
- name: Restart nginx
|
||||||
|
service:
|
||||||
|
name: nginx
|
||||||
|
state: restarted
|
15
roles/nginx/tasks/main.yml
Normal file
15
roles/nginx/tasks/main.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
- name: Aggiorna cache pacchetti apt
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Installa nginx
|
||||||
|
apt:
|
||||||
|
name: nginx
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Avvia nginx
|
||||||
|
service:
|
||||||
|
name: nginx
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
notify: restart nginx #se qualcosa cambia (tipo nginx viene reinstallato), chiama l'handler per riavviare nginx
|
Loading…
Add table
Add a link
Reference in a new issue