Compare commits
3 Commits
solution_a
...
solution_e
| Author | SHA1 | Date | |
|---|---|---|---|
| ba95e8a650 | |||
| f8a1f469e6 | |||
| c92c54ff3b |
@@ -1,6 +0,0 @@
|
|||||||
# Playbook d'installation apache
|
|
||||||
|
|
||||||
LEs fichiers vhost.conf et index.html sont récupérés par le pilote
|
|
||||||
|
|
||||||
directement depuis le dépôt git
|
|
||||||
|
|
||||||
48
apache.yml
48
apache.yml
@@ -1,15 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: install apache via ansible playbook
|
- name: install apache via ansible playbook
|
||||||
hosts: centos
|
hosts: cibles
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: retrieve ansible.builtin.files
|
|
||||||
ansible.builtin.git:
|
|
||||||
repo: https://infra.opendoor.fr/git/tom/sib_10_premier_playbook
|
|
||||||
dest: /tmp/sib_10
|
|
||||||
delegate_to: localhost
|
|
||||||
become: false
|
|
||||||
|
|
||||||
- name: install apache
|
- name: install apache
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name: httpd
|
name: httpd
|
||||||
@@ -17,7 +10,7 @@
|
|||||||
|
|
||||||
- name: conf httpd
|
- name: conf httpd
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: /tmp/sib_10/vhost.conf
|
src: vhost.conf
|
||||||
dest: /etc/httpd/conf.d/vhost.conf
|
dest: /etc/httpd/conf.d/vhost.conf
|
||||||
mode: 0640
|
mode: 0640
|
||||||
owner: root
|
owner: root
|
||||||
@@ -29,46 +22,13 @@
|
|||||||
enabled: yes
|
enabled: yes
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: setup firewall
|
|
||||||
block:
|
|
||||||
- name: install firewalld packages
|
|
||||||
ansible.builtin.package:
|
|
||||||
name:
|
|
||||||
- python3-firewall
|
|
||||||
- firewalld
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: enable firewalld service
|
|
||||||
ansible.builtin.service:
|
|
||||||
name: firewalld
|
|
||||||
enabled: true
|
|
||||||
state: started
|
|
||||||
|
|
||||||
- name: open firewall port
|
|
||||||
ansible.posix.firewalld:
|
|
||||||
service: "{{ item }}"
|
|
||||||
permanent: yes
|
|
||||||
immediate: yes
|
|
||||||
state: enabled
|
|
||||||
loop:
|
|
||||||
- http
|
|
||||||
- https
|
|
||||||
ignore_errors: true
|
|
||||||
|
|
||||||
- name: create documentroot
|
- name: create documentroot
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
name: /var/www/html/example.org/
|
name: /var/www/html/example.org/
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: copy index ansible.builtin.file
|
- name: copy index file
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: /tmp/sib_10/index.txt
|
src: index.txt
|
||||||
dest: /var/www/html/example.org/index.html
|
dest: /var/www/html/example.org/index.html
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: delete temp ansible.builtin.files
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /tmp/sib_10
|
|
||||||
state: absent
|
|
||||||
delegate_to: localhost
|
|
||||||
become: false
|
|
||||||
24
vhost.conf
Normal file
24
vhost.conf
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName example.org
|
||||||
|
ServerAlias www.example.org
|
||||||
|
ServerAlias {{ inventory_hostname }}
|
||||||
|
DocumentRoot /var/www/html/example.org
|
||||||
|
CustomLog /var/log/httpd/example.org_access.log combined
|
||||||
|
ErrorLog /var/log/httpd/example.org_error.log
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /var/www/html/example.org>
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
<Directory /var/www/html/example.org/Private>
|
||||||
|
Options indexes
|
||||||
|
AuthName "stop"
|
||||||
|
AuthType Basic
|
||||||
|
AuthUserFile /etc/httpd/passwd
|
||||||
|
require valid-user
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
Reference in New Issue
Block a user