Compare commits
3 Commits
premade
...
c9c74e93cd
| Author | SHA1 | Date | |
|---|---|---|---|
| c9c74e93cd | |||
| de6dbc2b8c | |||
| 13288032b3 |
@@ -40,7 +40,5 @@ Complétez le playbook précédemment mis au point afin qu'il:
|
|||||||
|
|
||||||
- exécute une tâche de votre choix uniquement si le script a renvoyée la valeur 1
|
- exécute une tâche de votre choix uniquement si le script a renvoyée la valeur 1
|
||||||
|
|
||||||
#### Implémenter un mécanisme de gestion d'exception
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Solutions: voir branche "solution"
|
||||||
38
apache.yml
38
apache.yml
@@ -1,38 +0,0 @@
|
|||||||
---
|
|
||||||
- name: install apache via ansible playbook
|
|
||||||
hosts: test
|
|
||||||
user: ansible
|
|
||||||
become: true
|
|
||||||
tasks:
|
|
||||||
- name: install apache
|
|
||||||
yum:
|
|
||||||
name: httpd
|
|
||||||
state: latest
|
|
||||||
- name: conf httpd
|
|
||||||
template:
|
|
||||||
src: vhost.conf
|
|
||||||
dest: /etc/httpd/conf.d/vhost.conf
|
|
||||||
mode: 0640
|
|
||||||
owner: root
|
|
||||||
group: apache
|
|
||||||
- name: activate apache
|
|
||||||
service:
|
|
||||||
name: httpd
|
|
||||||
enabled: yes
|
|
||||||
state: restarted
|
|
||||||
- name: open firewall port
|
|
||||||
firewalld:
|
|
||||||
service: http
|
|
||||||
permanent: yes
|
|
||||||
immediate: yes
|
|
||||||
state: enabled
|
|
||||||
ignore_errors: yes
|
|
||||||
- name: create documentroot
|
|
||||||
file:
|
|
||||||
name: /var/www/html/orsys.fr
|
|
||||||
state: directory
|
|
||||||
- name: create index file
|
|
||||||
copy:
|
|
||||||
src: index.html
|
|
||||||
dest: /var/www/html/orsys.fr/index.html
|
|
||||||
mode: 0644
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
---
|
---
|
||||||
- hosts: test
|
- hosts: cibles
|
||||||
user: root
|
|
||||||
gather_facts: false
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: send script
|
- name: send script
|
||||||
copy:
|
copy:
|
||||||
|
|||||||
18
ignore_errors.yml
Normal file
18
ignore_errors.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
- hosts: cibles
|
||||||
|
tasks:
|
||||||
|
- name: send script
|
||||||
|
copy:
|
||||||
|
src: random.sh
|
||||||
|
dest: /tmp//random.sh
|
||||||
|
mode: 0750
|
||||||
|
|
||||||
|
- name: execute script
|
||||||
|
command: /tmp//random.sh
|
||||||
|
register: result
|
||||||
|
failed_when: 2|string in result.stdout
|
||||||
|
|
||||||
|
- name: display result
|
||||||
|
debug:
|
||||||
|
var: result
|
||||||
Reference in New Issue
Block a user