4 Commits

Author SHA1 Message Date
bee4b6a526 correctly delete local ressources 2023-06-07 10:57:09 +02:00
e465a877cf switch to fqmn 2023-01-20 12:36:33 +01:00
895f1f15fd solution abr 2022-11-16 15:11:35 +01:00
4bd6eebafd wip 2022-11-16 14:41:55 +01:00
4 changed files with 32 additions and 37 deletions

6
Readme.md Normal file
View 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

View File

@@ -3,21 +3,28 @@
hosts: centos hosts: centos
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
yum: ansible.builtin.package:
name: httpd name: httpd
state: present state: present
- name: conf httpd - name: conf httpd
template: ansible.builtin.template:
src: vhost.conf src: /tmp/sib_10/vhost.conf
dest: /etc/httpd/conf.d/vhost.conf dest: /etc/httpd/conf.d/vhost.conf
mode: 0640 mode: 0640
owner: root owner: root
group: apache group: apache
- name: activate apache - name: activate apache
service: ansible.builtin.service:
name: httpd name: httpd
enabled: yes enabled: yes
state: started state: started
@@ -25,20 +32,20 @@
- name: setup firewall - name: setup firewall
block: block:
- name: install firewalld packages - name: install firewalld packages
yum: ansible.builtin.package:
name: name:
- python3-firewall - python3-firewall
- firewalld - firewalld
state: present state: present
- name: enable firewalld service - name: enable firewalld service
service: ansible.builtin.service:
name: firewalld name: firewalld
enabled: true enabled: true
state: started state: started
- name: open firewall port - name: open firewall port
firewalld: ansible.posix.firewalld:
service: "{{ item }}" service: "{{ item }}"
permanent: yes permanent: yes
immediate: yes immediate: yes
@@ -49,12 +56,19 @@
ignore_errors: true ignore_errors: true
- name: create documentroot - name: create documentroot
file: ansible.builtin.file:
name: /var/www/html/example.org/ name: /var/www/html/example.org/
state: directory state: directory
- name: copy index file - name: copy index ansible.builtin.file
template: ansible.builtin.template:
src: index.txt src: /tmp/sib_10/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

View File

@@ -1 +0,0 @@
<h1>hello World</h1>

View File

@@ -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>