make it work on almlinux and debian, really

This commit is contained in:
2023-11-21 14:40:05 +01:00
parent db9f049e68
commit 3bc092ada5
6 changed files with 23 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
---
- name: install apache via ansible playbook
hosts: cibles
hosts: all
roles:
- apache

View File

@@ -2,7 +2,7 @@
# tasks file for myapache
#
- name: include distribution specific variables
include_vars: "{{ ansible_distribution|lower }}.yml"
include_vars: "{{ ansible_os_family|lower }}.yml"
- name: install apache almost anywhere
tags: httpd
@@ -18,7 +18,7 @@
dest: "{{ apache_conf_dir}}/vhost.conf"
mode: 0640
owner: root
group: apache
group: "{{ apache_group_name }}"
- name: activate apache
tags: httpd
@@ -35,23 +35,21 @@
state: enabled
ignore_errors: yes
notify: reload firewalld
when: ansible_distribution=="CentOS" or "RedHat"
when: ansible_os_family=="RedHat"
- name: create documentroot
tags: httpd
file:
name: "{{ item.documentroot }}"
state: directory
loop:
- "{{ apache_vhosts }}"
loop: "{{ apache_vhosts }}"
- name: create documentroot/Private
tags: httpd
file:
name: "{{ item.documentroot }}/Private"
state: directory
loop:
- "{{ apache_vhosts }}"
loop: "{{ apache_vhosts }}"
- name: create index file
tags: httpd
@@ -59,5 +57,4 @@
src: index.html
dest: "{{ item.documentroot }}/index.html"
mode: 0644
loop:
- "{{ apache_vhosts }}"
loop: "{{ apache_vhosts }}"

View File

@@ -1,3 +1,4 @@
apache_package_name: apache2
apache_group_name: www-data
apache_service_name: apache2
apache_conf_dir: /etc/apache2/sites-enabled/

View File

@@ -1,3 +1,4 @@
apache_package_name: httpd
apache_group_name: apache
apache_service_name: httpd
apache_conf_dir: /etc/httpd/conf.d

View File

@@ -0,0 +1,12 @@
apache_vhosts:
- servername: tartempion.fr
serveralias: www.tartempion.fr
documentroot: /var/www/html/tartempion.fr
accesslog: /var/log/apache2/access_tartempion.fr_log
errorlog: /var/log/apache2/error_tartempion.fr_log
- servername: delphine.fr
serveralias: www.delphine.fr
documentroot: /var/www/html/delphine.fr
accesslog: /var/log/apache2/access_delphine.fr_log
errorlog: /var/log/apache2/error_delphine.fr_log

2
inventory Normal file
View File

@@ -0,0 +1,2 @@
centos1.formation.opendoor.fr
debian1.formation.opendoor.fr