2
0

make it work on more distros

This commit is contained in:
2020-05-05 22:56:05 +02:00
parent 1c6027864a
commit 50081cc5d8
4 changed files with 20 additions and 28 deletions

View File

@@ -2,7 +2,7 @@
# handlers file for myapache
- name: reload httpd
service:
name: httpd
name: "{{ apache_service_name }}"
state: reloaded
- name: reload firewalld

View File

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