diff --git a/defaults/main.yml b/defaults/main.yml index 197575a4..faed3065 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -86,7 +86,7 @@ nova_management_address: "127.0.0.1" ## Database info nova_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" -nova_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((nova_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" +nova_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((nova_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" nova_galera_address: "{{ galera_address | default('127.0.0.1') }}" nova_galera_user: nova nova_galera_database: nova @@ -209,7 +209,7 @@ nova_spice_html5proxy_base_proto: "{{ openstack_service_publicuri_proto | defaul nova_spice_html5proxy_base_port: 6082 nova_spice_html5proxy_base_uri: "{{ nova_spice_html5proxy_base_proto }}://{{ external_lb_vip_address }}:{{ nova_spice_html5proxy_base_port }}" nova_spice_html5proxy_base_url: "{{ nova_spice_html5proxy_base_uri }}/spice_auto.html" -nova_spice_console_agent_enabled: "{{ ansible_architecture != 'aarch64' }}" +nova_spice_console_agent_enabled: "{{ ansible_facts['architecture'] != 'aarch64' }}" nova_spicehtml5_git_repo: https://gitlab.freedesktop.org/spice/spice-html5.git nova_spicehtml5_git_install_branch: master @@ -244,7 +244,7 @@ nova_nested_virt_enabled: False # Uwsgi settings nova_wsgi_processes_max: 16 -nova_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, nova_wsgi_processes_max] | min }}" +nova_wsgi_processes: "{{ [[ansible_facts['processor_vcpus']|default(1), 1] | max * 2, nova_wsgi_processes_max] | min }}" nova_wsgi_threads: 1 ## Nova libvirt @@ -261,9 +261,9 @@ nova_libvirt_hw_disk_discard: '{{ (nova_libvirt_images_rbd_pool | length > 0) | nova_libvirt_live_migration_inbound_addr: '{{ (nova_management_address == "localhost") | ternary("127.0.0.1", nova_management_address) }}' ## Nova console -nova_console_agent_enabled: "{{ ansible_architecture != 'aarch64' }}" +nova_console_agent_enabled: "{{ ansible_facts['architecture'] != 'aarch64' }}" # Set the console type. Presently the only options are ["spice", "novnc", "serialconsole"]. -nova_console_type: "{{ (ansible_architecture == 'aarch64') | ternary('serialconsole', 'novnc') }}" +nova_console_type: "{{ (ansible_facts['architecture'] == 'aarch64') | ternary('serialconsole', 'novnc') }}" # Nova console ssl info, presently only used by novnc console type nova_console_ssl_dir: "/etc/nova/ssl" @@ -370,7 +370,7 @@ nova_rbd_inuse: "{{ (nova_libvirt_images_rbd_pool | length > 0) or (nova_cinder_ ## Cap the maximun number of threads / workers when a user value is unspecified. nova_api_threads_max: 16 -nova_api_threads: "{{ [[(ansible_processor_vcpus//ansible_processor_threads_per_core)|default(1), 1] | max * 2, nova_api_threads_max] | min }}" +nova_api_threads: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, nova_api_threads_max] | min }}" ## Policy vars # Provide a list of access controls to update the default policy.json with. These changes will be merged diff --git a/tasks/drivers/kvm/nova_compute_kvm.yml b/tasks/drivers/kvm/nova_compute_kvm.yml index 7c10fe32..89f83c75 100644 --- a/tasks/drivers/kvm/nova_compute_kvm.yml +++ b/tasks/drivers/kvm/nova_compute_kvm.yml @@ -68,7 +68,7 @@ - name: Set kernel permissions to enable libguestfs features (Ubuntu) include_tasks: nova_kernel_permissions.yml when: - - ansible_distribution == 'Ubuntu' + - ansible_facts['distribution'] == 'Ubuntu' - nova_libvirt_inject_key | bool or nova_libvirt_inject_password | bool - name: Set libvirtd config @@ -109,7 +109,7 @@ when: - (nova_libvirtd_listen_tcp == 1) or (nova_libvirtd_listen_tls == 1) - libvirtd_version is version('5.7', '<') - - ansible_pkg_mgr == 'apt' + - ansible_facts['pkg_mgr'] == 'apt' notify: Restart libvirt-bin tags: - nova-config @@ -124,7 +124,7 @@ backup: "yes" when: - (nova_libvirtd_listen_tcp == 0 and nova_libvirtd_listen_tls == 0) or libvirtd_version is version('5.7', '>=') - - ansible_pkg_mgr == 'apt' + - ansible_facts['pkg_mgr'] == 'apt' notify: Restart libvirt-bin tags: - nova-config @@ -140,7 +140,7 @@ when: - (nova_libvirtd_listen_tcp == 1) or (nova_libvirtd_listen_tls == 1) - libvirtd_version is version('5.7', '<') - - ansible_pkg_mgr in ['yum', 'dnf', 'zypper'] + - ansible_facts['pkg_mgr'] in ['yum', 'dnf', 'zypper'] notify: Restart libvirt-bin tags: - nova-config @@ -155,7 +155,7 @@ backup: "yes" when: - (nova_libvirtd_listen_tcp == 0 and nova_libvirtd_listen_tls == 0) or libvirtd_version is version('5.7', '>=') - - ansible_pkg_mgr in ['yum', 'dnf', 'zypper'] + - ansible_facts['pkg_mgr'] in ['yum', 'dnf', 'zypper'] notify: Restart libvirt-bin tags: - nova-config @@ -169,7 +169,7 @@ regexp: "^KSM_ENABLED=*" backup: yes when: - - ansible_distribution == 'Ubuntu' + - ansible_facts['distribution'] == 'Ubuntu' notify: Restart libvirt-bin tags: - nova-config @@ -178,7 +178,7 @@ - include_tasks: nova_disable_smt.yml when: - - ansible_architecture == 'ppc64le' + - ansible_facts['architecture'] == 'ppc64le' tags: - nova-config @@ -202,7 +202,7 @@ path: /usr/share/OVMF state: directory when: - - ansible_os_family == 'Suse' + - ansible_facts['os_family'] == 'Suse' tags: - nova-config - nova-kvm @@ -210,11 +210,11 @@ - name: Symlink UEFI firmware files file: - src: "{{ (ansible_os_family == 'RedHat') | ternary('/usr/share/OVMF/OVMF_CODE.secboot.fd', '/usr/share/qemu/ovmf-x86_64-ms-code.bin') }}" + src: "{{ (ansible_facts['os_family'] == 'RedHat') | ternary('/usr/share/OVMF/OVMF_CODE.secboot.fd', '/usr/share/qemu/ovmf-x86_64-ms-code.bin') }}" dest: /usr/share/OVMF/OVMF_CODE.fd state: link when: - - ansible_os_family in ['RedHat', 'Suse'] + - ansible_facts['os_family'] in ['RedHat', 'Suse'] tags: - nova-config - nova-kvm diff --git a/tasks/drivers/kvm/nova_enable_ksm.yml b/tasks/drivers/kvm/nova_enable_ksm.yml index 577d07f3..c7203133 100644 --- a/tasks/drivers/kvm/nova_enable_ksm.yml +++ b/tasks/drivers/kvm/nova_enable_ksm.yml @@ -11,4 +11,4 @@ enabled: yes state: started when: - - ansible_pkg_mgr in ['yum', 'dnf', 'apt'] + - ansible_facts['pkg_mgr'] in ['yum', 'dnf', 'apt'] diff --git a/tasks/main.yml b/tasks/main.yml index 138df553..e582ba38 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -16,12 +16,12 @@ - name: Gather variables for each operating system include_vars: "{{ item }}" with_first_found: - - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml" - - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml" - - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" - - "{{ ansible_distribution | lower }}.yml" - - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml" - - "{{ ansible_os_family | lower }}.yml" + - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml" + - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml" + - "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml" + - "{{ ansible_facts['distribution'] | lower }}.yml" + - "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml" + - "{{ ansible_facts['os_family'] | lower }}.yml" tags: - always @@ -255,7 +255,7 @@ - "nova_services['nova-compute']['group'] in group_names" - "nova_discover_hosts_in_cells_interval | int < 1" vars: - compute_host_to_wait_for: "{{ ansible_nodename }}" + compute_host_to_wait_for: "{{ ansible_facts['nodename'] }}" tags: - nova-config diff --git a/tasks/nova_install.yml b/tasks/nova_install.yml index ef5d9e0e..59ebe389 100644 --- a/tasks/nova_install.yml +++ b/tasks/nova_install.yml @@ -33,14 +33,14 @@ apt_package_pinning_priority: "1000" apt_pinned_packages: [{ package: "{{ nova_backports_packages | join(' ') }}", release: 'Debian Backports' }] when: - - ansible_distribution | lower == 'debian' + - ansible_facts['distribution'] | lower == 'debian' - name: Install distro packages package: name: "{{ nova_package_list }}" state: "{{ nova_package_state }}" - update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}" - cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}" + update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}" + cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}" register: install_packages until: install_packages is success retries: 5 @@ -83,8 +83,8 @@ when: - nova_install_method == 'source' - nova_services['nova-compute']['group'] in group_names - - ansible_os_family | lower == 'redhat' - - ansible_distribution_major_version|int <= 7 + - ansible_facts['os_family'] | lower == 'redhat' + - ansible_facts['distribution_major_version']|int <= 7 - include_tasks: "consoles/nova_console_{{ nova_console_type }}_install.yml" when: @@ -105,7 +105,7 @@ name: "{{ item.service }}" enabled: no state: stopped - when: item.service in ansible_facts.services and item.type != nova_console_type + when: item.service in ansible_facts['services'] and item.type != nova_console_type loop: - service: "nova-novncproxy.service" type: "novnc" diff --git a/tasks/nova_pre_install.yml b/tasks/nova_pre_install.yml index 14c4ffdb..cee1f1ce 100644 --- a/tasks/nova_pre_install.yml +++ b/tasks/nova_pre_install.yml @@ -138,4 +138,4 @@ - name: Set default nova console for ppc64le set_fact: nova_console_type: "novnc" - when: ansible_architecture == 'ppc64le' + when: ansible_facts['architecture'] == 'ppc64le' diff --git a/tasks/nova_virt_detect.yml b/tasks/nova_virt_detect.yml index a1c363e9..96362cb9 100644 --- a/tasks/nova_virt_detect.yml +++ b/tasks/nova_virt_detect.yml @@ -32,9 +32,9 @@ or cpuinfo_contents.stdout.find('PowerNV') != -1 or (cpuinfo_contents.stdout.find('pSeries') != -1 and cpuinfo_contents.stdout.find('qemu') != -1 - and ansible_architecture == 'ppc64le') + and ansible_facts['architecture'] == 'ppc64le') or (dev_kvm.stat.ischr is defined and dev_kvm.stat.ischr - and ansible_architecture == 'aarch64') + and ansible_facts['architecture'] == 'aarch64') - name: Register a fact for the nova qemu virt type set_fact: diff --git a/templates/nova.conf.j2 b/templates/nova.conf.j2 index 9e9cc78e..757a8ab7 100644 --- a/templates/nova.conf.j2 +++ b/templates/nova.conf.j2 @@ -19,7 +19,7 @@ compute_driver = {{ nova_compute_driver }} instances_path = {{ nova_system_home_folder }}/instances allow_resize_to_same_host = True -{% if ansible_os_family | lower == 'suse' %} +{% if ansible_facts['os_family'] | lower == 'suse' %} mkisofs_cmd = /usr/bin/mkisofs {% endif %} diff --git a/vars/debian.yml b/vars/debian.yml index 9646bc46..aa81673f 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -77,7 +77,7 @@ nova_compute_kvm_distro_packages: - qemu-user - qemu-block-extra - qemu-system - - "{{ (ansible_architecture == 'x86_64') | ternary('qemu-system-x86', 'qemu-system-arm') }}" + - "{{ (ansible_facts['architecture'] == 'x86_64') | ternary('qemu-system-x86', 'qemu-system-arm') }}" - qemu-system-misc nova_compute_kvm_packages_to_symlink: diff --git a/vars/redhat.yml b/vars/redhat.yml index 27878a4e..9d044c11 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -32,9 +32,9 @@ nova_service_distro_packages: - openstack-nova-api - openstack-nova-conductor - openstack-nova-scheduler - - "{{ ansible_distribution_major_version is version('8', '<') | ternary('python-memcached', 'python3-memcached') }}" - - "{{ ansible_distribution_major_version is version('8', '<') | ternary('python2-PyMySQL', 'python3-PyMySQL') }}" - - "{{ ansible_distribution_major_version is version('8', '<') | ternary('systemd-python', 'python3-systemd') }}" + - "{{ ansible_facts['distribution_major_version'] is version('8', '<') | ternary('python-memcached', 'python3-memcached') }}" + - "{{ ansible_facts['distribution_major_version'] is version('8', '<') | ternary('python2-PyMySQL', 'python3-PyMySQL') }}" + - "{{ ansible_facts['distribution_major_version'] is version('8', '<') | ternary('systemd-python', 'python3-systemd') }}" nova_service_extra_distro_packages: kvm: @@ -52,7 +52,7 @@ nova_compute_packages: - genisoimage - kpartx - nc - - "{{ ansible_distribution_major_version is version('8', '<') | ternary('python-libguestfs', 'python3-libguestfs') }}" + - "{{ ansible_facts['distribution_major_version'] is version('8', '<') | ternary('python-libguestfs', 'python3-libguestfs') }}" - sysfsutils nova_compute_barbican_distro_packages: @@ -60,17 +60,17 @@ nova_compute_barbican_distro_packages: nova_compute_kvm_distro_packages: - libvirt-daemon-kvm - - "qemu-kvm{% if ansible_distribution_major_version|int <= 7 %}-ev{% endif %}" + - "qemu-kvm{% if ansible_facts['distribution_major_version']|int <= 7 %}-ev{% endif %}" - libvirt-client - - "{{ (ansible_distribution_major_version|int <= 7) | ternary('libvirt-devel', 'python3-libvirt') }}" + - "{{ (ansible_facts['distribution_major_version']|int <= 7) | ternary('libvirt-devel', 'python3-libvirt') }}" - nfs-utils - - "{{ (ansible_distribution_major_version|int <= 7) | ternary('libguestfs-devel', 'python3-libguestfs') }}" - - "qemu-img{% if ansible_distribution_major_version|int <= 7 %}-ev{% endif %}" - - "{{ (ansible_architecture == 'aarch64') | ternary('AAVMF', 'OVMF') }}" + - "{{ (ansible_facts['distribution_major_version']|int <= 7) | ternary('libguestfs-devel', 'python3-libguestfs') }}" + - "qemu-img{% if ansible_facts['distribution_major_version']|int <= 7 %}-ev{% endif %}" + - "{{ (ansible_facts['architecture'] == 'aarch64') | ternary('AAVMF', 'OVMF') }}" nova_compute_kvm_packages_to_symlink: |- {% set packages = [] %} - {% if ansible_distribution_major_version|int > 7 %} + {% if ansible_facts['distribution_major_version']|int > 7 %} {% set _ = packages.extend(['python3-libvirt', 'python3-libguestfs']) %} {% endif %} {{ packages }}