diff --git a/handlers/main.yml b/handlers/main.yml index 4e19fe7a..2d940fe7 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Compile messages - command: "{{ horizon_manage }} compilemessages" + ansible.builtin.command: "{{ horizon_manage }} compilemessages" become: "{{ (horizon_install_method == 'source') }}" become_user: "{{ horizon_system_user_name }}" changed_when: false @@ -24,7 +24,7 @@ - "venv changed" - name: Restart wsgi process - service: + ansible.builtin.service: name: "{{ horizon_system_service_name }}" enabled: true state: "restarted" diff --git a/tasks/horizon_apache.yml b/tasks/horizon_apache.yml index c5778cca..6a5ce5dc 100644 --- a/tasks/horizon_apache.yml +++ b/tasks/horizon_apache.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Ensure apache2 MPM for Debian/Ubuntu - apache2_module: + community.general.apache2_module: name: "{{ item.name }}" state: "{{ item.state }}" ignore_configcheck: true @@ -25,7 +25,7 @@ notify: Restart wsgi process - name: Ensure apache2 MPM for EL - copy: + ansible.builtin.copy: content: | 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 - name: Enable apache2 modules - apache2_module: + community.general.apache2_module: name: "{{ item.name }}" state: "{{ item.state }}" ignore_configcheck: true @@ -48,7 +48,7 @@ notify: Restart wsgi process - name: Drop apache2 configs - template: + ansible.builtin.template: src: "{{ item.src }}" dest: "{{ item.dest }}" owner: "{{ item.owner | default(horizon_system_user_name) }}" @@ -58,14 +58,14 @@ notify: Restart wsgi process - name: Disable default apache site - file: + ansible.builtin.file: path: "{{ item }}" state: "absent" with_items: "{{ horizon_apache_default_sites }}" notify: Restart wsgi process - name: Enable Horizon Site - file: + ansible.builtin.file: src: "{{ horizon_apache_site_available }}" dest: "{{ horizon_apache_site_enabled }}" state: "link" @@ -75,20 +75,20 @@ notify: Restart wsgi process - name: Ensure Apache ServerName - lineinfile: + ansible.builtin.lineinfile: dest: "{{ horizon_apache_conf }}" line: "ServerName {{ horizon_server_name }}" notify: Restart wsgi process - name: Ensure Apache ServerTokens - lineinfile: + ansible.builtin.lineinfile: dest: "{{ horizon_apache_security_conf }}" regexp: "^ServerTokens" line: "ServerTokens {{ horizon_apache_servertokens }}" notify: Restart wsgi process - name: Ensure Apache ServerSignature - lineinfile: + ansible.builtin.lineinfile: dest: "{{ horizon_apache_security_conf }}" regexp: "^ServerSignature" line: "ServerSignature {{ horizon_apache_serversignature }}" @@ -97,7 +97,7 @@ # Removing the Listen (or listen.conf inclusion) from apache config to prevent # conflicts with ports.conf on CentOS and openSUSE - name: Remove Listen from Apache config - lineinfile: + ansible.builtin.lineinfile: dest: "{{ horizon_apache_security_conf }}" regexp: "^(Listen.*)" backrefs: true diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index 2497b401..8fa94cca 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Record the installation method - ini_file: + community.general.ini_file: dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: "horizon" option: "install_method" @@ -22,12 +22,12 @@ mode: "0644" - name: Refresh local facts to ensure the horizon section is present - setup: + ansible.builtin.setup: filter: ansible_local gather_subset: "!all" - name: Install distro packages - package: + ansible.builtin.package: name: "{{ horizon_package_list }}" state: "{{ horizon_package_state }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}" @@ -41,5 +41,5 @@ - Restart wsgi process - 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' diff --git a/tasks/horizon_install_source.yml b/tasks/horizon_install_source.yml index 4c5c3923..6372b376 100644 --- a/tasks/horizon_install_source.yml +++ b/tasks/horizon_install_source.yml @@ -19,7 +19,7 @@ # 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. - name: Retrieve the constraints URL - uri: + ansible.builtin.uri: url: "{{ horizon_upper_constraints_url }}" return_content: true register: _u_c_contents @@ -28,7 +28,7 @@ delay: 3 - name: Install the python venv - include_role: + ansible.builtin.include_role: name: "python_venv_build" vars: venv_python_executable: "{{ horizon_venv_python_executable }}" diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml index 63be27f9..7756d6ff 100644 --- a/tasks/horizon_post_install.yml +++ b/tasks/horizon_post_install.yml @@ -17,21 +17,21 @@ when: horizon_lib_dir is not defined or (horizon_lib_dir is defined and not horizon_lib_dir) block: - 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 register: _horizon_python_venv_details - name: Set python lib dir fact - set_fact: + ansible.builtin.set_fact: horizon_lib_dir: "{{ _horizon_python_venv_details.stdout | dirname | dirname }}" - 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' # NOTE(noonedeadpunk): change of ownership is required for collectstatic and compilemessages - name: Ensure horizon dirs are accessible by user - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory owner: "{{ horizon_system_user_name }}" @@ -46,7 +46,7 @@ # TODO(hwoarang): See if we can use local_settings.py from the distribution packages # when horizon_install_method == 'distro' - name: Setup Horizon config(s) - template: + ansible.builtin.template: src: "{{ item.src }}" dest: "{{ item.dest }}" owner: "{{ item.owner | default(horizon_system_user_name) }}" @@ -76,14 +76,14 @@ with_dict: "{{ horizon_policy_overrides }}" - name: Uploading horizon custom files - copy: + ansible.builtin.copy: src: "{{ item.value.src }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}" mode: "0644" with_dict: "{{ horizon_custom_uploads | default({}) }}" - name: Create horizon links - file: + ansible.builtin.file: src: "{{ item.src }}" dest: "{{ item.dest }}" 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" } - name: Create customization module directory - file: + ansible.builtin.file: path: "{{ horizon_lib_dir }}/horizon_customization" state: directory owner: "{{ horizon_system_user_name }}" @@ -103,7 +103,7 @@ when: horizon_customization_module is defined - name: Drop horizon customization module - template: + ansible.builtin.template: src: "{{ horizon_customization_module }}" dest: "{{ horizon_lib_dir }}/horizon_customization/__init__.py" owner: "{{ horizon_system_user_name }}" @@ -113,7 +113,7 @@ when: horizon_customization_module is defined - name: Creating horizon custom theme path - file: + ansible.builtin.file: path: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}/" state: directory owner: "{{ horizon_system_user_name }}" @@ -122,7 +122,7 @@ with_dict: "{{ horizon_custom_themes }}" - name: Drop horizon custom themes - unarchive: + ansible.builtin.unarchive: src: "{{ item.value.theme_src_archive }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}/" owner: "{{ horizon_system_user_name }}" @@ -132,21 +132,21 @@ notify: Restart wsgi process - name: Collect static files - command: "{{ horizon_manage }} collectstatic --noinput" + ansible.builtin.command: "{{ horizon_manage }} collectstatic --noinput" become: true become_user: "{{ horizon_system_user_name }}" changed_when: false notify: Restart wsgi process - name: Compress static files - command: "{{ horizon_manage }} compress --force" + ansible.builtin.command: "{{ horizon_manage }} compress --force" become: true become_user: "{{ horizon_system_user_name }}" changed_when: false notify: Restart wsgi process - name: Register DB session cleanup cron - cron: + ansible.builtin.cron: name: "Clear out expired sessions" minute: "{{ 58 | random(seed=inventory_hostname, start=2) }}" hour: "21" diff --git a/tasks/horizon_post_install_source.yml b/tasks/horizon_post_install_source.yml index 3560fd03..92f6ab24 100644 --- a/tasks/horizon_post_install_source.yml +++ b/tasks/horizon_post_install_source.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Create static horizon dir - file: + ansible.builtin.file: path: "{{ item.path }}" state: "directory" owner: "{{ item.owner | default(horizon_system_user_name) }}" @@ -27,7 +27,7 @@ - { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" } - name: Registering dashboards - find: + ansible.builtin.find: paths: "{{ horizon_lib_dir }}" patterns: "^.*(dashboard|ui)$" file_type: directory @@ -37,7 +37,7 @@ register: found_dashboards - name: Registering panels - find: + ansible.builtin.find: paths: |- {% set dashboard_path = [] %} {% for dashboard in found_dashboards.files %} @@ -52,7 +52,7 @@ register: found_panels - name: Registering settings - find: + ansible.builtin.find: paths: |- {% set dashboard_path = [] %} {% for dashboard in found_dashboards.files %} @@ -67,7 +67,7 @@ register: found_settings - name: Registering default policy files - find: + ansible.builtin.find: paths: |- {% set policy_path = [] %} {% for dashboard in found_dashboards.files %} @@ -82,7 +82,7 @@ register: found_default_policy - name: Registering policy files - find: + ansible.builtin.find: paths: |- {% set policy_path = [] %} {% for dashboard in found_dashboards.files %} @@ -97,7 +97,7 @@ register: found_policy - name: Link default policy files - file: + ansible.builtin.file: src: "{{ item.path }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/default_policies/{{ item.path | basename }}" state: link @@ -106,7 +106,7 @@ - Compile messages - name: Link policy files - file: + ansible.builtin.file: src: "{{ item.path }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/{{ item.path | basename }}" state: link @@ -115,7 +115,7 @@ - Compile messages - name: Enable project settings - file: + ansible.builtin.file: src: "{{ item.path }}" path: "{{ horizon_dashboard_settings_dir }}/{{ item.path | basename }}" state: link @@ -125,7 +125,7 @@ - Restart wsgi process - name: Enable project panels - file: + ansible.builtin.file: src: "{{ item.path }}" path: "{{ horizon_dashboard_panel_dir }}/{{ item.path | basename }}" state: link diff --git a/tasks/horizon_pre_install.yml b/tasks/horizon_pre_install.yml index 951edf92..4f3e6073 100644 --- a/tasks/horizon_pre_install.yml +++ b/tasks/horizon_pre_install.yml @@ -14,13 +14,13 @@ # limitations under the License. - name: Create the system group - group: + ansible.builtin.group: name: "{{ horizon_system_group_name }}" state: "present" system: "yes" - name: Create the horizon system user - user: + ansible.builtin.user: name: "{{ horizon_system_user_name }}" group: "{{ horizon_system_group_name }}" comment: "{{ horizon_system_comment }}" @@ -30,7 +30,7 @@ home: "{{ horizon_system_user_home }}" - name: Create horizon dir - file: + ansible.builtin.file: path: "{{ item.path }}" state: "directory" 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') }}" } - name: Create system links - file: + ansible.builtin.file: src: "{{ item.src }}" dest: "{{ item.dest }}" state: "link" diff --git a/tasks/horizon_translations_update.yml b/tasks/horizon_translations_update.yml index a644cf00..d32a3836 100644 --- a/tasks/horizon_translations_update.yml +++ b/tasks/horizon_translations_update.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Perform a Zanata Pull Catalog - command: >- + ansible.builtin.command: >- {{ horizon_manage }} pull_catalog -p {{ translation.project }} -m {{ translation.module }} -b {{ (translation.branch | default('master')) | replace('/', '-') }} diff --git a/tasks/horizon_uwsgi.yml b/tasks/horizon_uwsgi.yml index 25b0e58c..4744cd91 100644 --- a/tasks/horizon_uwsgi.yml +++ b/tasks/horizon_uwsgi.yml @@ -23,7 +23,7 @@ reload: true - name: Import uwsgi role - include_role: + ansible.builtin.include_role: name: uwsgi vars: uwsgi_services: "{{ uwsgi_horizon_services }}" diff --git a/tasks/main.yml b/tasks/main.yml index cca7f436..3bc78305 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Gather variables for each operating system - include_vars: "{{ lookup('first_found', params) }}" + ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" vars: params: files: @@ -29,7 +29,7 @@ - always - 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" when: - ansible_local is defined @@ -39,22 +39,22 @@ - ansible_local.openstack_ansible.horizon.install_method != horizon_install_method - name: Gather variables for installation method - include_vars: "{{ horizon_install_method }}_install.yml" + ansible.builtin.include_vars: "{{ horizon_install_method }}_install.yml" tags: - always - name: Importing horizon_pre_install tasks - import_tasks: horizon_pre_install.yml + ansible.builtin.import_tasks: horizon_pre_install.yml tags: - horizon-install - name: Importing horizon_install tasks - import_tasks: horizon_install.yml + ansible.builtin.import_tasks: horizon_install.yml tags: - horizon-install - name: Create and install SSL certificates - include_role: + ansible.builtin.include_role: name: pki tasks_from: main_certs.yml apply: @@ -74,13 +74,13 @@ - always - name: Importing horizon_post_install tasks - import_tasks: horizon_post_install.yml + ansible.builtin.import_tasks: horizon_post_install.yml tags: - horizon-config - post-install - name: Importing horizon_service_setup tasks - import_tasks: horizon_service_setup.yml + ansible.builtin.import_tasks: horizon_service_setup.yml when: - ('horizon_all' in group_names) - inventory_hostname == groups['horizon_all'][0] @@ -88,16 +88,16 @@ - horizon-config - 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: - horizon-config - 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 tags: - horizon-config - horizon-translations - name: Flush handlers - meta: flush_handlers + ansible.builtin.meta: flush_handlers