make it work on more distros
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
---
|
||||
- name: install apache via ansible playbook
|
||||
hosts: all
|
||||
user: root
|
||||
become: false
|
||||
roles:
|
||||
- myapache3
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
apache_vhosts:
|
||||
- servername: cines.fr
|
||||
serveralias:
|
||||
- www.cines.fr
|
||||
- cines.org
|
||||
- www.cines.org
|
||||
documentroot: /var/www/html/cines.fr
|
||||
accesslog: /var/log/httpd/access_cines.fr_log
|
||||
errorlog: /var/log/httpd/error_cines.fr_log
|
||||
- servername: thomas.fr
|
||||
serveralias:
|
||||
- www.thomas.fr
|
||||
- thomas.com
|
||||
- www.thomas.cm
|
||||
documentroot: /var/www/html/thomas.fr
|
||||
accesslog: /var/log/httpd/access_thomas.fr_log
|
||||
errorlog: /var/log/httpd/error_thomas.fr_log
|
||||
documentrootoptions: indexes
|
||||
servername: laposte.net
|
||||
serveralias: www.laposte.net
|
||||
documentroot: /var/www/html/laposte.net
|
||||
accesslog: /var/log/httpd/access_laposte.net_log
|
||||
errorlog: /var/log/httpd/error_laposte.net_log
|
||||
@@ -2,7 +2,7 @@
|
||||
# handlers file for myapache
|
||||
- name: reload httpd
|
||||
service:
|
||||
name: httpd
|
||||
name: "{{ apache_service_name }}"
|
||||
state: reloaded
|
||||
|
||||
- name: reload firewalld
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
---
|
||||
# tasks file for myapache
|
||||
- name: install apache
|
||||
#
|
||||
- name: include distribution specific variables
|
||||
include_vars: "{{ ansible_distribution|lower }}.yml"
|
||||
|
||||
- name: install apache almost anywhere
|
||||
tags: httpd
|
||||
yum:
|
||||
name: httpd
|
||||
package:
|
||||
name: "{{ apache_package_name}}"
|
||||
state: latest
|
||||
|
||||
|
||||
- name: conf httpd
|
||||
tags: httpd
|
||||
notify: reload httpd
|
||||
template:
|
||||
src: vhost.conf.jj
|
||||
dest: /etc/httpd/conf.d/vhost.conf
|
||||
dest: "{{ apache_conf_dir}}/vhost.conf"
|
||||
mode: 0640
|
||||
owner: root
|
||||
group: apache
|
||||
@@ -18,7 +24,7 @@
|
||||
- name: activate apache
|
||||
tags: httpd
|
||||
service:
|
||||
name: httpd
|
||||
name: "{{ apache_service_name }}"
|
||||
enabled: yes
|
||||
|
||||
- name: open firewall port
|
||||
@@ -30,11 +36,12 @@
|
||||
state: enabled
|
||||
ignore_errors: yes
|
||||
notify: reload firewalld
|
||||
when: ansible_distribution=="CentOS" or "RedHat"
|
||||
|
||||
- name: create documentroot
|
||||
tags: httpd
|
||||
file:
|
||||
name: "/var/www/html/{{ item.documentroot }}"
|
||||
name: "{{ item.documentroot }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ apache_vhosts }}"
|
||||
@@ -43,7 +50,7 @@
|
||||
tags: httpd
|
||||
copy:
|
||||
src: index.html
|
||||
dest: "/var/www/html/{{ item.documentroot }}/index.html"
|
||||
dest: "{{ item.documentroot }}/index.html"
|
||||
mode: 0644
|
||||
with_items:
|
||||
- "{{ apache_vhosts }}"
|
||||
Reference in New Issue
Block a user