Skip to content

Commit 0dde125

Browse files
committed
Enable creating custom confs
1 parent d298926 commit 0dde125

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Here is a list of all the default variables for this role, which are also availa
6060
# apache2_confs:
6161
# - { id: security, state: absent }
6262
# - { name: mime, state: present }
63+
# - id: my_config
64+
# state: present
65+
# template: path/to/template.j2
6366
# apache2_sites:
6467
# - id: mysite (required)
6568
# name: mysite.local (required)

defaults/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
# apache2_confs:
99
# - { id: security, state: absent }
1010
# - { name: mime, state: present }
11+
# - id: my_config
12+
# state: present
13+
# template: path/to/template.j2
1114
# apache2_sites:
1215
# - id: mysite (required)
1316
# name: mysite.local (required)

tasks/manage_confs.yml

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
---
22

3+
- name: Creating confs
4+
template:
5+
src: "{{ item.template }}"
6+
dest: "/etc/apache2/conf-available/{{ item.id }}.conf"
7+
owner: root
8+
group: root
9+
mode: "0644"
10+
when: item.template is defined
11+
with_items: "{{ apache2_confs }}"
12+
notify: reload apache2
13+
314
- name: Enabling conf
415
command: >
516
a2enconf {{ item.id }}

0 commit comments

Comments
 (0)