From 4f18122b41293ea53006871601c671c5fd0f932f Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Wed, 8 Dec 2021 21:49:52 +0100 Subject: [PATCH] Add an option to create docroot. --- molecule/default/converge.yml | 4 ++++ tasks/assert.yml | 12 ++++++++++++ tasks/vhosts.yml | 1 + 3 files changed, 17 insertions(+) diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 43f6e6a..87d4c2c 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -46,6 +46,10 @@ # - name: proxy-initial-not-pooled # - name: proxy-sendchunks # value: 1 + # - name: no_doc_root + # servername: nodocroot.example.com + # documentroot: /var/www/html/nodocroot + # create_docroot: no httpd_directories: - name: my_directory path: "{{ httpd_data_directory }}/my_directory" diff --git a/tasks/assert.yml b/tasks/assert.yml index 07f111e..bbdc4a4 100644 --- a/tasks/assert.yml +++ b/tasks/assert.yml @@ -86,6 +86,18 @@ when: - httpd_vhosts is defined +- name: test if item.create_docroot in httpd_vhosts is set correctly + ansible.builtin.assert: + that: + - item.create_docroot is boolean + quiet: yes + loop: "{{ httpd_vhosts }}" + loop_control: + label: "{{ item.name }}" + when: + - httpd_vhosts is defined + - item.create_docroot + - name: test if item.serveralias in httpd_vhosts is set correctly ansible.builtin.assert: that: diff --git a/tasks/vhosts.yml b/tasks/vhosts.yml index 6f1e891..5ccbbdf 100644 --- a/tasks/vhosts.yml +++ b/tasks/vhosts.yml @@ -11,6 +11,7 @@ when: - httpd_vhosts is defined - item.documentroot is defined + - item.create_docroot is not defined or item.create_docroot - name: configure vhosts ansible.builtin.template: