From 71f928b9f143c5c78bf7cd615313bcfe040e0b00 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 25 Sep 2018 21:36:20 -0500 Subject: [PATCH 01/15] Fix a few ansible-lint issues. --- tasks/main.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 0c971753..21823213 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,7 +17,7 @@ # Figure out what version of Apache is installed. - name: Get installed version of Apache. - shell: "{{ apache_daemon_path }}{{ apache_daemon }} -v" + command: "{{ apache_daemon_path }}{{ apache_daemon }} -v" changed_when: false check_mode: no register: _apache_version @@ -26,14 +26,17 @@ set_fact: apache_version: "{{ _apache_version.stdout.split()[2].split('/')[1] }}" -- include_vars: apache-22.yml +- name: Include Apache 2.2 variables. + include_vars: apache-22.yml when: "apache_version.split('.')[1] == '2'" -- include_vars: apache-24.yml +- name: Include Apache 2.4 variables. + include_vars: apache-24.yml when: "apache_version.split('.')[1] == '4'" # Configure Apache. -- include_tasks: "configure-{{ ansible_os_family }}.yml" +- name: Configure Apache. + include_tasks: "configure-{{ ansible_os_family }}.yml" - name: Ensure Apache has selected state and enabled on boot. service: From c71fb7f2040eae979a71c20d07415200a29efac6 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 25 Sep 2018 22:11:49 -0500 Subject: [PATCH 02/15] Fixes #156: Switch tests to use Molecule. --- .gitignore | 3 ++- .travis.yml | 35 +++++++++++++++++--------- molecule/default/molecule.yml | 25 ++++++++++++++++++ molecule/default/playbook.yml | 21 ++++++++++++++++ molecule/default/tests/test_default.py | 14 +++++++++++ tests/README.md | 11 -------- tests/test.yml | 13 ---------- 7 files changed, 85 insertions(+), 37 deletions(-) create mode 100644 molecule/default/molecule.yml create mode 100644 molecule/default/playbook.yml create mode 100644 molecule/default/tests/test_default.py delete mode 100644 tests/README.md delete mode 100644 tests/test.yml diff --git a/.gitignore b/.gitignore index c9b2377e..f56f5b57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.retry -tests/test.sh +*/__pycache__ +*.pyc diff --git a/.travis.yml b/.travis.yml index 2992c92c..6f0d3021 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,33 @@ --- +language: python services: docker env: - - distro: centos7 - - distro: centos6 - - distro: ubuntu1804 - - distro: ubuntu1604 - - distro: ubuntu1404 - - distro: debian9 - - distro: debian8 + global: + - ROLE_NAME: apache + matrix: + - MOLECULE_DISTRO: centos7 + MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd + - MOLECULE_DISTRO: centos6 + - MOLECULE_DISTRO: ubuntu1804 + - MOLECULE_DISTRO: ubuntu1604 + - MOLECULE_DISTRO: ubuntu1404 + - MOLECULE_DISTRO: debian9 + - MOLECULE_DISTRO: debian9 -script: - # Download test shim. - - wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/ - - chmod +x ${PWD}/tests/test.sh +install: + # Install test dependencies. + - pip install molecule docker + +before_script: + # Use actual Ansible Galaxy role name for the project directory. + - cd ../ + - mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME + - cd geerlingguy.$ROLE_NAME +script: # Run tests. - - ${PWD}/tests/test.sh + - molecule test notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 00000000..e3d6e333 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,25 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: + name: yamllint +platforms: + - name: instance + image: geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible + command: ${MOLECULE_DOCKER_COMMAND:-"sleep infinity"} + privileged: true + pre_build_image: true +provisioner: + name: ansible + lint: + name: ansible-lint + playbooks: + converge: ${MOLECULE_PLAYBOOK:-playbook.yml} +scenario: + name: default +verifier: + name: testinfra + lint: + name: flake8 diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml new file mode 100644 index 00000000..416a2b96 --- /dev/null +++ b/molecule/default/playbook.yml @@ -0,0 +1,21 @@ +--- +- name: Converge + hosts: all + become: true + + vars: + apache_listen_port_ssl: 443 + apache_create_vhosts: true + apache_vhosts_filename: "vhosts.conf" + apache_vhosts: + - servername: "example.com" + documentroot: "/var/www/vhosts/example_com" + + pre_tasks: + - name: Update apt cache. + apt: update_cache=yes cache_valid_time=600 + when: ansible_os_family == 'Debian' + changed_when: false + + roles: + - role: geerlingguy.apache diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py new file mode 100644 index 00000000..eedd64a1 --- /dev/null +++ b/molecule/default/tests/test_default.py @@ -0,0 +1,14 @@ +import os + +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_hosts_file(host): + f = host.file('/etc/hosts') + + assert f.exists + assert f.user == 'root' + assert f.group == 'root' diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 6fb21172..00000000 --- a/tests/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Ansible Role tests - -To run the test playbook(s) in this directory: - - 1. Install and start Docker. - 1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`: - - `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/` - 1. Make the test shim executable: `chmod +x tests/test.sh`. - 1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh` - -If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)` diff --git a/tests/test.yml b/tests/test.yml deleted file mode 100644 index f5c5ca6c..00000000 --- a/tests/test.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- hosts: all - - vars: - apache_listen_port_ssl: 443 - apache_create_vhosts: true - apache_vhosts_filename: "vhosts.conf" - apache_vhosts: - - servername: "example.com" - documentroot: "/var/www/vhosts/example_com" - - roles: - - role_under_test From afb02c39ca2b0bfa7ea571cd8cba05ca2a31b97f Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 25 Sep 2018 22:19:58 -0500 Subject: [PATCH 03/15] Issue #156: Fix some Ansible Lint issues. --- defaults/main.yml | 16 ++++++++-------- meta/main.yml | 2 +- tasks/configure-Debian.yml | 3 ++- tasks/main.yml | 8 +++++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index f325d0b3..941a57c3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -26,14 +26,14 @@ apache_allow_override: "All" apache_options: "-Indexes +FollowSymLinks" apache_vhosts_ssl: [] - # Additional properties: - # 'serveradmin, serveralias, allow_override, options, extra_parameters'. - # - servername: "local.dev", - # documentroot: "/var/www/html", - # certificate_file: "/path/to/certificate.crt", - # certificate_key_file: "/path/to/certificate.key", - # # Optional. - # certificate_chain_file: "/path/to/certificate_chain.crt" +# Additional properties: +# 'serveradmin, serveralias, allow_override, options, extra_parameters'. +# - servername: "local.dev", +# documentroot: "/var/www/html", +# certificate_file: "/path/to/certificate.crt", +# certificate_key_file: "/path/to/certificate.key", +# # Optional. +# certificate_chain_file: "/path/to/certificate_chain.crt" apache_ignore_missing_ssl_certificate: true diff --git a/meta/main.yml b/meta/main.yml index 2bd0b338..bfdb7c23 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -34,4 +34,4 @@ galaxy_info: - webserver - html -allow_duplicates: yes +allow_duplicates: true diff --git a/tasks/configure-Debian.yml b/tasks/configure-Debian.yml index 2f2b2986..85c1daa2 100644 --- a/tasks/configure-Debian.yml +++ b/tasks/configure-Debian.yml @@ -48,7 +48,8 @@ - name: Remove default vhost in sites-enabled. file: - path: "{{ apache_conf_path }}/sites-enabled/{{ apache_default_vhost_filename }}" + path: >- + "{{ apache_conf_path }}/sites-enabled/{{ apache_default_vhost_filename }}" state: absent notify: restart apache when: apache_remove_default_vhost diff --git a/tasks/main.yml b/tasks/main.yml index 21823213..cdbcb63d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,7 +5,9 @@ - name: Include variables for Amazon Linux. include_vars: "AmazonLinux.yml" - when: ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA" + when: + - ansible_distribution == "Amazon" + - ansible_distribution_major_version == "NA" - name: Define apache_packages. set_fact: @@ -19,7 +21,7 @@ - name: Get installed version of Apache. command: "{{ apache_daemon_path }}{{ apache_daemon }} -v" changed_when: false - check_mode: no + check_mode: false register: _apache_version - name: Create apache_version variable. @@ -42,4 +44,4 @@ service: name: "{{ apache_service }}" state: "{{ apache_state }}" - enabled: yes + enabled: true From d579c1497f8cde07b06cd0c5bce0e8d61d50fc51 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 25 Sep 2018 22:38:51 -0500 Subject: [PATCH 04/15] Be a little less strict about line length. --- molecule/default/molecule.yml | 2 ++ molecule/default/yaml-lint.yml | 6 ++++++ tasks/configure-Debian.yml | 3 +-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 molecule/default/yaml-lint.yml diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index e3d6e333..03397024 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -5,6 +5,8 @@ driver: name: docker lint: name: yamllint + options: + config-file: molecule/default/yaml-lint.yml platforms: - name: instance image: geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible diff --git a/molecule/default/yaml-lint.yml b/molecule/default/yaml-lint.yml new file mode 100644 index 00000000..a3dbc38e --- /dev/null +++ b/molecule/default/yaml-lint.yml @@ -0,0 +1,6 @@ +--- +extends: default +rules: + line-length: + max: 120 + level: warning diff --git a/tasks/configure-Debian.yml b/tasks/configure-Debian.yml index 85c1daa2..2f2b2986 100644 --- a/tasks/configure-Debian.yml +++ b/tasks/configure-Debian.yml @@ -48,8 +48,7 @@ - name: Remove default vhost in sites-enabled. file: - path: >- - "{{ apache_conf_path }}/sites-enabled/{{ apache_default_vhost_filename }}" + path: "{{ apache_conf_path }}/sites-enabled/{{ apache_default_vhost_filename }}" state: absent notify: restart apache when: apache_remove_default_vhost From 8912bc85fa3ca83fb6ffaea311b1742868ddb496 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 26 Sep 2018 09:03:58 -0500 Subject: [PATCH 05/15] Issue #156: Test Debian 8 and Debian 9, not Debian 9 twice. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6f0d3021..6cbee98f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ env: - MOLECULE_DISTRO: ubuntu1604 - MOLECULE_DISTRO: ubuntu1404 - MOLECULE_DISTRO: debian9 - - MOLECULE_DISTRO: debian9 + - MOLECULE_DISTRO: debian8 install: # Install test dependencies. From c01aecaa780a9e1f2561c31651140c713201c04d Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 4 Oct 2018 16:53:12 -0500 Subject: [PATCH 06/15] Prevent failures on Ansible 2.7 when no repo is set on RedHat. --- tasks/setup-Debian.yml | 3 +-- tasks/setup-RedHat.yml | 5 ++--- tasks/setup-Solaris.yml | 3 +-- tasks/setup-Suse.yml | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 2918b92d..b5d14123 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -3,5 +3,4 @@ apt: update_cache=yes cache_valid_time=3600 - name: Ensure Apache is installed on Debian. - apt: "name={{ item }} state={{ apache_packages_state }}" - with_items: "{{ apache_packages }}" + apt: "name={{ apache_packages }} state={{ apache_packages_state }}" diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index 6021b9f1..0c39dbed 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -1,7 +1,6 @@ --- - name: Ensure Apache is installed on RHEL. yum: - name: "{{ item }}" + name: "{{ apache_packages }}" state: "{{ apache_packages_state }}" - enablerepo: "{{ apache_enablerepo }}" - with_items: "{{ apache_packages }}" + enablerepo: "{{ apache_enablerepo | default(omit) }}" diff --git a/tasks/setup-Solaris.yml b/tasks/setup-Solaris.yml index 91b84ff4..a4ae4504 100644 --- a/tasks/setup-Solaris.yml +++ b/tasks/setup-Solaris.yml @@ -1,6 +1,5 @@ --- - name: Ensure Apache is installed on Solaris. pkg5: - name: "{{ item }}" + name: "{{ apache_packages }}" state: "{{ apache_packages_state }}" - with_items: "{{ apache_packages }}" diff --git a/tasks/setup-Suse.yml b/tasks/setup-Suse.yml index d77ebb1f..725266b1 100644 --- a/tasks/setup-Suse.yml +++ b/tasks/setup-Suse.yml @@ -1,6 +1,5 @@ --- - name: Ensure Apache is installed on Suse. zypper: - name: "{{ item }}" + name: "{{ apache_packages }}" state: "{{ apache_packages_state }}" - with_items: "{{ apache_packages }}" From 2d8e23af5ae26319bf85f8622417de5e589d9972 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 8 Oct 2018 11:56:04 -0500 Subject: [PATCH 07/15] Fix broken behavior under Ansible 2.7 due to yum module change. --- molecule/default/tests/test_default.py | 14 -------------- tasks/setup-RedHat.yml | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 molecule/default/tests/test_default.py diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py deleted file mode 100644 index eedd64a1..00000000 --- a/molecule/default/tests/test_default.py +++ /dev/null @@ -1,14 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') - - -def test_hosts_file(host): - f = host.file('/etc/hosts') - - assert f.exists - assert f.user == 'root' - assert f.group == 'root' diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index 0c39dbed..f9c2fc68 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -3,4 +3,4 @@ yum: name: "{{ apache_packages }}" state: "{{ apache_packages_state }}" - enablerepo: "{{ apache_enablerepo | default(omit) }}" + enablerepo: "{{ apache_enablerepo | default(omit, true) }}" From 9a0f04ccb881af212414cfd27561bdf63847dc46 Mon Sep 17 00:00:00 2001 From: smeek Date: Thu, 11 Oct 2018 12:33:00 +0100 Subject: [PATCH 08/15] Update setup-RedHat.yml Use the `package` module rather than `yum` so that `package` can delegate to `yum` or `dnf` as needed --- tasks/setup-RedHat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index f9c2fc68..dfc90161 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -1,6 +1,6 @@ --- - name: Ensure Apache is installed on RHEL. - yum: + package: name: "{{ apache_packages }}" state: "{{ apache_packages_state }}" enablerepo: "{{ apache_enablerepo | default(omit, true) }}" From f360b9af13832c7734464c6e8a3cca6213c88add Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Fri, 12 Oct 2018 09:35:42 -0500 Subject: [PATCH 09/15] Add fedora to listed platforms. --- meta/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/main.yml b/meta/main.yml index bfdb7c23..75ed4949 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -11,6 +11,9 @@ galaxy_info: - name: EL versions: - all + - name: Fedora + versions: + - all - name: Amazon versions: - all @@ -33,5 +36,6 @@ galaxy_info: - apache - webserver - html + - httpd allow_duplicates: true From fe86cb62edd6e5b428b227546f14417bde5d9f8d Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 23 Oct 2018 09:29:45 -0500 Subject: [PATCH 10/15] Update tests for optimum efficiency. --- .travis.yml | 1 - molecule/default/molecule.yml | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6cbee98f..6a9fad0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ env: - ROLE_NAME: apache matrix: - MOLECULE_DISTRO: centos7 - MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd - MOLECULE_DISTRO: centos6 - MOLECULE_DISTRO: ubuntu1804 - MOLECULE_DISTRO: ubuntu1604 diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 03397024..2ca6feaf 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -9,8 +9,10 @@ lint: config-file: molecule/default/yaml-lint.yml platforms: - name: instance - image: geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible - command: ${MOLECULE_DOCKER_COMMAND:-"sleep infinity"} + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" + command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro privileged: true pre_build_image: true provisioner: From c3d875c3ee01ced1b63ecaf7e4f661f739a54351 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 21 Nov 2018 20:55:45 -0600 Subject: [PATCH 11/15] Remove invalid platform according to Galaxy importer. --- meta/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 75ed4949..16cc210b 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -25,9 +25,6 @@ galaxy_info: - trusty - xenial - bionic - - name: Suse - versions: - - all - name: Solaris versions: - 11.3 From 464d3f67e8b4266a65227eb670e9974256d47113 Mon Sep 17 00:00:00 2001 From: Tobias Richter Date: Fri, 30 Nov 2018 16:19:16 +0100 Subject: [PATCH 12/15] Fix Galaxy lint issues, change namespace in travis --- .travis.yml | 4 ++-- tasks/configure-RedHat.yml | 2 +- vars/Debian.yml | 2 +- vars/Suse.yml | 2 +- vars/apache-24.yml | 48 +++++++++++++++++++------------------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6a9fad0f..0b366f61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,8 @@ install: before_script: # Use actual Ansible Galaxy role name for the project directory. - cd ../ - - mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME - - cd geerlingguy.$ROLE_NAME + - mv ansible-role-$ROLE_NAME wcm_io_devops.$ROLE_NAME + - cd wcm_io_devops.$ROLE_NAME script: # Run tests. diff --git a/tasks/configure-RedHat.yml b/tasks/configure-RedHat.yml index ee998b59..c3b9bdf3 100644 --- a/tasks/configure-RedHat.yml +++ b/tasks/configure-RedHat.yml @@ -67,4 +67,4 @@ dest: "{{ apache_conf_path }}/ssl.conf" regexp: "##\\n##\\s*SSL Virtual Host Context(.*\\n)*" when: apache_remove_default_vhost_ssl - notify: restart apache \ No newline at end of file + notify: restart apache diff --git a/vars/Debian.yml b/vars/Debian.yml index 91c22862..fb582b3e 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -7,4 +7,4 @@ apache_conf_path: /etc/apache2 __apache_packages: - apache2 - - apache2-utils \ No newline at end of file + - apache2-utils diff --git a/vars/Suse.yml b/vars/Suse.yml index 48c8d832..2818e755 100644 --- a/vars/Suse.yml +++ b/vars/Suse.yml @@ -9,4 +9,4 @@ apache_vhosts_version: "2.4" __apache_packages: - apache2 - - openssh \ No newline at end of file + - openssh diff --git a/vars/apache-24.yml b/vars/apache-24.yml index 83eee693..190b091b 100644 --- a/vars/apache-24.yml +++ b/vars/apache-24.yml @@ -1,29 +1,29 @@ --- apache_vhosts_version: "2.4" apache_default_vhost_filenames: - - 000-default.conf - - welcome.conf - - userdir.conf - - autoindex.conf +- 000-default.conf +- welcome.conf +- userdir.conf +- autoindex.conf apache_ports_configuration_items: - # Debian/Ubuntu and RedHat/CentOS/Amazon Linux Regex for http - - { - regexp: "^Listen\\s+\\d+$", - line: "Listen {{ apache_listen_port }}" - } - # RedHat/CentOS 7, Amazon Linux - - { - regexp: "^Listen\\s+\\d+\\s+https$", - replace: "Listen {{ apache_listen_port_ssl }} https" - } - # Debian, SUSE - - { - regexp: "^(\\s*(?:\\n+\\s+#.+)*\\s+)Listen\\s+\\d+", - replace: "\\1Listen {{ apache_listen_port_ssl }}" - } - # SUSE - - { - regexp: "^(# - name-based virtual hosting:\\n(?:#\\n)*)#?\\s*NameVirtualHost\\s+.*:\\d+", - replace: "\\1NameVirtualHost {{ apache_listen_ip }}:{{ apache_listen_port }}" - } +# Debian/Ubuntu and RedHat/CentOS/Amazon Linux Regex for http +- { + regexp: "^Listen\\s+\\d+$", + line: "Listen {{ apache_listen_port }}" +} +# RedHat/CentOS 7, Amazon Linux +- { + regexp: "^Listen\\s+\\d+\\s+https$", + replace: "Listen {{ apache_listen_port_ssl }} https" +} +# Debian, SUSE +- { + regexp: "^(\\s*(?:\\n+\\s+#.+)*\\s+)Listen\\s+\\d+", + replace: "\\1Listen {{ apache_listen_port_ssl }}" +} +# SUSE +- { + regexp: "^(# - name-based virtual hosting:\\n(?:#\\n)*)#?\\s*NameVirtualHost\\s+.*:\\d+", + replace: "\\1NameVirtualHost {{ apache_listen_ip }}:{{ apache_listen_port }}" +} From 177691bfeb54dfec3f9d626b5940f3776f259b05 Mon Sep 17 00:00:00 2001 From: Tobias Richter Date: Fri, 30 Nov 2018 16:55:18 +0100 Subject: [PATCH 13/15] Fix indentation --- vars/apache-24.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/vars/apache-24.yml b/vars/apache-24.yml index 190b091b..84bfd4b9 100644 --- a/vars/apache-24.yml +++ b/vars/apache-24.yml @@ -1,29 +1,29 @@ --- apache_vhosts_version: "2.4" apache_default_vhost_filenames: -- 000-default.conf -- welcome.conf -- userdir.conf -- autoindex.conf + - 000-default.conf + - welcome.conf + - userdir.conf + - autoindex.conf apache_ports_configuration_items: # Debian/Ubuntu and RedHat/CentOS/Amazon Linux Regex for http -- { - regexp: "^Listen\\s+\\d+$", - line: "Listen {{ apache_listen_port }}" -} + - { + regexp: "^Listen\\s+\\d+$", + line: "Listen {{ apache_listen_port }}" + } # RedHat/CentOS 7, Amazon Linux -- { - regexp: "^Listen\\s+\\d+\\s+https$", - replace: "Listen {{ apache_listen_port_ssl }} https" -} + - { + regexp: "^Listen\\s+\\d+\\s+https$", + replace: "Listen {{ apache_listen_port_ssl }} https" + } # Debian, SUSE -- { - regexp: "^(\\s*(?:\\n+\\s+#.+)*\\s+)Listen\\s+\\d+", - replace: "\\1Listen {{ apache_listen_port_ssl }}" -} + - { + regexp: "^(\\s*(?:\\n+\\s+#.+)*\\s+)Listen\\s+\\d+", + replace: "\\1Listen {{ apache_listen_port_ssl }}" + } # SUSE -- { - regexp: "^(# - name-based virtual hosting:\\n(?:#\\n)*)#?\\s*NameVirtualHost\\s+.*:\\d+", - replace: "\\1NameVirtualHost {{ apache_listen_ip }}:{{ apache_listen_port }}" -} + - { + regexp: "^(# - name-based virtual hosting:\\n(?:#\\n)*)#?\\s*NameVirtualHost\\s+.*:\\d+", + replace: "\\1NameVirtualHost {{ apache_listen_ip }}:{{ apache_listen_port }}" + } From ac55f9bdb3c2c3b5c83b5cd32f05cea716870477 Mon Sep 17 00:00:00 2001 From: Tobias Richter Date: Fri, 30 Nov 2018 17:15:01 +0100 Subject: [PATCH 14/15] Fix indentation --- vars/apache-24.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vars/apache-24.yml b/vars/apache-24.yml index 84bfd4b9..8b19aa75 100644 --- a/vars/apache-24.yml +++ b/vars/apache-24.yml @@ -7,22 +7,22 @@ apache_default_vhost_filenames: - autoindex.conf apache_ports_configuration_items: -# Debian/Ubuntu and RedHat/CentOS/Amazon Linux Regex for http + # Debian/Ubuntu and RedHat/CentOS/Amazon Linux Regex for http - { regexp: "^Listen\\s+\\d+$", line: "Listen {{ apache_listen_port }}" } -# RedHat/CentOS 7, Amazon Linux + # RedHat/CentOS 7, Amazon Linux - { regexp: "^Listen\\s+\\d+\\s+https$", replace: "Listen {{ apache_listen_port_ssl }} https" } -# Debian, SUSE + # Debian, SUSE - { regexp: "^(\\s*(?:\\n+\\s+#.+)*\\s+)Listen\\s+\\d+", replace: "\\1Listen {{ apache_listen_port_ssl }}" } -# SUSE + # SUSE - { regexp: "^(# - name-based virtual hosting:\\n(?:#\\n)*)#?\\s*NameVirtualHost\\s+.*:\\d+", replace: "\\1NameVirtualHost {{ apache_listen_ip }}:{{ apache_listen_port }}" From ac2bda0e834ce246db2509fe31de143fea6bf9e9 Mon Sep 17 00:00:00 2001 From: Tobias Richter Date: Fri, 30 Nov 2018 17:42:12 +0100 Subject: [PATCH 15/15] Fix role name in playbook --- molecule/default/playbook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 416a2b96..2c91b51a 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -18,4 +18,4 @@ changed_when: false roles: - - role: geerlingguy.apache + - role: wcm_io_devops.apache