diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 00000000..55572942 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,2 @@ +skip_list: + - '106' diff --git a/.travis.yml b/.travis.yml index 2574ff05..6eb53a60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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. diff --git a/.yamllint b/.yamllint index a3dbc38e..f2033dd2 100644 --- a/.yamllint +++ b/.yamllint @@ -1,6 +1,11 @@ --- extends: default + rules: line-length: max: 120 level: warning + +ignore: | + .github/stale.yml + .travis.yml diff --git a/README.md b/README.md index 113da0d8..8689eacb 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/defaults/main.yml b/defaults/main.yml index 009a9689..056d84d0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/configure-Debian.yml b/tasks/configure-Debian.yml index be515889..4564203a 100644 --- a/tasks/configure-Debian.yml +++ b/tasks/configure-Debian.yml @@ -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 @@ -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 diff --git a/tasks/configure-RedHat.yml b/tasks/configure-RedHat.yml index 4bc6280b..22e60e72 100644 --- a/tasks/configure-RedHat.yml +++ b/tasks/configure-RedHat.yml @@ -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 @@ -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 @@ -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 diff --git a/tasks/configure-Solaris.yml b/tasks/configure-Solaris.yml index c857d672..91c594f8 100644 --- a/tasks/configure-Solaris.yml +++ b/tasks/configure-Solaris.yml @@ -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 diff --git a/tasks/configure-Suse.yml b/tasks/configure-Suse.yml index 254cf1fe..d11b2d67 100644 --- a/tasks/configure-Suse.yml +++ b/tasks/configure-Suse.yml @@ -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