Premier commit
This commit is contained in:
commit
518c7ab04b
49 files changed
+1120
No files matched your search
@@ -0,0 +1,43 @@
|
||||
---
|
||||
- name: "how to use block"
|
||||
hosts: ansible.debian ansible.ubuntu
|
||||
|
||||
tasks:
|
||||
- name: "install nginx"
|
||||
# Ce qui est prévu
|
||||
block:
|
||||
|
||||
- name: "install nginx"
|
||||
ansible.builtin.apt:
|
||||
name: nginx
|
||||
state: present
|
||||
- name: configure nginx
|
||||
template:
|
||||
src: nginx.conf.j2
|
||||
dest: /etc/nginx/nginx.conf
|
||||
|
||||
- name: restart nginx
|
||||
ansible.builtin.service:
|
||||
name: nginx
|
||||
state: restarted
|
||||
|
||||
# Ce qui est prévu en cas d’erreur
|
||||
rescue:
|
||||
- name: remove nginx conf file
|
||||
ansible.builtin.file:
|
||||
path: /etc/nginx/nginx.conf
|
||||
state: absent
|
||||
|
||||
- name: remove nginx
|
||||
ansible.builtin.apt:
|
||||
name: nginx
|
||||
state: absent
|
||||
|
||||
# Dans tous les cas
|
||||
always:
|
||||
- name: display playbook finished message
|
||||
ansible.builtin.debug:
|
||||
msg: 'your play was played :)'
|
||||
|
||||
# Commun pour toutes les tâches
|
||||
become: yes
|
||||
Reference in new issue
Block a user