Skip to content

Commit

Permalink
Merge pull request #21 from wcm-io-devops/feature/change_vhosts_path_…
Browse files Browse the repository at this point in the history
…on_rhel_8

Make vhosts path on RHEL/CentOS customizable + Merge upstrean master
  • Loading branch information
bellackn authored Oct 28, 2020
2 parents 4447734 + 83f2c81 commit 7af8252
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
skip_list:
- '106'
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ env:
- MOLECULE_DISTRO: debian10
- MOLECULE_DISTRO: debian9

before_install:
# Upgrade Docker to work with docker-py.
- curl https://gist.githubusercontent.com/geerlingguy/ce883ad4aec6a5f1187ef93bd338511e/raw/36612d28981d92863f839c5aefe5b7dd7193d6c6/travis-ci-docker-upgrade.sh | sudo bash

install:
# Install test dependencies.
- pip install molecule yamllint ansible-lint "docker<4.3.0" --upgrade
- pip install molecule[docker] yamllint ansible-lint docker

before_script:
# Use actual Ansible Galaxy role name for the project directory.
Expand Down
5 changes: 5 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
extends: default

rules:
line-length:
max: 120
level: warning

ignore: |
.github/stale.yml
.travis.yml
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ If you have enabled any additional repositories such as _ondrej/apache2_, [geerl

If you would like to only create SSL vhosts when the vhost certificate is present (e.g. when using Let’s Encrypt), set `apache_ignore_missing_ssl_certificate` to `false`. When doing this, you might need to run your playbook more than once so all the vhosts are configured (if another part of the playbook generates the SSL certificates).

#apache_rhel_custom_vhosts_path: /etc/httpd/vhosts.d

On RHEL/CentOS, in some occasions you might want to use a custom directory for your
virtual host files instead of `/etc/httpd/conf.d`. Use this variable then.

## .htaccess-based Basic Authorization

If you require Basic Auth support, you can add it either through a custom template, or by adding `extra_parameters` to a VirtualHost configuration, like so:
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ apache_restart_state: restarted
# Apache package state; use `present` to make sure it's installed, or `latest`
# if you want to upgrade or switch versions using a new repo.
apache_packages_state: present

# On RHEL/CentOS, in some occasions you might want to use a custom directory for your
# virtual host files instead of /etc/httpd/conf.d. Use this variable then.
#apache_rhel_custom_vhosts_path: /etc/httpd/vhosts.d
2 changes: 2 additions & 0 deletions tasks/configure-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: present
mode: 0644
with_items: "{{ apache_ports_configuration_items }}"
when: item.line is defined
notify: restart apache
Expand Down Expand Up @@ -59,6 +60,7 @@
src: "{{ apache_conf_path }}/sites-available/{{ apache_vhosts_filename }}"
dest: "{{ apache_conf_path }}/sites-enabled/{{ apache_vhosts_filename }}"
state: link
mode: 0644
notify: restart apache
when: apache_create_vhosts | bool

Expand Down
5 changes: 3 additions & 2 deletions tasks/configure-RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: present
mode: 0644
with_items: "{{ apache_ports_configuration_items }}"
when: item.line is defined
notify: restart apache
Expand All @@ -75,7 +76,7 @@
- name: Add apache vhosts configuration.
template:
src: "{{ apache_vhosts_template }}"
dest: "{{ apache_conf_path }}/{{ apache_vhosts_filename }}"
dest: "{{ apache_rhel_custom_vhosts_path | default(apache_conf_path) }}/{{ apache_vhosts_filename }}"
owner: root
group: root
mode: 0644
Expand All @@ -84,7 +85,7 @@

- name: Remove apache vhosts configuration.
file:
path: "{{ apache_conf_path }}/{{ apache_vhosts_filename }}"
path: "{{ apache_rhel_custom_vhosts_path | default(apache_conf_path) }}/{{ apache_vhosts_filename }}"
state: absent
notify: restart apache
when: not apache_create_vhosts
1 change: 1 addition & 0 deletions tasks/configure-Solaris.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: present
mode: 0644
with_items: "{{ apache_ports_configuration_items }}"
when: item.line is defined
notify: restart apache
Expand Down
1 change: 1 addition & 0 deletions tasks/configure-Suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: present
mode: 0644
with_items: "{{ apache_ports_configuration_items }}"
when: item.line is defined
notify: restart apache
Expand Down

0 comments on commit 7af8252

Please sign in to comment.