apache: Initial version of module
This commit is contained in:
parent
677db41af0
commit
480822619d
5 changed files with 134 additions and 0 deletions
67
roles/apache/tasks/main.yml
Normal file
67
roles/apache/tasks/main.yml
Normal file
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
- name: install apache
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: installed
|
||||
with_items:
|
||||
- httpd
|
||||
- mod_ssl
|
||||
|
||||
- name: disable plain http and default included configs
|
||||
lineinfile:
|
||||
path: /etc/httpd/conf/httpd.conf
|
||||
line: "#{{ item }}"
|
||||
regexp: "^#?{{ item|replace('*', '\\*') }}"
|
||||
with_items:
|
||||
- "Listen 80"
|
||||
- "IncludeOptional conf.d/*.conf"
|
||||
notify: restart apache
|
||||
|
||||
- name: include local configs
|
||||
lineinfile:
|
||||
path: /etc/httpd/conf/httpd.conf
|
||||
line: "IncludeOptional conf.local.d/*.conf"
|
||||
notify: restart apache
|
||||
|
||||
- name: fix selinux contexts from data directory
|
||||
sefcontext:
|
||||
path: /srv/web(/.*)?
|
||||
setype: httpd_sys_content_t
|
||||
when: ansible_selinux_python_present == true
|
||||
- name: create data and config directories
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ item }}"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
seuser: _default
|
||||
setype: _default
|
||||
with_items:
|
||||
- /srv/web
|
||||
- "/srv/web/{{ inventory_hostname }}"
|
||||
- "/etc/httpd/conf.local.d"
|
||||
|
||||
- name: create ssl config
|
||||
copy:
|
||||
src: ssl.conf
|
||||
dest: /etc/httpd/conf.local.d/ssl.conf
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
notify: restart apache
|
||||
|
||||
- name: create site config
|
||||
template:
|
||||
src: site.conf.j2
|
||||
dest: "/etc/httpd/conf.local.d/{{ inventory_hostname }}.conf"
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
notify: restart apache
|
||||
|
||||
- name: enable apache
|
||||
service:
|
||||
name: httpd
|
||||
state: started
|
||||
enabled: true
|
Loading…
Add table
Add a link
Reference in a new issue