1.0
This commit is contained in:
53
ansible/playbook/Setup_apache2.yml
Normal file
53
ansible/playbook/Setup_apache2.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
- name: Déploiement de apache2
|
||||
hosts: web
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Installation de Apache2
|
||||
apt:
|
||||
name: apache2
|
||||
state: present
|
||||
|
||||
- name: Copier la configuration du VirtualHost (web.conf)
|
||||
copy:
|
||||
src: ../modules/web/web.conf
|
||||
dest: /etc/apache2/sites-available/web.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
- name: Configurer le port d'écoute dans ports.conf
|
||||
lineinfile:
|
||||
path: /etc/apache2/ports.conf
|
||||
insertafter: '^Listen 80'
|
||||
line: 'Listen 8000'
|
||||
notify: reload apache2
|
||||
|
||||
- name: Créer le dossier Web dans /var/www
|
||||
file:
|
||||
path: /var/www/web
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: www-data
|
||||
group: www-data
|
||||
|
||||
- name: Copie des dossiers Web
|
||||
copy:
|
||||
src: ../modules/web/html/
|
||||
dest: /var/www/web/
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: '0755'
|
||||
|
||||
- name: Activation du site web
|
||||
command: a2ensite web.conf
|
||||
args:
|
||||
creates: /etc/apache2/sites-enabled/web.conf
|
||||
notify: reload apache2
|
||||
|
||||
handlers:
|
||||
- name: reload apache2
|
||||
service:
|
||||
name: apache2
|
||||
state: reloaded
|
||||
Reference in New Issue
Block a user