Merge "Auto-fix usage of modules via FQCN"

This commit is contained in:
Zuul 2025-04-10 14:24:17 +00:00 committed by Gerrit Code Review
commit b2ca7ff261
10 changed files with 59 additions and 59 deletions

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Compile messages - name: Compile messages
command: "{{ horizon_manage }} compilemessages" ansible.builtin.command: "{{ horizon_manage }} compilemessages"
become: "{{ (horizon_install_method == 'source') }}" become: "{{ (horizon_install_method == 'source') }}"
become_user: "{{ horizon_system_user_name }}" become_user: "{{ horizon_system_user_name }}"
changed_when: false changed_when: false
@ -24,7 +24,7 @@
- "venv changed" - "venv changed"
- name: Restart wsgi process - name: Restart wsgi process
service: ansible.builtin.service:
name: "{{ horizon_system_service_name }}" name: "{{ horizon_system_service_name }}"
enabled: true enabled: true
state: "restarted" state: "restarted"

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Ensure apache2 MPM for Debian/Ubuntu - name: Ensure apache2 MPM for Debian/Ubuntu
apache2_module: community.general.apache2_module:
name: "{{ item.name }}" name: "{{ item.name }}"
state: "{{ item.state }}" state: "{{ item.state }}"
ignore_configcheck: true ignore_configcheck: true
@ -25,7 +25,7 @@
notify: Restart wsgi process notify: Restart wsgi process
- name: Ensure apache2 MPM for EL - name: Ensure apache2 MPM for EL
copy: ansible.builtin.copy:
content: | content: |
LoadModule mpm_{{ horizon_apache_mpm_backend }}_module modules/mod_mpm_{{ horizon_apache_mpm_backend }}.so LoadModule mpm_{{ horizon_apache_mpm_backend }}_module modules/mod_mpm_{{ horizon_apache_mpm_backend }}.so
@ -37,7 +37,7 @@
# NOTE(hwoarang): Module enable/disable process is only functional on Debian # NOTE(hwoarang): Module enable/disable process is only functional on Debian
- name: Enable apache2 modules - name: Enable apache2 modules
apache2_module: community.general.apache2_module:
name: "{{ item.name }}" name: "{{ item.name }}"
state: "{{ item.state }}" state: "{{ item.state }}"
ignore_configcheck: true ignore_configcheck: true
@ -48,7 +48,7 @@
notify: Restart wsgi process notify: Restart wsgi process
- name: Drop apache2 configs - name: Drop apache2 configs
template: ansible.builtin.template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
owner: "{{ item.owner | default(horizon_system_user_name) }}" owner: "{{ item.owner | default(horizon_system_user_name) }}"
@ -58,14 +58,14 @@
notify: Restart wsgi process notify: Restart wsgi process
- name: Disable default apache site - name: Disable default apache site
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: "absent" state: "absent"
with_items: "{{ horizon_apache_default_sites }}" with_items: "{{ horizon_apache_default_sites }}"
notify: Restart wsgi process notify: Restart wsgi process
- name: Enable Horizon Site - name: Enable Horizon Site
file: ansible.builtin.file:
src: "{{ horizon_apache_site_available }}" src: "{{ horizon_apache_site_available }}"
dest: "{{ horizon_apache_site_enabled }}" dest: "{{ horizon_apache_site_enabled }}"
state: "link" state: "link"
@ -75,20 +75,20 @@
notify: Restart wsgi process notify: Restart wsgi process
- name: Ensure Apache ServerName - name: Ensure Apache ServerName
lineinfile: ansible.builtin.lineinfile:
dest: "{{ horizon_apache_conf }}" dest: "{{ horizon_apache_conf }}"
line: "ServerName {{ horizon_server_name }}" line: "ServerName {{ horizon_server_name }}"
notify: Restart wsgi process notify: Restart wsgi process
- name: Ensure Apache ServerTokens - name: Ensure Apache ServerTokens
lineinfile: ansible.builtin.lineinfile:
dest: "{{ horizon_apache_security_conf }}" dest: "{{ horizon_apache_security_conf }}"
regexp: "^ServerTokens" regexp: "^ServerTokens"
line: "ServerTokens {{ horizon_apache_servertokens }}" line: "ServerTokens {{ horizon_apache_servertokens }}"
notify: Restart wsgi process notify: Restart wsgi process
- name: Ensure Apache ServerSignature - name: Ensure Apache ServerSignature
lineinfile: ansible.builtin.lineinfile:
dest: "{{ horizon_apache_security_conf }}" dest: "{{ horizon_apache_security_conf }}"
regexp: "^ServerSignature" regexp: "^ServerSignature"
line: "ServerSignature {{ horizon_apache_serversignature }}" line: "ServerSignature {{ horizon_apache_serversignature }}"
@ -97,7 +97,7 @@
# Removing the Listen (or listen.conf inclusion) from apache config to prevent # Removing the Listen (or listen.conf inclusion) from apache config to prevent
# conflicts with ports.conf on CentOS and openSUSE # conflicts with ports.conf on CentOS and openSUSE
- name: Remove Listen from Apache config - name: Remove Listen from Apache config
lineinfile: ansible.builtin.lineinfile:
dest: "{{ horizon_apache_security_conf }}" dest: "{{ horizon_apache_security_conf }}"
regexp: "^(Listen.*)" regexp: "^(Listen.*)"
backrefs: true backrefs: true

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Record the installation method - name: Record the installation method
ini_file: community.general.ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact" dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: "horizon" section: "horizon"
option: "install_method" option: "install_method"
@ -22,12 +22,12 @@
mode: "0644" mode: "0644"
- name: Refresh local facts to ensure the horizon section is present - name: Refresh local facts to ensure the horizon section is present
setup: ansible.builtin.setup:
filter: ansible_local filter: ansible_local
gather_subset: "!all" gather_subset: "!all"
- name: Install distro packages - name: Install distro packages
package: ansible.builtin.package:
name: "{{ horizon_package_list }}" name: "{{ horizon_package_list }}"
state: "{{ horizon_package_state }}" state: "{{ horizon_package_state }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
@ -41,5 +41,5 @@
- Restart wsgi process - Restart wsgi process
- name: Install horizon packages from PIP - name: Install horizon packages from PIP
include_tasks: horizon_install_source.yml ansible.builtin.include_tasks: horizon_install_source.yml
when: horizon_install_method == 'source' when: horizon_install_method == 'source'

View File

@ -19,7 +19,7 @@
# constraints are given which will always happen with a source install # constraints are given which will always happen with a source install
# and wheels built on the repo server. We must filter horizon out of u-c. # and wheels built on the repo server. We must filter horizon out of u-c.
- name: Retrieve the constraints URL - name: Retrieve the constraints URL
uri: ansible.builtin.uri:
url: "{{ horizon_upper_constraints_url }}" url: "{{ horizon_upper_constraints_url }}"
return_content: true return_content: true
register: _u_c_contents register: _u_c_contents
@ -28,7 +28,7 @@
delay: 3 delay: 3
- name: Install the python venv - name: Install the python venv
include_role: ansible.builtin.include_role:
name: "python_venv_build" name: "python_venv_build"
vars: vars:
venv_python_executable: "{{ horizon_venv_python_executable }}" venv_python_executable: "{{ horizon_venv_python_executable }}"

View File

@ -17,21 +17,21 @@
when: horizon_lib_dir is not defined or (horizon_lib_dir is defined and not horizon_lib_dir) when: horizon_lib_dir is not defined or (horizon_lib_dir is defined and not horizon_lib_dir)
block: block:
- name: Find the venv's python version - name: Find the venv's python version
command: "{{ horizon_bin }}/{{ horizon_venv_python_executable }} -c 'import horizon; print(horizon.__file__)'" ansible.builtin.command: "{{ horizon_bin }}/{{ horizon_venv_python_executable }} -c 'import horizon; print(horizon.__file__)'"
changed_when: false changed_when: false
register: _horizon_python_venv_details register: _horizon_python_venv_details
- name: Set python lib dir fact - name: Set python lib dir fact
set_fact: ansible.builtin.set_fact:
horizon_lib_dir: "{{ _horizon_python_venv_details.stdout | dirname | dirname }}" horizon_lib_dir: "{{ _horizon_python_venv_details.stdout | dirname | dirname }}"
- name: Configure source-installed dashboards - name: Configure source-installed dashboards
include_tasks: horizon_post_install_source.yml ansible.builtin.include_tasks: horizon_post_install_source.yml
when: horizon_install_method == 'source' when: horizon_install_method == 'source'
# NOTE(noonedeadpunk): change of ownership is required for collectstatic and compilemessages # NOTE(noonedeadpunk): change of ownership is required for collectstatic and compilemessages
- name: Ensure horizon dirs are accessible by user - name: Ensure horizon dirs are accessible by user
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
@ -46,7 +46,7 @@
# TODO(hwoarang): See if we can use local_settings.py from the distribution packages # TODO(hwoarang): See if we can use local_settings.py from the distribution packages
# when horizon_install_method == 'distro' # when horizon_install_method == 'distro'
- name: Setup Horizon config(s) - name: Setup Horizon config(s)
template: ansible.builtin.template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
owner: "{{ item.owner | default(horizon_system_user_name) }}" owner: "{{ item.owner | default(horizon_system_user_name) }}"
@ -76,14 +76,14 @@
with_dict: "{{ horizon_policy_overrides }}" with_dict: "{{ horizon_policy_overrides }}"
- name: Uploading horizon custom files - name: Uploading horizon custom files
copy: ansible.builtin.copy:
src: "{{ item.value.src }}" src: "{{ item.value.src }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}"
mode: "0644" mode: "0644"
with_dict: "{{ horizon_custom_uploads | default({}) }}" with_dict: "{{ horizon_custom_uploads | default({}) }}"
- name: Create horizon links - name: Create horizon links
file: ansible.builtin.file:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
@ -94,7 +94,7 @@
- { src: "/etc/horizon/local_settings.py", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.py" } - { src: "/etc/horizon/local_settings.py", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.py" }
- name: Create customization module directory - name: Create customization module directory
file: ansible.builtin.file:
path: "{{ horizon_lib_dir }}/horizon_customization" path: "{{ horizon_lib_dir }}/horizon_customization"
state: directory state: directory
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
@ -103,7 +103,7 @@
when: horizon_customization_module is defined when: horizon_customization_module is defined
- name: Drop horizon customization module - name: Drop horizon customization module
template: ansible.builtin.template:
src: "{{ horizon_customization_module }}" src: "{{ horizon_customization_module }}"
dest: "{{ horizon_lib_dir }}/horizon_customization/__init__.py" dest: "{{ horizon_lib_dir }}/horizon_customization/__init__.py"
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
@ -113,7 +113,7 @@
when: horizon_customization_module is defined when: horizon_customization_module is defined
- name: Creating horizon custom theme path - name: Creating horizon custom theme path
file: ansible.builtin.file:
path: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}/" path: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}/"
state: directory state: directory
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
@ -122,7 +122,7 @@
with_dict: "{{ horizon_custom_themes }}" with_dict: "{{ horizon_custom_themes }}"
- name: Drop horizon custom themes - name: Drop horizon custom themes
unarchive: ansible.builtin.unarchive:
src: "{{ item.value.theme_src_archive }}" src: "{{ item.value.theme_src_archive }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}/" dest: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}/"
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
@ -132,21 +132,21 @@
notify: Restart wsgi process notify: Restart wsgi process
- name: Collect static files - name: Collect static files
command: "{{ horizon_manage }} collectstatic --noinput" ansible.builtin.command: "{{ horizon_manage }} collectstatic --noinput"
become: true become: true
become_user: "{{ horizon_system_user_name }}" become_user: "{{ horizon_system_user_name }}"
changed_when: false changed_when: false
notify: Restart wsgi process notify: Restart wsgi process
- name: Compress static files - name: Compress static files
command: "{{ horizon_manage }} compress --force" ansible.builtin.command: "{{ horizon_manage }} compress --force"
become: true become: true
become_user: "{{ horizon_system_user_name }}" become_user: "{{ horizon_system_user_name }}"
changed_when: false changed_when: false
notify: Restart wsgi process notify: Restart wsgi process
- name: Register DB session cleanup cron - name: Register DB session cleanup cron
cron: ansible.builtin.cron:
name: "Clear out expired sessions" name: "Clear out expired sessions"
minute: "{{ 58 | random(seed=inventory_hostname, start=2) }}" minute: "{{ 58 | random(seed=inventory_hostname, start=2) }}"
hour: "21" hour: "21"

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Create static horizon dir - name: Create static horizon dir
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: "directory" state: "directory"
owner: "{{ item.owner | default(horizon_system_user_name) }}" owner: "{{ item.owner | default(horizon_system_user_name) }}"
@ -27,7 +27,7 @@
- { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" } - { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" }
- name: Registering dashboards - name: Registering dashboards
find: ansible.builtin.find:
paths: "{{ horizon_lib_dir }}" paths: "{{ horizon_lib_dir }}"
patterns: "^.*(dashboard|ui)$" patterns: "^.*(dashboard|ui)$"
file_type: directory file_type: directory
@ -37,7 +37,7 @@
register: found_dashboards register: found_dashboards
- name: Registering panels - name: Registering panels
find: ansible.builtin.find:
paths: |- paths: |-
{% set dashboard_path = [] %} {% set dashboard_path = [] %}
{% for dashboard in found_dashboards.files %} {% for dashboard in found_dashboards.files %}
@ -52,7 +52,7 @@
register: found_panels register: found_panels
- name: Registering settings - name: Registering settings
find: ansible.builtin.find:
paths: |- paths: |-
{% set dashboard_path = [] %} {% set dashboard_path = [] %}
{% for dashboard in found_dashboards.files %} {% for dashboard in found_dashboards.files %}
@ -67,7 +67,7 @@
register: found_settings register: found_settings
- name: Registering default policy files - name: Registering default policy files
find: ansible.builtin.find:
paths: |- paths: |-
{% set policy_path = [] %} {% set policy_path = [] %}
{% for dashboard in found_dashboards.files %} {% for dashboard in found_dashboards.files %}
@ -82,7 +82,7 @@
register: found_default_policy register: found_default_policy
- name: Registering policy files - name: Registering policy files
find: ansible.builtin.find:
paths: |- paths: |-
{% set policy_path = [] %} {% set policy_path = [] %}
{% for dashboard in found_dashboards.files %} {% for dashboard in found_dashboards.files %}
@ -97,7 +97,7 @@
register: found_policy register: found_policy
- name: Link default policy files - name: Link default policy files
file: ansible.builtin.file:
src: "{{ item.path }}" src: "{{ item.path }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/default_policies/{{ item.path | basename }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/default_policies/{{ item.path | basename }}"
state: link state: link
@ -106,7 +106,7 @@
- Compile messages - Compile messages
- name: Link policy files - name: Link policy files
file: ansible.builtin.file:
src: "{{ item.path }}" src: "{{ item.path }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/{{ item.path | basename }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/{{ item.path | basename }}"
state: link state: link
@ -115,7 +115,7 @@
- Compile messages - Compile messages
- name: Enable project settings - name: Enable project settings
file: ansible.builtin.file:
src: "{{ item.path }}" src: "{{ item.path }}"
path: "{{ horizon_dashboard_settings_dir }}/{{ item.path | basename }}" path: "{{ horizon_dashboard_settings_dir }}/{{ item.path | basename }}"
state: link state: link
@ -125,7 +125,7 @@
- Restart wsgi process - Restart wsgi process
- name: Enable project panels - name: Enable project panels
file: ansible.builtin.file:
src: "{{ item.path }}" src: "{{ item.path }}"
path: "{{ horizon_dashboard_panel_dir }}/{{ item.path | basename }}" path: "{{ horizon_dashboard_panel_dir }}/{{ item.path | basename }}"
state: link state: link

