Execution
Date
08 Dec 2025 13:50:33 +0000
Duration
00:06:27.80
Controller
aio1.openstack.local
User
root
Versions
Ansible
2.18.6
ara
1.7.4 / 1.7.4
Python
3.12.11
Summary
7
Hosts
589
Tasks
576
Results
37
Plays
222
Files
0
Records
File: /home/zuul/src/opendev.org/openstack/ansible-role-httpd/tasks/httpd_configure_vhosts.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | --- # Copyright 2024, Cleura AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - name: Disabling vhosts that are marked as absent or not enabled ansible.builtin.file: path: "{{ httpd_vhost_enable_path }}/{{ vhost['name'] }}.conf" state: absent loop: >- {{ httpd_vhosts | selectattr('state', 'defined') | selectattr('state', 'eq', 'absent') + httpd_vhosts | selectattr('enabled', 'defined') | selectattr('enabled', 'false') }} loop_control: loop_var: vhost label: "{{ loop_label | to_json }}" vars: loop_label: vhost: "{{ vhost['name'] }}" notify: - Reload web server - name: Removing vhost defenitions which are marked as absent ansible.builtin.file: path: "{{ httpd_conf_dir }}/sites-available/{{ vhost['name'] }}.conf" state: absent loop: "{{ httpd_vhosts | selectattr('state', 'defined') | selectattr('state', 'eq', 'absent') }}" loop_control: loop_var: vhost label: "{{ loop_label | to_json }}" vars: loop_label: vhost: "{{ vhost['name'] }}" notify: - Reload web server - name: Create and install SSL certificates ansible.builtin.include_role: name: pki tasks_from: main_certs.yml apply: tags: - httpd-config - pki vars: pki_setup_host: "{{ httpd_pki_setup_host }}" pki_dir: "{{ httpd_pki_dir }}" pki_create_certificates: "{{ httpd_pki_create_certificates }}" pki_regen_cert: "{{ httpd_pki_regen_cert }}" pki_certificates: "{{ httpd_pki_certificates }}" pki_install_certificates: "{{ httpd_pki_install_certificates }}" pki_handler_cert_installed: "httpd cert installed" when: - httpd_pki_install_certificates | length > 0 tags: - httpd-config - pki - name: Placing vhost files that should be present ansible.builtin.template: src: httpd_vhost.conf.j2 dest: "{{ httpd_conf_dir }}/sites-available/{{ vhost['name'] }}.conf" owner: "{{ httpd_service_user_name }}" group: "{{ httpd_service_group_name }}" mode: "0640" loop: >- {{ httpd_vhosts | selectattr('state', 'defined') | selectattr('state', 'eq', 'present') + httpd_vhosts | selectattr('state', 'undefined') }} loop_control: loop_var: vhost label: "{{ loop_label | to_json }}" vars: loop_label: vhost: "{{ vhost['name'] }}" notify: - Reload web server - name: Enable required vhosts ansible.builtin.file: src: "{{ httpd_conf_dir }}/sites-available/{{ vhost['name'] }}.conf" dest: "{{ httpd_vhost_enable_path }}/{{ vhost['name'] }}.conf" state: link loop: >- {{ ( httpd_vhosts | selectattr('enabled', 'defined') | selectattr('enabled', 'true') + httpd_vhosts | selectattr('enabled', 'undefined') ) | rejectattr('name', 'in', absent_vhosts) }} loop_control: loop_var: vhost label: "{{ loop_label | to_json }}" vars: loop_label: vhost: "{{ vhost['name'] }}" absent_vhosts: >- {{ httpd_vhosts | selectattr('state', 'defined') | selectattr('state', 'eq', 'absent') | map(attribute='name') }} notify: - Reload web server |