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 - name: install apache via ansible playbook
hosts: cibles hosts: all
roles: roles:
- apache - apache

View File

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

View File

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

View File

@@ -1,3 +1,4 @@
apache_package_name: httpd apache_package_name: httpd
apache_group_name: apache
apache_service_name: httpd apache_service_name: httpd
apache_conf_dir: /etc/httpd/conf.d 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