Compare commits
2 Commits
f5ba58c59e
...
4c19bba1fd
| Author | SHA1 | Date |
|---|---|---|
|
|
4c19bba1fd | |
|
|
9d08fba82c |
|
|
@ -13,7 +13,7 @@ jobs:
|
||||||
timeout-minutes: 1
|
timeout-minutes: 1
|
||||||
env:
|
env:
|
||||||
CI_JOB: 'ansible-test-molecule-${{ github.event.repository.name }}'
|
CI_JOB: 'ansible-test-molecule-${{ github.event.repository.name }}'
|
||||||
CI_DOMAIN: 'ci.ansibleguy.net'
|
CI_DOMAIN: 'ci.oss.oxl.app'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ jobs:
|
||||||
timeout-minutes: 1
|
timeout-minutes: 1
|
||||||
env:
|
env:
|
||||||
CI_JOB: 'ansible-test-molecule-${{ github.event.repository.name }}'
|
CI_JOB: 'ansible-test-molecule-${{ github.event.repository.name }}'
|
||||||
CI_DOMAIN: 'ci.ansibleguy.net'
|
CI_DOMAIN: 'ci.oss.oxl.app'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ jobs:
|
||||||
- name: Preparing for AnsibleLint
|
- name: Preparing for AnsibleLint
|
||||||
run: |
|
run: |
|
||||||
mkdir -p '/tmp/ansible_lint/roles/'
|
mkdir -p '/tmp/ansible_lint/roles/'
|
||||||
ln -s "${{ github.workspace }}" "/tmp/ansible_lint/roles/ansibleguy.${{ github.event.repository.name }}"
|
ln -s "${{ github.workspace }}" "/tmp/ansible_lint/roles/oxlorg.apache2"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Running AnsibleLint
|
- name: Running AnsibleLint
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,5 @@ The above copyright notice and this permission notice shall be included in all c
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
E-Mail: contact@ansibleguy.net
|
E-Mail: contact@oxl.at
|
||||||
Web: https://github.com/ansibleguy
|
Web: https://github.com/O-X-L
|
||||||
|
|
|
||||||
30
README.md
30
README.md
|
|
@ -4,16 +4,16 @@
|
||||||
|
|
||||||
Ansible Role to deploy one or multiple Apache2 sites on a linux server.
|
Ansible Role to deploy one or multiple Apache2 sites on a linux server.
|
||||||
|
|
||||||
[](https://github.com/ansibleguy/infra_apache/actions/workflows/lint.yml)
|
[](https://github.com/O-X-L/ansible-role-apache2/actions/workflows/lint.yml)
|
||||||
[](https://galaxy.ansible.com/ui/standalone/roles/ansibleguy/infra_apache)
|
[](https://galaxy.ansible.com/ui/standalone/roles/oxlorg/apache2)
|
||||||
|
|
||||||
**Molecule Integration-Tests**:
|
**Molecule Integration-Tests**:
|
||||||
|
|
||||||
* Status: [](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/molecule.sh.j2) |
|
* Status: [](https://github.com/O-X-L/ansible-role-oxl-cicd/blob/latest/templates/usr/local/bin/cicd/molecule.sh.j2) |
|
||||||
[](https://github.com/ansibleguy/infra_apache/actions/workflows/integration_test_result.yml)
|
[](https://github.com/O-X-L/ansible-role-apache2/actions/workflows/integration_test_result.yml)
|
||||||
* Logs: [API](https://ci.ansibleguy.net/api/job/ansible-test-molecule-infra_apache/logs?token=2b7bba30-9a37-4b57-be8a-99e23016ce70&lines=1000) | [Short](https://badges.ansibleguy.net/log/molecule_infra_apache_test_short.log) | [Full](https://badges.ansibleguy.net/log/molecule_infra_apache_test.log)
|
* Logs: [API](https://ci.oss.oxl.app/api/job/ansible-test-molecule-infra_apache/logs?token=2b7bba30-9a37-4b57-be8a-99e23016ce70&lines=1000) | [Short](https://badges.oss.oxl.app/log/molecule_infra_apache_test_short.log) | [Full](https://badges.oss.oxl.app/log/molecule_infra_apache_test.log)
|
||||||
|
|
||||||
Internal CI: [Tester Role](https://github.com/ansibleguy/_meta_cicd) | [Jobs API](https://github.com/O-X-L/github-self-hosted-jobs-systemd)
|
Internal CI: [Tester Role](https://github.com/O-X-L/ansible-role-oxl-cicd) | [Jobs API](https://github.com/O-X-L/github-self-hosted-jobs-systemd)
|
||||||
|
|
||||||
**Tested:**
|
**Tested:**
|
||||||
* Debian 11
|
* Debian 11
|
||||||
|
|
@ -25,13 +25,13 @@ Internal CI: [Tester Role](https://github.com/ansibleguy/_meta_cicd) | [Jobs API
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# latest
|
# latest
|
||||||
ansible-galaxy role install git+https://github.com/ansibleguy/infra_apache
|
ansible-galaxy role install git+https://github.com/O-X-L/ansible-role-apache2
|
||||||
|
|
||||||
# from galaxy
|
# from galaxy
|
||||||
ansible-galaxy install ansibleguy.infra_apache
|
ansible-galaxy install oxlorg.apache2
|
||||||
|
|
||||||
# or to custom role-path
|
# or to custom role-path
|
||||||
ansible-galaxy install ansibleguy.infra_apache --roles-path ./roles
|
ansible-galaxy install oxlorg.apache2 --roles-path ./roles
|
||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
ansible-galaxy install -r requirements.yml
|
ansible-galaxy install -r requirements.yml
|
||||||
|
|
@ -53,7 +53,7 @@ ansible-galaxy install -r requirements.yml
|
||||||
|
|
||||||
* You want a simple **Ansible GUI**?
|
* You want a simple **Ansible GUI**?
|
||||||
|
|
||||||
Check-out this [Ansible WebUI](https://github.com/ansibleguy/webui)
|
Check-out this [Ansible WebUI](https://github.com/O-X-L/ansible-webui)
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
@ -87,16 +87,16 @@ apache:
|
||||||
|
|
||||||
git_stuff:
|
git_stuff:
|
||||||
mode: 'redirect'
|
mode: 'redirect'
|
||||||
domain: 'ansibleguy.net'
|
domain: 'oxl.at'
|
||||||
aliases: ['www.ansibleguy.net']
|
aliases: ['www.oxl.at']
|
||||||
redirect:
|
redirect:
|
||||||
target: 'https://github.com/ansibleguy'
|
target: 'https://github.com/O-X-L'
|
||||||
|
|
||||||
ssl:
|
ssl:
|
||||||
mode: 'letsencrypt'
|
mode: 'letsencrypt'
|
||||||
|
|
||||||
letsencrypt:
|
letsencrypt:
|
||||||
email: 'apache@template.ansibleguy.net'
|
email: 'apache@template.oxl.at'
|
||||||
|
|
||||||
security:
|
security:
|
||||||
restrict_methods: false
|
restrict_methods: false
|
||||||
|
|
@ -147,7 +147,7 @@ ansible-playbook -K -D -i inventory/hosts.yml playbook.yml -e debug=yes
|
||||||
* IPv6 support disabled (*at least one ipv6 address MUST EXIST*)
|
* IPv6 support disabled (*at least one ipv6 address MUST EXIST*)
|
||||||
|
|
||||||
|
|
||||||
* **SSL modes** (_for more info see: [CERT ROLE](https://github.com/ansibleguy/infra_certs)_)
|
* **SSL modes** (_for more info see: [CERT ROLE](https://github.com/O-X-L/ansible-role-certs)_)
|
||||||
* **selfsigned** => Generate self-signed ones
|
* **selfsigned** => Generate self-signed ones
|
||||||
* **ca** => Generate a minimal Certificate Authority and certificate signed by it
|
* **ca** => Generate a minimal Certificate Authority and certificate signed by it
|
||||||
* **letsencrypt** => Uses the LetsEncrypt certbot
|
* **letsencrypt** => Uses the LetsEncrypt certbot
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ defaults_apache:
|
||||||
# 'Header set Permissions-Policy': '"none"'
|
# 'Header set Permissions-Policy': '"none"'
|
||||||
# 'Header set Content-Security-Policy': '"default-src https:; font-src https:; img-src https:; script-src https:; style-src https:;"'
|
# 'Header set Content-Security-Policy': '"default-src https:; font-src https:; img-src https:; script-src https:; style-src https:;"'
|
||||||
|
|
||||||
ssl: # see: https://github.com/ansibleguy/infra_certs
|
ssl: # see: https://github.com/O-X-L/ansible-role-certs
|
||||||
path: '/etc/apache2/ssl'
|
path: '/etc/apache2/ssl'
|
||||||
ca:
|
ca:
|
||||||
file: # can be used if you want to use an existing ca
|
file: # can be used if you want to use an existing ca
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
defaults_site:
|
defaults_site:
|
||||||
mode: 'serve'
|
mode: 'serve'
|
||||||
state: 'present'
|
state: 'present'
|
||||||
admin: 'apache@template.ansibleguy.net'
|
admin: 'apache@template.oxl.at'
|
||||||
port_plain: 80
|
port_plain: 80
|
||||||
port_ssl: 443
|
port_ssl: 443
|
||||||
listen: '*'
|
listen: '*'
|
||||||
|
|
@ -30,17 +30,17 @@ defaults_site:
|
||||||
deny_dangerous_methods: true # if 'restrict_methods' is disabled - this will still deny 'TRACE' & 'CONNECT' as they might open your server/services up to attacks
|
deny_dangerous_methods: true # if 'restrict_methods' is disabled - this will still deny 'TRACE' & 'CONNECT' as they might open your server/services up to attacks
|
||||||
|
|
||||||
redirect:
|
redirect:
|
||||||
target: 'https://github.com/ansibleguy'
|
target: 'https://github.com/O-X-L'
|
||||||
request_uri: false
|
request_uri: false
|
||||||
|
|
||||||
serve:
|
serve:
|
||||||
path: '/var/www/html'
|
path: '/var/www/html'
|
||||||
|
|
||||||
ssl: # see: https://github.com/ansibleguy/infra_certs
|
ssl: # see: https://github.com/O-X-L/ansible-role-certs
|
||||||
mode: 'snakeoil' # existing/selfsigned/ca/letsencrypt/snakeoil
|
mode: 'snakeoil' # existing/selfsigned/ca/letsencrypt/snakeoil
|
||||||
# existing:
|
# existing:
|
||||||
# We expect the certs to be placed in the role's 'files' directory named like the site
|
# We expect the certs to be placed in the role's 'files' directory named like the site
|
||||||
# Example: files/certs/ansibleguy.key and files/certs/ansibleguy.crt
|
# Example: files/certs/oxlorg.key and files/certs/oxlorg.crt
|
||||||
# letsencrypt:
|
# letsencrypt:
|
||||||
# Host needs to have a valid public dns record pointed at it
|
# Host needs to have a valid public dns record pointed at it
|
||||||
# Needs to be publicly reachable over port 80/tcp
|
# Needs to be publicly reachable over port 80/tcp
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ class FilterModule(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def ensure_list(data: (str, list)) -> list:
|
def ensure_list(data: (str, list)) -> list:
|
||||||
# if user supplied a string instead of a list => convert it to match our expectations
|
# if user supplied a string instead of a list => convert it to match our expectations
|
||||||
|
if data is None:
|
||||||
|
return []
|
||||||
|
|
||||||
if isinstance(data, list):
|
if isinstance(data, list):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,22 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: 'AnsibleGuy <guy@ansibleguy.net>'
|
author: 'Rath Pascal <contact@oxl.at>'
|
||||||
namespace: 'ansibleguy'
|
namespace: 'oxlorg'
|
||||||
license: 'MIT'
|
license: 'MIT'
|
||||||
issue_tracker_url: 'https://github.com/ansibleguy/infra_apache/issues'
|
issue_tracker_url: 'https://github.com/O-X-L/ansible-role-apache2/issues'
|
||||||
min_ansible_version: '2.14'
|
min_ansible_version: '2.14'
|
||||||
description: 'Role to deploy apache2 sites on a linux server'
|
description: 'Role to deploy apache2 sites on a linux server'
|
||||||
platforms:
|
platforms:
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
- bullseye
|
- bullseye
|
||||||
|
- bookworm
|
||||||
|
- trixies
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- 'web'
|
- 'web'
|
||||||
- 'webserver'
|
- 'webserver'
|
||||||
- 'apache'
|
- 'apache2'
|
||||||
|
|
||||||
collections:
|
collections:
|
||||||
- 'community.crypto'
|
- 'community.crypto'
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@ Check out the [Molecule Tutorial](https://github.com/ansibleguy/ansible_tutorial
|
||||||
# Running
|
# Running
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd roles/ansibleguy.sw_zoneminder
|
cd roles/oxlorg.apache2
|
||||||
molecule test
|
molecule test
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,14 @@
|
||||||
apache:
|
apache:
|
||||||
sites:
|
sites:
|
||||||
test1:
|
test1:
|
||||||
domain: 'apache2.test.ansibleguy.net'
|
domain: 'apache2.test.oxl.at'
|
||||||
|
|
||||||
ssl:
|
ssl:
|
||||||
mode: 'snakeoil'
|
mode: 'snakeoil'
|
||||||
cert:
|
cert:
|
||||||
cn: 'Apache2'
|
cn: 'Apache2'
|
||||||
org: 'AnsibleGuy Test'
|
org: 'AnsibleGuy Test'
|
||||||
email: 'testmaster@ansibleguy.net'
|
email: 'testmaster@oxl.at'
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- ansibleguy.infra_apache
|
- oxlorg.apache2
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,4 @@
|
||||||
become: true
|
become: true
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
roles:
|
roles:
|
||||||
- ansibleguy.infra_apache
|
- oxlorg.apache2
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,5 @@ collections:
|
||||||
- 'community.general'
|
- 'community.general'
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- src: 'ansibleguy.infra_certs'
|
- name: 'oxlorg.certs'
|
||||||
|
src: 'git+https://github.com/O-X-L/ansible-role-certs'
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
- name: "Apache | Site '{{ name }}' | Certs | Creating certificates"
|
- name: "Apache | Site '{{ name }}' | Certs | Creating certificates"
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
name: ansibleguy.infra_certs
|
name: oxlorg.certs
|
||||||
vars:
|
vars:
|
||||||
certs:
|
certs:
|
||||||
mode: "{{ site.ssl.mode }}"
|
mode: "{{ site.ssl.mode }}"
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
# is an additional site-loop since certificates can be pre-/absent
|
# is an additional site-loop since certificates can be pre-/absent
|
||||||
- name: Apache | Getting certificates using LetsEncrypt
|
- name: Apache | Getting certificates using LetsEncrypt
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
name: ansibleguy.infra_certs
|
name: oxlorg.certs
|
||||||
when: site.ssl.mode == 'letsencrypt'
|
when: site.ssl.mode == 'letsencrypt'
|
||||||
vars:
|
vars:
|
||||||
site: "{{ defaults_site | combine(site_item.value, recursive=true) }}"
|
site: "{{ defaults_site | combine(site_item.value, recursive=true) }}"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
# ansibleguy.infra_apache
|
# oxlorg.apache2
|
||||||
|
|
||||||
{% include "inc/site_http.j2" %}
|
{% include "inc/site_http.j2" %}
|
||||||
{% include "inc/site_https.j2" %}
|
{% include "inc/site_https.j2" %}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
# ansibleguy.infra_apache
|
# oxlorg.apache2
|
||||||
|
|
||||||
<VirtualHost {{ APACHE_CONFIG.status_page.bind }}:{{ APACHE_CONFIG.status_page.port }}>
|
<VirtualHost {{ APACHE_CONFIG.status_page.bind }}:{{ APACHE_CONFIG.status_page.port }}>
|
||||||
# log config
|
# log config
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue