Skip to content

Commit

Permalink
Add filename to taskname, cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed May 22, 2023
1 parent 2845be7 commit 03f815d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ exclude_paths:

skip_list:
- yaml[truthy]

enable_list:
- name[prefix]
32 changes: 16 additions & 16 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---

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

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

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

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

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

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

- name: Test if item in httpd_locations is set correctly
- name: assert | Test if item in httpd_locations is set correctly
ansible.builtin.assert:
that:
- item.name is defined
Expand All @@ -64,15 +64,15 @@
when:
- httpd_locations is defined

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

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

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

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

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

- name: Test if item.name in httpd_directories is set correctly
- name: assert | Test if item.name in httpd_directories is set correctly
ansible.builtin.assert:
that:
- item.name is defined
Expand All @@ -133,7 +133,7 @@
when:
- httpd_directories is defined

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

- name: Test if item.allow_override in httpd_directories is set correctly
- name: assert | Test if item.allow_override in httpd_directories is set correctly
ansible.builtin.assert:
that:
- item.allow_override is string
Expand All @@ -157,7 +157,7 @@
- httpd_directories is defined
- item.allow_override is defined

- name: Test if httpd_remove_example is set correctly
- name: assert | Test if httpd_remove_example is set correctly
ansible.builtin.assert:
that:
- httpd_remove_example is defined
Expand Down
4 changes: 2 additions & 2 deletions tasks/directories.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: Create directories
- name: directories | Create directories
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
Expand All @@ -9,7 +9,7 @@
loop_control:
label: "{{ item.path }}"

- name: Configure directories
- name: directories | Configure directories
ansible.builtin.template:
src: directory.conf.j2
dest: "{{ httpd_config_directory }}/{{ item.name }}.conf"
Expand Down
4 changes: 2 additions & 2 deletions tasks/locations.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: Enable modules
- name: locations | Enable modules
community.general.apache2_module:
name: "{{ item }}"
state: present
Expand All @@ -10,7 +10,7 @@
when:
- ansible_os_family in [ "Debian", "Suse" ]

- name: Configure locations
- name: locations | Configure locations
ansible.builtin.template:
src: location.conf.j2
dest: "{{ httpd_config_directory }}/{{ item.name }}.conf"
Expand Down
6 changes: 3 additions & 3 deletions tasks/ssl.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---

- name: Install ssl packages
- name: ssl | Install ssl packages
ansible.builtin.package:
name: "{{ httpd_ssl_packages }}"
state: present

- name: Place configuration
- name: ssl | Place configuration
ansible.builtin.template:
src: ssl.conf.j2
dest: "{{ httpd_config_directory }}/ssl.conf"
Expand All @@ -14,7 +14,7 @@
- Test httpd configuration validity
- Restart httpd

- name: Configure redirect from http to https
- name: ssl | Configure redirect from http to https
ansible.builtin.template:
src: default_vhost.conf.j2
dest: "{{ httpd_config_directory }}/default_vhost.conf"
Expand Down
4 changes: 2 additions & 2 deletions tasks/vhosts.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: Create docroot
- name: vhosts | Create docroot
ansible.builtin.file:
path: "{{ item.documentroot }}"
state: directory
Expand All @@ -13,7 +13,7 @@
- item.documentroot is defined
- item.create_docroot is not defined or item.create_docroot

- name: Configure vhosts
- name: vhosts | Configure vhosts
ansible.builtin.template:
src: vhost.conf.j2
dest: "{{ httpd_config_directory }}/{{ item.name }}.conf"
Expand Down

0 comments on commit 03f815d

Please sign in to comment.