View File

@ -14,13 +14,13 @@
# limitations under the License. # limitations under the License.
- name: Create the system group - name: Create the system group
group: ansible.builtin.group:
name: "{{ horizon_system_group_name }}" name: "{{ horizon_system_group_name }}"
state: "present" state: "present"
system: "yes" system: "yes"
- name: Create the horizon system user - name: Create the horizon system user
user: ansible.builtin.user:
name: "{{ horizon_system_user_name }}" name: "{{ horizon_system_user_name }}"
group: "{{ horizon_system_group_name }}" group: "{{ horizon_system_group_name }}"
comment: "{{ horizon_system_comment }}" comment: "{{ horizon_system_comment }}"
@ -30,7 +30,7 @@
home: "{{ horizon_system_user_home }}" home: "{{ horizon_system_user_home }}"
- name: Create horizon dir - name: Create horizon dir
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: "directory" state: "directory"
owner: "{{ item.owner | default(horizon_system_user_name) }}" owner: "{{ item.owner | default(horizon_system_user_name) }}"
@ -45,7 +45,7 @@
- { path: "/etc/pki/tls/private", owner: "root", group: "root", condition: "{{ (ansible_facts['pkg_mgr'] == 'dnf') }}" } - { path: "/etc/pki/tls/private", owner: "root", group: "root", condition: "{{ (ansible_facts['pkg_mgr'] == 'dnf') }}" }
- name: Create system links - name: Create system links
file: ansible.builtin.file:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
state: "link" state: "link"

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Perform a Zanata Pull Catalog - name: Perform a Zanata Pull Catalog
command: >- ansible.builtin.command: >-
{{ horizon_manage }} pull_catalog -p {{ translation.project }} -m {{ translation.module }} -b {{ {{ horizon_manage }} pull_catalog -p {{ translation.project }} -m {{ translation.module }} -b {{
(translation.branch | default('master')) | replace('/', '-') (translation.branch | default('master')) | replace('/', '-')
}} }}

