amelioration atelier
This commit is contained in:
16
Readme.md
Normal file
16
Readme.md
Normal file
@@ -0,0 +1,16 @@
|
||||
## Les tags
|
||||
|
||||
**Tâche**: Utiliser les tags pour n'exécuter qu'une sélection de tâches.
|
||||
|
||||
**Condition**: Lors du développement d'un playbook, ou de l'utilisation d'un playbook volumineux.
|
||||
|
||||
**Norme**: tags
|
||||
|
||||
**Pratique**: Modifiez le playbook apache.yml afin de *tagguer* chaque tâche avec les étiquettes suivantes:
|
||||
|
||||
* firewall (uniquement la tâche d'ouverture du parefeu)
|
||||
* apache (toutes les tâches)
|
||||
* docroot (uniquement les 2 dernières tâches)
|
||||
|
||||
|
||||
Expérimentez en exécutant le playbook en utilisant les options --list-tasks et --tags ou --skip-tags
|
||||
@@ -16,13 +16,11 @@
|
||||
|
||||
tasks:
|
||||
- name: install apache
|
||||
tags: httpd
|
||||
yum:
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
|
||||
- name: conf httpd
|
||||
tags: httpd
|
||||
notify: reload httpd
|
||||
template:
|
||||
src: vhost.conf
|
||||
@@ -32,13 +30,11 @@
|
||||
group: apache
|
||||
|
||||
- name: activate apache
|
||||
tags: httpd
|
||||
service:
|
||||
name: httpd
|
||||
enabled: yes
|
||||
|
||||
- name: open firewall port
|
||||
tags: [firewall,httpd]
|
||||
firewalld:
|
||||
service: http
|
||||
permanent: yes
|
||||
@@ -48,13 +44,11 @@
|
||||
notify: reload firewalld
|
||||
|
||||
- name: create documentroot
|
||||
tags: httpd
|
||||
file:
|
||||
name: /var/www/html/orsys.fr
|
||||
state: directory
|
||||
|
||||
- name: create index file
|
||||
tags: httpd
|
||||
copy:
|
||||
src: index.html
|
||||
dest: /var/www/html/orsys.fr/index.html
|
||||
|
||||
62
apache_correction.yml
Normal file
62
apache_correction.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
- name: install apache via ansible playbook
|
||||
hosts: test
|
||||
user: ansible
|
||||
become: true
|
||||
handlers:
|
||||
- name: reload httpd
|
||||
service:
|
||||
name: httpd
|
||||
state: reloaded
|
||||
|
||||
- name: reload firewalld
|
||||
service:
|
||||
name: firewalld
|
||||
state: reloaded
|
||||
|
||||
tags: apache
|
||||
tasks:
|
||||
- name: install apache
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
|
||||
- name: conf httpd
|
||||
notify: reload 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
|
||||
|
||||
- name: open firewall port
|
||||
tags: firewall
|
||||
firewalld:
|
||||
service: http
|
||||
permanent: yes
|
||||
immediate: yes
|
||||
state: enabled
|
||||
ignore_errors: yes
|
||||
notify: reload firewalld
|
||||
|
||||
- name: create documentroot
|
||||
tags:
|
||||
- docroot
|
||||
file:
|
||||
name: /var/www/html/orsys.fr
|
||||
state: directory
|
||||
|
||||
- name: create index file
|
||||
tags:
|
||||
- docroot
|
||||
copy:
|
||||
src: index.html
|
||||
dest: /var/www/html/orsys.fr/index.html
|
||||
mode: 0644
|
||||
|
||||
@@ -1 +1 @@
|
||||
test
|
||||
<span style="text-align: center;background-color: #FD5401; font-size: 42px;">Hello World</span>
|
||||
|
||||
13
vhost.conf
13
vhost.conf
@@ -1,11 +1,10 @@
|
||||
<VirtualHost *:80>
|
||||
ServerName orsys.fr
|
||||
ServerAlias www.orsys.fr
|
||||
ServerAlias 100.0.0.100
|
||||
DocumentRoot /var/www/html/orsys.fr/
|
||||
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
||||
ErrorLog /var/log/httpd/orsys.fr_error.log
|
||||
<Directory />
|
||||
ServerName orsys.fr
|
||||
ServerAlias www.orsys.fr
|
||||
DocumentRoot /var/www/html/orsys.fr/
|
||||
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
||||
ErrorLog /var/log/httpd/orsys.fr_error.log
|
||||
<Directory />
|
||||
Options none
|
||||
Allowoverride none
|
||||
Require all denied
|
||||
|
||||
Reference in New Issue
Block a user