Skip to content

Commit 34bb6b1

Browse files
committed
feat: allow custom confs
Merge branch 'InstruktoriBrno-custom_config' into master
2 parents 737fb2d + 8e07b39 commit 34bb6b1

File tree

7 files changed

+33
-4
lines changed

7 files changed

+33
-4
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
*.retry
33
.DS_Store
44
.vagrant
5-
.vscode
5+
.vscode/*
6+
!.vscode/settings.json
7+
!.vscode/extensions.json
68
.idea

.vscode/extensions.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"vscoss.vscode-ansible"
4+
]
5+
}

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"*.yml": "ansible"
4+
}
5+
}

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ PWD=$(shell pwd)
22
ROLE_NAME=weareinteractive.apache2
33
ROLE_PATH=/etc/ansible/roles/$(ROLE_NAME)
44
TEST_VERSION=ansible --version
5-
TEST_DEPS=ansible-galaxy install -c weareinteractive.apt weareinteractive.openssl weareinteractive.htpasswd
5+
TEST_DEPS=apt-get update && apt-get install -y python3-pip && pip3 install pyopenssl && ansible-galaxy install -c weareinteractive.apt weareinteractive.openssl weareinteractive.htpasswd
66
TEST_SYNTAX=ansible-playbook -v -i 'localhost,' -c local $(ROLE_PATH)/tests/main.yml --syntax-check
7-
TEST_PLAYBOOK=ansible-playbook -vvvv -i 'localhost,' -c local $(ROLE_PATH)/tests/main.yml
7+
TEST_PLAYBOOK=ansible-playbook -vvvv -i 'localhost,' -c local -e 'ansible_python_interpreter=/usr/bin/python3' $(ROLE_PATH)/tests/main.yml
88
TEST_IDEMPOTENT=$(TEST_PLAYBOOK) | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
9-
TEST_CMD=$(TEST_VERSION); $(TEST_SYNTAX); $(TEST_DEPS); $(TEST_PLAYBOOK); $(TEST_IDEMPOTENT)
9+
TEST_CMD=$(TEST_DEPS); $(TEST_VERSION); $(TEST_SYNTAX); $(TEST_PLAYBOOK); $(TEST_IDEMPOTENT)
1010

1111
docs:
1212
ansible-role docgen

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: test and reload apache2
13+
314
- name: Enabling conf
415
command: >
516
a2enconf {{ item.id }}

0 commit comments

Comments
 (0)