View File

@ -23,7 +23,7 @@
reload: true reload: true
- name: Import uwsgi role - name: Import uwsgi role
include_role: ansible.builtin.include_role:
name: uwsgi name: uwsgi
vars: vars:
uwsgi_services: "{{ uwsgi_horizon_services }}" uwsgi_services: "{{ uwsgi_horizon_services }}"

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Gather variables for each operating system - name: Gather variables for each operating system
include_vars: "{{ lookup('first_found', params) }}" ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars: vars:
params: params:
files: files:
@ -29,7 +29,7 @@
- always - always
- name: Fail if service was deployed using a different installation method - name: Fail if service was deployed using a different installation method
fail: ansible.builtin.fail:
msg: "Switching installation methods for OpenStack services is not supported" msg: "Switching installation methods for OpenStack services is not supported"
when: when:
- ansible_local is defined - ansible_local is defined
@ -39,22 +39,22 @@
- ansible_local.openstack_ansible.horizon.install_method != horizon_install_method - ansible_local.openstack_ansible.horizon.install_method != horizon_install_method
- name: Gather variables for installation method - name: Gather variables for installation method
include_vars: "{{ horizon_install_method }}_install.yml" ansible.builtin.include_vars: "{{ horizon_install_method }}_install.yml"
tags: tags:
- always - always
- name: Importing horizon_pre_install tasks - name: Importing horizon_pre_install tasks
import_tasks: horizon_pre_install.yml ansible.builtin.import_tasks: horizon_pre_install.yml
tags: tags:
- horizon-install - horizon-install
- name: Importing horizon_install tasks - name: Importing horizon_install tasks
import_tasks: horizon_install.yml ansible.builtin.import_tasks: horizon_install.yml
tags: tags:
- horizon-install - horizon-install
- name: Create and install SSL certificates - name: Create and install SSL certificates
include_role: ansible.builtin.include_role:
name: pki name: pki
tasks_from: main_certs.yml tasks_from: main_certs.yml
apply: apply:
@ -74,13 +74,13 @@
- always - always
- name: Importing horizon_post_install tasks - name: Importing horizon_post_install tasks
import_tasks: horizon_post_install.yml ansible.builtin.import_tasks: horizon_post_install.yml
tags: tags:
- horizon-config - horizon-config
- post-install - post-install
- name: Importing horizon_service_setup tasks - name: Importing horizon_service_setup tasks
import_tasks: horizon_service_setup.yml ansible.builtin.import_tasks: horizon_service_setup.yml
when: when:
- ('horizon_all' in group_names) - ('horizon_all' in group_names)
- inventory_hostname == groups['horizon_all'][0] - inventory_hostname == groups['horizon_all'][0]
@ -88,16 +88,16 @@
- horizon-config - horizon-config
- name: Importing uwsgi/apache tasks - name: Importing uwsgi/apache tasks
import_tasks: "{{ (horizon_use_uwsgi | bool) | ternary('horizon_uwsgi.yml', 'horizon_apache.yml') }}" ansible.builtin.import_tasks: "{{ (horizon_use_uwsgi | bool) | ternary('horizon_uwsgi.yml', 'horizon_apache.yml') }}"
tags: tags:
- horizon-config - horizon-config
- name: Importing horizon_translations_update tasks - name: Importing horizon_translations_update tasks
import_tasks: horizon_translations_update.yml ansible.builtin.import_tasks: horizon_translations_update.yml
when: horizon_translations_update | bool when: horizon_translations_update | bool
tags: tags:
- horizon-config - horizon-config
- horizon-translations - horizon-translations
- name: Flush handlers - name: Flush handlers
meta: flush_handlers ansible.builtin.meta: flush_handlers