Add option to install additional apache modules via apt

This commit is contained in:
s3lph 2023-01-23 22:31:15 +01:00
parent 8e1af6a2e1
commit 9facd9f7eb
8 changed files with 17 additions and 12 deletions

View file

@ -8,7 +8,7 @@ namespace: s3lph
name: webserver
# The version of the collection. Must be compatible with semantic versioning
version: 0.2.0
version: 0.2.1
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

View file

@ -24,6 +24,7 @@ apache2_tls_ciphersuite: "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA
apache2_tls_honor_cipher_order: false
apache2_tls_session_tickets: false
apache2_module_packages: []
apache2_modules:
- ssl
- proxy_http

View file

@ -9,7 +9,7 @@
- meta: flush_handlers
- name: check for tls keypair existence
stat:
ansible.builtin.stat:
path: "{{ item }}"
follow: yes
loop: |
@ -33,7 +33,7 @@
loop: "{{ apache2_sites.values() }}"
- name: render apache site configs
template:
ansible.builtin.template:
src: etc/apache2/sites-available/site.conf.j2
dest: "/etc/apache2/sites-available/{{ item.key }}.conf"
owner: root
@ -48,7 +48,7 @@
notify: reload apache2
- name: enable apache2 sites
file:
ansible.builtin.file:
path: "/etc/apache2/sites-enabled/{{ item }}.conf"
state: link
src: "../sites-available/{{ item }}.conf"

View file

@ -1,13 +1,17 @@
---
- name: install apache2 and related packages
apt:
ansible.builtin.apt:
name:
- apache2
- ssl-cert # snakeoil cert used for optional tls bootstrapping
- name: install apache2 and related packages
ansible.builtin.apt:
name: "{{ apache2_module_packages }}"
- name: start and enable apache2
service:
ansible.builtin.service:
name: apache2
state: started
enabled: yes

View file

@ -1,11 +1,11 @@
---
- import_tasks: install.yml
- ansible.builtin.import_tasks: install.yml
tags:
- "role::apache2"
- "role::apache2:install"
- import_tasks: config.yml
- ansible.builtin.import_tasks: config.yml
tags:
- "role::apache2"
- "role::apache2:config"

View file

@ -1,7 +1,7 @@
---
- name: install certbot
apt:
ansible.builtin.apt:
name:
- certbot

View file

@ -1,7 +1,7 @@
---
- name: issue certificates
command: >-
ansible.builtin.command: >-
/usr/bin/certbot certonly
--server {{ cert.server | default(certbot_acme_server) }}
--agree-tos

View file

@ -1,11 +1,11 @@
---
- import_tasks: install.yml
- ansible.builtin.import_tasks: install.yml
tags:
- "role::certbot"
- "role::certbot:install"
- import_tasks: issue.yml
- ansible.builtin.import_tasks: issue.yml
tags:
- "role::certbot"
- "role::certbot:issue"