Compare commits
4 Commits
solution_e
...
solution_a
| Author | SHA1 | Date | |
|---|---|---|---|
| bee4b6a526 | |||
| e465a877cf | |||
| 895f1f15fd | |||
| 4bd6eebafd |
6
Readme.md
Normal file
6
Readme.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# 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
|
||||
|
||||
36
apache.yml
36
apache.yml
@@ -3,21 +3,28 @@
|
||||
hosts: centos
|
||||
|
||||
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
|
||||
yum:
|
||||
ansible.builtin.package:
|
||||
name: httpd
|
||||
state: present
|
||||
|
||||
- name: conf httpd
|
||||
template:
|
||||
src: vhost.conf
|
||||
ansible.builtin.template:
|
||||
src: /tmp/sib_10/vhost.conf
|
||||
dest: /etc/httpd/conf.d/vhost.conf
|
||||
mode: 0640
|
||||
owner: root
|
||||
group: apache
|
||||
|
||||
- name: activate apache
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: httpd
|
||||
enabled: yes
|
||||
state: started
|
||||
@@ -25,20 +32,20 @@
|
||||
- name: setup firewall
|
||||
block:
|
||||
- name: install firewalld packages
|
||||
yum:
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- python3-firewall
|
||||
- firewalld
|
||||
state: present
|
||||
|
||||
- name: enable firewalld service
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: firewalld
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: open firewall port
|
||||
firewalld:
|
||||
ansible.posix.firewalld:
|
||||
service: "{{ item }}"
|
||||
permanent: yes
|
||||
immediate: yes
|
||||
@@ -49,12 +56,19 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: create documentroot
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
name: /var/www/html/example.org/
|
||||
state: directory
|
||||
|
||||
- name: copy index file
|
||||
template:
|
||||
src: index.txt
|
||||
- name: copy index ansible.builtin.file
|
||||
ansible.builtin.template:
|
||||
src: /tmp/sib_10/index.txt
|
||||
dest: /var/www/html/example.org/index.html
|
||||
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
24
vhost.conf
@@ -1,24 +0,0 @@
|
||||
<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