Skip to content

Commit

Permalink
Merge branch 'master' into IMP-more-flexible-vhosts
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdebock authored Sep 23, 2023
2 parents b1e7c07 + 2f2a5ca commit 59fd0dd
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 52 deletions.
16 changes: 8 additions & 8 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Ansible managed
#
exclude_paths:
- ./molecule/default/prepare.yml
- ./molecule/default/converge.yml
- ./molecule/default/verify.yml
- ./molecule/default/collections.yml
- ./.tox
- ./.cache
- ./.github
- ./requirements.yml
- molecule/default/prepare.yml
- molecule/default/converge.yml
- molecule/default/verify.yml
- molecule/default/collections.yml
- .tox
- .cache
- .github
- requirements.yml

skip_list:
- yaml[truthy]
Expand Down
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
repository:
description: Install and configure httpd on your system.
homepage: https://robertdebock.nl/
topics: webserver, apache, httpd, installer, package, ansible, molecule, tox, playbook
topics: webserver, apache, httpd, installer, package, system, networking, ansible, molecule, tox, playbook
8 changes: 4 additions & 4 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ jobs:
config:
- image: "enterpriselinux"
tag: "8"
- image: "enterpriselinux"
tag: "latest"
- image: "debian"
tag: "latest"
- image: "debian"
tag: "bookworm"
tag: "bullseye"
- image: "fedora"
tag: "36"
tag: "37"
- image: "fedora"
tag: "latest"
- image: "fedora"
tag: "rawhide"
- image: "opensuse"
tag: "latest"
- image: "ubuntu"
Expand Down
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ molecule:
matrix:
- image: "enterpriselinux"
tag: "8"
- image: "enterpriselinux"
tag: "latest"
- image: "debian"
tag: "latest"
- image: "debian"
tag: "bookworm"
tag: "bullseye"
- image: "fedora"
tag: "36"
tag: "37"
- image: "fedora"
tag: "latest"
- image: "fedora"
tag: "rawhide"
- image: "opensuse"
tag: "latest"
- image: "ubuntu"
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files

- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
rev: v1.32.0
hooks:
- id: yamllint
args: [-c=.yamllint]
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ Here is an overview of related roles:

This role has been tested on these [container images](https://hub.docker.com/u/robertdebock):

| container | tags |
| ----------------------------------------------------------------------------------- | ---- |
| [EL](https://hub.docker.com/repository/docker/robertdebock/enterpriselinux/general) | 8 |
| [Debian](https://hub.docker.com/repository/docker/robertdebock/debian/general) | all |
| [Fedora](https://hub.docker.com/repository/docker/robertdebock/fedora/general) | all |
| [opensuse](https://hub.docker.com/repository/docker/robertdebock/opensuse/general) | all |
| [Ubuntu](https://hub.docker.com/repository/docker/robertdebock/ubuntu/general) | all |
|container|tags|
|---------|----|
|[EL](https://hub.docker.com/repository/docker/robertdebock/enterpriselinux/general)|8, 9|
|[Debian](https://hub.docker.com/repository/docker/robertdebock/debian/general)|all|
|[Fedora](https://hub.docker.com/repository/docker/robertdebock/fedora/general)|all|
|[opensuse](https://hub.docker.com/repository/docker/robertdebock/opensuse/general)|all|
|[Ubuntu](https://hub.docker.com/repository/docker/robertdebock/ubuntu/general)|all|

The minimum version of Ansible required is 2.12, tests have been done to:

Expand Down
3 changes: 3 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ galaxy_info:
- name: EL
versions:
- "8"
- "9"
- name: Debian
versions:
- all
Expand All @@ -30,5 +31,7 @@ galaxy_info:
- httpd
- installer
- package
- system
- networking

dependencies: []
44 changes: 26 additions & 18 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
- name: assert | Test if httpd_servername is set correctly
- name: assert | Test httpd_servername
ansible.builtin.assert:
that:
- httpd_servername is defined
- httpd_servername is string
- httpd_servername is not none
quiet: yes

- name: assert | Test if httpd_port is set correctly
- name: assert | Test httpd_port
ansible.builtin.assert:
that:
- httpd_port is defined
Expand All @@ -15,21 +16,22 @@
- httpd_port < 65536
quiet: yes

- name: assert | Test if https_ssl_enable is set correctly
- name: assert | Test https_ssl_enable
ansible.builtin.assert:
that:
- https_ssl_enable is defined
- https_ssl_enable is boolean
quiet: yes

- name: assert | Test if httpd_ssl_servername is set correctly
- name: assert | Test httpd_ssl_servername
ansible.builtin.assert:
that:
- httpd_ssl_servername is defined
- httpd_ssl_servername is string
- httpd_ssl_servername is not none
quiet: yes

- name: assert | Test if httpd_ssl_port is set correctly
- name: assert | Test httpd_ssl_port
ansible.builtin.assert:
that:
- httpd_ssl_port is defined
Expand All @@ -39,43 +41,47 @@
- httpd_ssl_port != httpd_port
quiet: yes

- name: assert | Test if httpd_locations is set correctly
- name: assert | Test httpd_locations
ansible.builtin.assert:
that:
- httpd_locations is iterable
quiet: yes
when:
- httpd_locations is defined

- name: assert | Test if item in httpd_locations is set correctly
- name: assert | Test item in httpd_locations
ansible.builtin.assert:
that:
- item.name is defined
- item.name is string
- item.name is not none
- item.location is defined
- item.location is string
- item.location is not none
- item.backend_url is defined
- item.backend_url is string
- item.backend_url is not none
quiet: yes
loop: "{{ httpd_locations }}"
loop_control:
label: "{{ item.name }}"
when:
- httpd_locations is defined

- name: assert | Test if httpd_vhosts is set correctly
- name: assert | Test httpd_vhosts
ansible.builtin.assert:
that:
- httpd_vhosts is iterable
quiet: yes
when:
- httpd_vhosts is defined

- name: assert | Test if item in httpd_vhosts is set correctly
- name: assert | Test item in httpd_vhosts
ansible.builtin.assert:
that:
- item.name is defined
- item.name is string
- item.name is not none
- item.servername is defined
- item.servername is string
quiet: yes
Expand All @@ -85,7 +91,7 @@
when:
- httpd_vhosts is defined

- name: assert | Test if item.create_docroot in httpd_vhosts is set correctly
- name: assert | Test item.create_docroot in httpd_vhosts
ansible.builtin.assert:
that:
- item.create_docroot is boolean
Expand All @@ -97,7 +103,7 @@
- httpd_vhosts is defined
- item.create_docroot is defined

- name: assert | Test if item.serveralias in httpd_vhosts is set correctly
- name: assert | Test item.serveralias in httpd_vhosts
ansible.builtin.assert:
that:
- item.serveralias is iterable
Expand All @@ -109,21 +115,22 @@
- httpd_vhosts is defined
- item.serveralias is defined

- name: assert | Test if httpd_directories is set correctly
- name: assert | Test httpd_directories
ansible.builtin.assert:
that:
- httpd_directories is iterable
quiet: yes
when:
- httpd_directories is defined

- name: assert | Test if item.name in httpd_directories is set correctly
- name: assert | Test item.name in httpd_directories
ansible.builtin.assert:
that:
- item.name is defined
- item.name is string
- item.name is not none
- item.path is defined
- item.path is string
- item.path is not none
- item.option is defined or item.allow_override is defined
quiet: yes
loop: "{{ httpd_directories }}"
Expand All @@ -132,7 +139,7 @@
when:
- httpd_directories is defined

- name: assert | Test if item.options in httpd_directories is set correctly
- name: assert | Test item.options in httpd_directories
ansible.builtin.assert:
that:
- item.options is iterable
Expand All @@ -144,10 +151,11 @@
- httpd_directories is defined
- item.options is defined

- name: assert | Test if item.allow_override in httpd_directories is set correctly
- name: assert | Test item.allow_override in httpd_directories
ansible.builtin.assert:
that:
- item.allow_override is string
- item.allow_override is not none
quiet: yes
loop: "{{ httpd_directories }}"
loop_control:
Expand All @@ -156,14 +164,14 @@
- httpd_directories is defined
- item.allow_override is defined

- name: assert | Test if httpd_remove_example is set correctly
- name: assert | Test httpd_remove_example
ansible.builtin.assert:
that:
- httpd_remove_example is defined
- httpd_remove_example is boolean
quiet: yes

- name: assert | Test if httpd_additionnal_modules is set correctly
- name: assert | Test httpd_additionnal_modules
ansible.builtin.assert:
that:
- httpd_additionnal_modules is defined
Expand Down
17 changes: 11 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# tasks file for httpd

- name: Import assert.yml
ansible.builtin.import_tasks: assert.yml
run_once: true
ansible.builtin.import_tasks:
file: assert.yml
run_once: yes
delegate_to: localhost

- name: Install apache httpd
Expand Down Expand Up @@ -56,17 +57,20 @@
- Test httpd configuration validity

- name: Import ssl.yml
ansible.builtin.import_tasks: ssl.yml
ansible.builtin.import_tasks:
file: ssl.yml
when:
- https_ssl_enable

- name: Import locations.yml
ansible.builtin.import_tasks: locations.yml
ansible.builtin.import_tasks:
file: locations.yml
when:
- httpd_locations is defined

- name: Import vhosts.yml
ansible.builtin.import_tasks: vhosts.yml
ansible.builtin.import_tasks:
file: vhosts.yml
when:
- httpd_vhosts is defined

Expand All @@ -82,7 +86,8 @@
- ansible_os_family in [ "Debian", "Suse" ]

- name: Import directories.yml
ansible.builtin.import_tasks: directories.yml
ansible.builtin.import_tasks:
file: directories.yml
when:
- httpd_directories is defined

Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#
[tox]
minversion = 4.2.4
envlist = py{310}-ansible{5,6,7}
envlist = py{310}-ansible{6,7,8}

skipsdist = true

[testenv]
deps =
-rrequirements.txt
ansible5: ansible == 5.*
ansible6: ansible == 6.*
ansible7: ansible == 7.*
ansible8: ansible == 8.*
commands = molecule test
setenv =
TOX_ENVNAME={envname}
Expand Down

0 comments on commit 59fd0dd

Please sign in to comment.