Fix linters and metadata

With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/888223
Change-Id: I730ae569f199fc8542a5a61beb149f459465d7e2
This commit is contained in:
Dmitriy Rabotyagov 2023-07-17 16:17:30 +02:00
parent c90a5c2b92
commit 9b9bc21121
18 changed files with 141 additions and 84 deletions

View File

@ -37,7 +37,11 @@ debug: False
# for the service setup. The host must already have # for the service setup. The host must already have
# clouds.yaml properly configured. # clouds.yaml properly configured.
nova_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" nova_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
nova_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((nova_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" nova_service_setup_host_python_interpreter: >-
{{
openstack_service_setup_host_python_interpreter | default(
(nova_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
# Set the host which will run compute initialization tasks such as checking # Set the host which will run compute initialization tasks such as checking
# for a compute node to be up and running cell discovery. # for a compute node to be up and running cell discovery.
@ -54,7 +58,8 @@ nova_venv_python_executable: "{{ openstack_venv_python_executable | default('pyt
nova_git_repo: https://opendev.org/openstack/nova nova_git_repo: https://opendev.org/openstack/nova
nova_git_install_branch: master nova_git_install_branch: master
nova_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" nova_upper_constraints_url: >-
{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}
nova_git_constraints: nova_git_constraints:
- "--constraint {{ nova_upper_constraints_url }}" - "--constraint {{ nova_upper_constraints_url }}"
nova_pip_install_args: "{{ pip_install_options | default('') }}" nova_pip_install_args: "{{ pip_install_options | default('') }}"
@ -90,7 +95,11 @@ nova_management_address: "127.0.0.1"
## Database info ## Database info
nova_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" 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_facts['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_address: "{{ galera_address | default('127.0.0.1') }}"
nova_galera_user: nova nova_galera_user: nova
nova_galera_database: nova nova_galera_database: nova
@ -176,12 +185,12 @@ nova_virt_types:
# If this is not set, then the playbook will try to guess it. # If this is not set, then the playbook will try to guess it.
#nova_virt_type: kvm # nova_virt_type: kvm
# Enable Kernel Shared Memory (KSM) # Enable Kernel Shared Memory (KSM)
nova_compute_ksm_enabled: False nova_compute_ksm_enabled: False
#if set, nova_virt_type must be one of these: # if set, nova_virt_type must be one of these:
nova_supported_virt_types: nova_supported_virt_types:
- qemu - qemu
- kvm - kvm
@ -265,7 +274,7 @@ nova_nested_virt_enabled: False
# Uwsgi settings # Uwsgi settings
nova_wsgi_processes_max: 16 nova_wsgi_processes_max: 16
nova_wsgi_processes: "{{ [[ansible_facts['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_wsgi_threads: 1
nova_uwsgi_tls: nova_uwsgi_tls:
crt: "{{ nova_ssl_cert }}" crt: "{{ nova_ssl_cert }}"
@ -355,7 +364,7 @@ nova_nfs_client: []
# Nova Ceph rbd # Nova Ceph rbd
# Enble and define nova_libvirt_images_rbd_pool to use rbd as nova backend # Enble and define nova_libvirt_images_rbd_pool to use rbd as nova backend
#nova_libvirt_images_rbd_pool: vms # nova_libvirt_images_rbd_pool: vms
nova_libvirt_images_rbd_pool: '' nova_libvirt_images_rbd_pool: ''
nova_ceph_client: "{{ cinder_ceph_client }}" nova_ceph_client: "{{ cinder_ceph_client }}"
@ -382,14 +391,15 @@ 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. ## Cap the maximun number of threads / workers when a user value is unspecified.
nova_api_threads_max: 16 nova_api_threads_max: 16
nova_api_threads: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['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 ## Policy vars
# Provide a list of access controls to update the default policy.json with. These changes will be merged # Provide a list of access controls to update the default policy.json with. These changes will be merged
# with the access controls in the default policy.json. E.g. # with the access controls in the default policy.json. E.g.
#nova_policy_overrides: # nova_policy_overrides:
# "compute:create": "" # "compute:create": ""
# "compute:create:attach_network": "" # "compute:create:attach_network": ""
## Resource provider vars ## Resource provider vars
# Optionally specify a set of resource providers that a particular compute node exposes # Optionally specify a set of resource providers that a particular compute node exposes
@ -586,7 +596,8 @@ nova_pki_setup_host: "{{ openstack_pki_setup_host | default('localhost') }}"
nova_pki_keys_path: "{{ nova_pki_dir ~ '/certs/private/' }}" nova_pki_keys_path: "{{ nova_pki_dir ~ '/certs/private/' }}"
nova_pki_certs_path: "{{ nova_pki_dir ~ '/certs/certs/' }}" nova_pki_certs_path: "{{ nova_pki_dir ~ '/certs/certs/' }}"
nova_pki_intermediate_cert_name: "{{ openstack_pki_service_intermediate_cert_name }}" nova_pki_intermediate_cert_name: "{{ openstack_pki_service_intermediate_cert_name }}"
nova_pki_intermediate_chain_path: "{{ nova_pki_dir ~ '/roots/' ~ nova_pki_intermediate_cert_name ~ '/certs/' ~ nova_pki_intermediate_cert_name ~ '-chain.crt' }}" nova_pki_intermediate_chain_path: >-
{{ nova_pki_dir ~ '/roots/' ~ nova_pki_intermediate_cert_name ~ '/certs/' ~ nova_pki_intermediate_cert_name ~ '-chain.crt' }}
nova_pki_regen_cert: '' nova_pki_regen_cert: ''
nova_pki_san: "{{ openstack_pki_san | default('DNS:' ~ ansible_facts['hostname'] ~ ',IP:' ~ management_address) }}" nova_pki_san: "{{ openstack_pki_san | default('DNS:' ~ ansible_facts['hostname'] ~ ',IP:' ~ management_address) }}"
# Create client and server cert for compute hosts # Create client and server cert for compute hosts
@ -595,7 +606,11 @@ nova_pki_compute_certificates:
- name: "nova_{{ ansible_facts['hostname'] }}" - name: "nova_{{ ansible_facts['hostname'] }}"
provider: ownca provider: ownca
cn: "{{ ansible_facts['nodename'] }}" cn: "{{ ansible_facts['nodename'] }}"
san: "{{ 'DNS:' ~ ansible_facts['hostname'] ~ ',DNS:' ~ ansible_facts['nodename'] ~ ',IP:' ~ (nova_management_address == 'localhost') | ternary('127.0.0.1', nova_management_address) }}" san: >-
{{
'DNS:' ~ ansible_facts['hostname'] ~ ',DNS:' ~ ansible_facts['nodename'] ~ ',IP:' ~ (nova_management_address == 'localhost') | ternary(
'127.0.0.1', nova_management_address)
}}
signed_by: "{{ nova_pki_intermediate_cert_name }}" signed_by: "{{ nova_pki_intermediate_cert_name }}"
key_usage: key_usage:
- digitalSignature - digitalSignature
@ -678,9 +693,9 @@ nova_pki_compute_install_certificates:
# Define user-provided SSL certificates in: # Define user-provided SSL certificates in:
# /etc/openstack_deploy/user_variables.yml # /etc/openstack_deploy/user_variables.yml
#nova_user_ssl_cert: <path to cert on ansible deployment host> # nova_user_ssl_cert: <path to cert on ansible deployment host>
#nova_user_ssl_key: <path to cert on ansible deployment host> # nova_user_ssl_key: <path to cert on ansible deployment host>
#nova_user_ssl_ca_cert: <path to cert on ansible deployment host> # nova_user_ssl_ca_cert: <path to cert on ansible deployment host>
# TLS certficates for console hosts # TLS certficates for console hosts
nova_pki_console_certificates: nova_pki_console_certificates:
@ -688,7 +703,11 @@ nova_pki_console_certificates:
- name: "nova_{{ ansible_facts['hostname'] }}-client" - name: "nova_{{ ansible_facts['hostname'] }}-client"
provider: ownca provider: ownca
cn: "{{ ansible_facts['nodename'] }}" cn: "{{ ansible_facts['nodename'] }}"
san: "{{ 'DNS:' ~ ansible_facts['hostname'] ~ ',DNS:' ~ ansible_facts['nodename'] ~ ',IP:' ~ (nova_management_address == 'localhost') | ternary('127.0.0.1', nova_management_address) }}" san: >-
{{
'DNS:' ~ ansible_facts['hostname'] ~ ',DNS:' ~ ansible_facts['nodename'] ~ ',IP:' ~ (nova_management_address == 'localhost') | ternary(
'127.0.0.1', nova_management_address)
}}
signed_by: "{{ nova_pki_intermediate_cert_name }}" signed_by: "{{ nova_pki_intermediate_cert_name }}"
key_usage: key_usage:
- digitalSignature - digitalSignature
@ -720,12 +739,12 @@ nova_pki_console_install_certificates:
condition: "{{ nova_qemu_vnc_tls == 1 and nova_console_type == 'novnc' }}" condition: "{{ nova_qemu_vnc_tls == 1 and nova_console_type == 'novnc' }}"
# host which holds the ssh certificate authority # host which holds the ssh certificate authority
nova_ssh_keypairs_setup_host: "{{ openstack_ssh_keypairs_setup_host | default('localhost') }}" nova_ssh_keypairs_setup_host: "{{ openstack_ssh_keypairs_setup_host | default('localhost') }}"
# directory on the deploy host to create and store SSH keypairs # directory on the deploy host to create and store SSH keypairs
nova_ssh_keypairs_dir: "{{ openstack_ssh_keypairs_dir | default('/etc/openstack_deploy/ssh_keypairs') }}" nova_ssh_keypairs_dir: "{{ openstack_ssh_keypairs_dir | default('/etc/openstack_deploy/ssh_keypairs') }}"
#Each compute host needs a signed ssh certificate to log into the others # Each compute host needs a signed ssh certificate to log into the others
nova_ssh_keypairs: nova_ssh_keypairs:
- name: "nova-{{ inventory_hostname }}" - name: "nova-{{ inventory_hostname }}"
cert: cert:
@ -734,7 +753,7 @@ nova_ssh_keypairs:
valid_from: "{{ nova_ssh_key_valid_from | default('always') }}" valid_from: "{{ nova_ssh_key_valid_from | default('always') }}"
valid_to: "{{ nova_ssh_key_valid_to | default('forever') }}" valid_to: "{{ nova_ssh_key_valid_to | default('forever') }}"
#Each compute host needs the signed ssh certificate installing to the nova user # Each compute host needs the signed ssh certificate installing to the nova user
nova_ssh_keypairs_install_keys: nova_ssh_keypairs_install_keys:
owner: "{{ nova_system_user_name }}" owner: "{{ nova_system_user_name }}"
group: "{{ nova_system_group_name }}" group: "{{ nova_system_group_name }}"
@ -742,10 +761,10 @@ nova_ssh_keypairs_install_keys:
- cert: "nova-{{ inventory_hostname }}" - cert: "nova-{{ inventory_hostname }}"
dest: "{{ nova_system_home_folder }}/.ssh/id_rsa" dest: "{{ nova_system_home_folder }}/.ssh/id_rsa"
#Each compute host must trust the SSHD certificate authoritiy in the sshd configuration # Each compute host must trust the SSHD certificate authoritiy in the sshd configuration
nova_ssh_keypairs_install_ca: "{{ openstack_ssh_keypairs_authorities }}" nova_ssh_keypairs_install_ca: "{{ openstack_ssh_keypairs_authorities }}"
#Each compute host must allow SSH certificates with the appropriate principal to log into the nova user # Each compute host must allow SSH certificates with the appropriate principal to log into the nova user
nova_ssh_keypairs_principals: nova_ssh_keypairs_principals:
- user: "{{ nova_system_user_name }}" - user: "{{ nova_system_user_name }}"
principals: "{{ nova_ssh_key_principals | default(['nova']) }}" principals: "{{ nova_ssh_key_principals | default(['nova']) }}"

View File

@ -18,19 +18,21 @@ galaxy_info:
description: Installation and setup of nova description: Installation and setup of nova
company: Rackspace company: Rackspace
license: Apache2 license: Apache2
min_ansible_version: 2.4 role_name: os_nova
namespace: openstack
min_ansible_version: "2.10"
platforms: platforms:
- name: Debian - name: Debian
versions: versions:
- buster - bullseye
- name: Ubuntu - name: Ubuntu
versions: versions:
- bionic
- focal - focal
- jammy
- name: EL - name: EL
versions: versions:
- 8 - "9"
categories: galaxy_tags:
- cloud - cloud
- python - python
- nova - nova

View File

@ -59,7 +59,8 @@
tags: tags:
- nova-novnc-git - nova-novnc-git
- include_tasks: nova_console_novnc_ssl.yml - name: Including nova_console_novnc_ssl tasks
include_tasks: nova_console_novnc_ssl.yml
when: when:
- nova_console_user_ssl_cert is defined - nova_console_user_ssl_cert is defined
- nova_console_user_ssl_key is defined - nova_console_user_ssl_key is defined

View File

@ -22,7 +22,7 @@
mode: "0755" mode: "0755"
- name: Prepare combined nova-console SSL and CA certs - name: Prepare combined nova-console SSL and CA certs
command: cat {{ nova_console_user_ssl_cert }} {{ nova_console_user_ssl_ca_cert is defined | ternary(nova_console_user_ssl_ca_cert,'') }} command: cat {{ nova_console_user_ssl_cert }} {{ nova_console_user_ssl_ca_cert is defined | ternary(nova_console_user_ssl_ca_cert, '') }}
changed_when: false changed_when: false
register: nova_console_user_ssl_combined register: nova_console_user_ssl_combined
tags: tags:

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- include_tasks: nova_compute_kvm_install.yml - name: Including nova_compute_kvm_install tasks
include_tasks: nova_compute_kvm_install.yml
args: args:
apply: apply:
tags: tags:
@ -27,7 +28,7 @@
dest: /etc/modprobe.d/kvm.conf dest: /etc/modprobe.d/kvm.conf
owner: root owner: root
group: root group: root
mode: 0644 mode: "0644"
when: when:
- nova_nested_virt_enabled | bool - nova_nested_virt_enabled | bool
tags: tags:
@ -70,7 +71,7 @@
dest: /etc/libvirt/libvirtd.conf dest: /etc/libvirt/libvirtd.conf
owner: "root" owner: "root"
group: "root" group: "root"
mode: 0644 mode: "0644"
notify: Restart libvirt-bin notify: Restart libvirt-bin
tags: tags:
- nova-config - nova-config
@ -125,7 +126,7 @@
- name: Set qemu-kvm KSM config (Ubuntu) - name: Set qemu-kvm KSM config (Ubuntu)
lineinfile: lineinfile:
dest: "/etc/default/qemu-kvm" dest: "/etc/default/qemu-kvm"
line: "KSM_ENABLED={{ nova_compute_ksm_enabled | ternary('1','0') }}" line: "KSM_ENABLED={{ nova_compute_ksm_enabled | ternary('1', '0') }}"
regexp: "^KSM_ENABLED=*" regexp: "^KSM_ENABLED=*"
backup: yes backup: yes
when: when:
@ -136,7 +137,8 @@
- nova-kvm - nova-kvm
- nova-libvirt - nova-libvirt
- include_tasks: nova_disable_smt.yml - name: Including nova_disable_smt tasks
include_tasks: nova_disable_smt.yml
when: when:
- ansible_facts['architecture'] == 'ppc64le' - ansible_facts['architecture'] == 'ppc64le'
args: args:
@ -146,7 +148,8 @@
tags: tags:
- always - always
- include_tasks: nova_enable_ksm.yml - name: Including nova_enable_ksm tasks
include_tasks: nova_enable_ksm.yml
when: when:
- nova_compute_ksm_enabled | bool - nova_compute_ksm_enabled | bool
args: args:
@ -156,7 +159,8 @@
tags: tags:
- always - always
- include_tasks: nova_compute_kvm_virsh_net_remove.yml - name: Including nova_compute_kvm_virsh_net_remove tasks
include_tasks: nova_compute_kvm_virsh_net_remove.yml
args: args:
apply: apply:
tags: tags:

View File

@ -37,7 +37,7 @@
- _qemu_save_dir.stat.isdir | bool - _qemu_save_dir.stat.isdir | bool
- name: Move the existing save directory to nova_libvirt_save_path - name: Move the existing save directory to nova_libvirt_save_path
command: "mv /var/lib/libvirt/qemu/save {{ nova_libvirt_save_path }}" command: "mv /var/lib/libvirt/qemu/save {{ nova_libvirt_save_path }}" # noqa: no-changed-when
when: when:
- _qemu_save_dir.stat.isdir is defined - _qemu_save_dir.stat.isdir is defined
- _qemu_save_dir.stat.isdir | bool - _qemu_save_dir.stat.isdir | bool
@ -47,6 +47,7 @@
file: file:
path: "{{ nova_libvirt_save_path }}" path: "{{ nova_libvirt_save_path }}"
state: directory state: directory
mode: "0755"
- name: Symlink qemu save dir to nova_libvirt_save_path - name: Symlink qemu save dir to nova_libvirt_save_path
file: file:

View File

@ -18,11 +18,11 @@
changed_when: false changed_when: false
register: default_net register: default_net
- name: Disable libvirt default network - name: Disable libvirt default network # noqa: no-changed-when
command: "virsh net-autostart default --disable" command: "virsh net-autostart default --disable"
failed_when: false failed_when: false
when: default_net.stdout.find('default') != -1 when: default_net.stdout.find('default') != -1
- name: Destroy libvirt default network - name: Destroy libvirt default network # noqa: no-changed-when
command: "virsh net-destroy default" command: "virsh net-destroy default"
when: default_net.stdout.find('default') != -1 when: default_net.stdout.find('default') != -1

View File

@ -12,4 +12,3 @@
state: started state: started
when: when:
- ansible_facts['pkg_mgr'] in ['dnf', 'apt'] - ansible_facts['pkg_mgr'] in ['dnf', 'apt']

View File

@ -52,7 +52,8 @@
tags: tags:
- always - always
- include_role: - name: Including osa.db_setup role
include_role:
name: openstack.osa.db_setup name: openstack.osa.db_setup
apply: apply:
tags: tags:
@ -81,7 +82,8 @@
tags: tags:
- always - always
- include_role: - name: Including osa.mq_setup role
include_role:
name: openstack.osa.mq_setup name: openstack.osa.mq_setup
apply: apply:
tags: tags:
@ -103,7 +105,8 @@
tags: tags:
- always - always
- include_tasks: nova_virt_detect.yml - name: Including nova_virt_detect tasks
include_tasks: nova_virt_detect.yml
args: args:
apply: apply:
tags: tags:
@ -113,19 +116,22 @@
tags: tags:
- always - always
- import_tasks: nova_mdev_detect.yml - name: Importing nova_mdev_detect tasks
import_tasks: nova_mdev_detect.yml
tags: tags:
- always - always
- import_tasks: nova_pre_install.yml - name: Importing nova_pre_install tasks
import_tasks: nova_pre_install.yml
tags: tags:
- nova-install - nova-install
- import_tasks: nova_install.yml - name: Importing nova_install tasks
import_tasks: nova_install.yml
tags: tags:
- nova-install - nova-install
- name: refresh local facts - name: Refresh local facts
setup: setup:
filter: ansible_local filter: ansible_local
gather_subset: "!all" gather_subset: "!all"
@ -195,11 +201,13 @@
tags: tags:
- always - always
- import_tasks: nova_post_install.yml - name: Including nova_post_install tasks
import_tasks: nova_post_install.yml
tags: tags:
- nova-config - nova-config
- include_role: - name: Including osa.service_setup tasks
include_role:
name: openstack.osa.service_setup name: openstack.osa.service_setup
apply: apply:
tags: tags:
@ -235,7 +243,8 @@
tags: tags:
- always - always
- include_tasks: nova_db_setup.yml - name: Including nova_db_setup tasks
include_tasks: nova_db_setup.yml
args: args:
apply: apply:
tags: tags:
@ -266,10 +275,10 @@
systemd_tempd_prefix: openstack systemd_tempd_prefix: openstack
systemd_slice_name: "{{ nova_system_slice_name }}" systemd_slice_name: "{{ nova_system_slice_name }}"
systemd_lock_dir: "{{ nova_lock_dir }}" systemd_lock_dir: "{{ nova_lock_dir }}"
systemd_CPUAccounting: true systemd_service_cpu_accounting: true
systemd_BlockIOAccounting: true systemd_service_block_io_accounting: true
systemd_MemoryAccounting: true systemd_service_memory_accounting: true
systemd_TasksAccounting: true systemd_service_tasks_accounting: true
systemd_services: |- systemd_services: |-
{% set services = [] %} {% set services = [] %}
{% for service in filtered_nova_services %} {% for service in filtered_nova_services %}
@ -290,7 +299,8 @@
- nova-config - nova-config
- systemd-service - systemd-service
- include_tasks: nova_compute.yml - name: Including nova_compute tasks
include_tasks: nova_compute.yml
args: args:
apply: apply:
tags: tags:
@ -320,7 +330,8 @@
- name: Flush handlers - name: Flush handlers
meta: flush_handlers meta: flush_handlers
- import_tasks: nova_compute_wait.yml - name: Importing nova_compute_wait tasks
import_tasks: nova_compute_wait.yml
when: when:
- "nova_services['nova-compute']['group'] in group_names" - "nova_services['nova-compute']['group'] in group_names"
- "nova_discover_hosts_in_cells_interval | int < 1" - "nova_discover_hosts_in_cells_interval | int < 1"
@ -333,7 +344,8 @@
# because the compute hosts do not have access to # because the compute hosts do not have access to
# the database connection string and therefore # the database connection string and therefore
# cannot run nova-manage. # cannot run nova-manage.
- import_tasks: nova_db_post_setup.yml - name: Importing nova_db_post_setup tasks
import_tasks: nova_db_post_setup.yml
delegate_to: "{{ nova_conductor_setup_host }}" delegate_to: "{{ nova_conductor_setup_host }}"
run_once: true run_once: true
when: when:

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- include_tasks: "drivers/{{ nova_virt_type }}/nova_compute_{{ nova_virt_type }}.yml" - name: Including nova_compute tasks for {{ nova_virt_type }}
include_tasks: "drivers/{{ nova_virt_type }}/nova_compute_{{ nova_virt_type }}.yml"
args: args:
apply: apply:
tags: tags:
@ -50,12 +51,12 @@
tags: tags:
- nova-key - nova-key
vars: vars:
ssh_keypairs_setup_host: "{{ nova_ssh_keypairs_setup_host }}" ssh_keypairs_setup_host: "{{ nova_ssh_keypairs_setup_host }}"
ssh_keypairs_dir: "{{ nova_ssh_keypairs_dir }}" ssh_keypairs_dir: "{{ nova_ssh_keypairs_dir }}"
ssh_keypairs: "{{ nova_ssh_keypairs }}" ssh_keypairs: "{{ nova_ssh_keypairs }}"
ssh_keypairs_install_keys: "{{ nova_ssh_keypairs_install_keys }}" ssh_keypairs_install_keys: "{{ nova_ssh_keypairs_install_keys }}"
ssh_keypairs_install_ca: "{{ nova_ssh_keypairs_install_ca }}" ssh_keypairs_install_ca: "{{ nova_ssh_keypairs_install_ca }}"
ssh_keypairs_principals: "{{ nova_ssh_keypairs_principals }}" ssh_keypairs_principals: "{{ nova_ssh_keypairs_principals }}"
tags: tags:
- always - always

View File

@ -20,7 +20,9 @@
# This needs to be done after Compute hosts are added. # This needs to be done after Compute hosts are added.
- name: Perform a cell_v2 discover - name: Perform a cell_v2 discover
command: "{{ _db_nova_bin }}/nova-manage cell_v2 discover_hosts{{ (debug | bool) | ternary(' --verbose', '') }}{{ (nova_virt_type == 'ironic') | ternary(' --by-service', '') }}" command: >-
{{ _db_nova_bin }}/nova-manage cell_v2 discover_hosts{{ (debug | bool) | ternary(' --verbose', '') }}{{
(nova_virt_type == 'ironic') | ternary(' --by-service', '') }}
become: yes become: yes
become_user: "{{ _db_nova_system_user_name }}" become_user: "{{ _db_nova_system_user_name }}"
changed_when: false changed_when: false
@ -35,6 +37,7 @@
command: "{{ _db_nova_bin }}/nova-manage db online_data_migrations" command: "{{ _db_nova_bin }}/nova-manage db online_data_migrations"
become: yes become: yes
become_user: "{{ _db_nova_system_user_name }}" become_user: "{{ _db_nova_system_user_name }}"
changed_when: false
when: when:
- hostvars[nova_conductor_setup_host]['ansible_local']['openstack_ansible']['nova']['need_online_data_migrations'] | bool - hostvars[nova_conductor_setup_host]['ansible_local']['openstack_ansible']['nova']['need_online_data_migrations'] | bool
retries: 5 retries: 5
@ -49,6 +52,7 @@
section: nova section: nova
option: need_online_data_migrations option: need_online_data_migrations
value: False value: False
mode: "0644"
with_items: "{{ groups[nova_services['nova-conductor']['group']] }}" with_items: "{{ groups[nova_services['nova-conductor']['group']] }}"
when: when:
- data_migrations is not skipped - data_migrations is not skipped
@ -67,7 +71,7 @@
systemd_services: systemd_services:
- service_name: "nova-archive-deleted" - service_name: "nova-archive-deleted"
execstarts: execstarts:
- /bin/sh -c "{{ _db_nova_bin }}/nova-manage db archive_deleted_rows --until-complete --all-cells --before \"$(date -d '{{ nova_archive_deleted_before }}' +'%%Y-%%m-%%d %%H:%%M')\" {{ (nova_archive_deleted_purge) | ternary('--purge', '') }} {{ (nova_archive_task_log) | ternary('--task-log', '') }}" - /bin/sh -c "{{ _db_nova_bin }}/nova-manage db archive_deleted_rows --until-complete --all-cells --before \"$(date -d '{{ nova_archive_deleted_before }}' +'%%Y-%%m-%%d %%H:%%M')\" {{ (nova_archive_deleted_purge) | ternary('--purge', '') }} {{ (nova_archive_task_log) | ternary('--task-log', '') }}" # noqa: yaml[line-length]
environment: environment:
UMASK: '0640' UMASK: '0640'
UMASK_DIR: '0750' UMASK_DIR: '0750'
@ -84,7 +88,7 @@
Unit: "nova-archive-deleted.service" Unit: "nova-archive-deleted.service"
- service_name: "nova-purge-deleted" - service_name: "nova-purge-deleted"
execstarts: execstarts:
- /bin/sh -c "{{ _db_nova_bin }}/nova-manage db purge --until-complete --all-cells --before \"$(date -d '{{ nova_purge_deleted_before }}' +'%%Y-%%m-%%d %%H:%%M')\"" - /bin/sh -c "{{ _db_nova_bin }}/nova-manage db purge --until-complete --all-cells --before \"$(date -d '{{ nova_purge_deleted_before }}' +'%%Y-%%m-%%d %%H:%%M')\"" # noqa: yaml[line-length]
environment: environment:
UMASK: '0640' UMASK: '0640'
UMASK_DIR: '0750' UMASK_DIR: '0750'

View File

@ -24,7 +24,8 @@
- name: Create the cell0 mapping entry in the nova API DB - name: Create the cell0 mapping entry in the nova API DB
command: >- command: >-
{{ nova_bin }}/nova-manage cell_v2 map_cell0 {{ nova_bin }}/nova-manage cell_v2 map_cell0
--database_connection mysql+pymysql://{{ nova_api_galera_user }}:{{ nova_api_container_mysql_password }}@{{ nova_api_galera_address }}/{{ nova_cell0_database }}?charset=utf8{% if nova_galera_use_ssl | bool %}&ssl_ca={{ nova_galera_ssl_ca_cert }}{% endif %} --database_connection mysql+pymysql://{{ nova_api_galera_user }}:{{ nova_api_container_mysql_password }}@{{ nova_api_galera_address }}/{{
nova_cell0_database }}?charset=utf8{% if nova_galera_use_ssl | bool %}&ssl_ca={{ nova_galera_ssl_ca_cert }}{% endif %}
become: yes become: yes
become_user: "{{ nova_system_user_name }}" become_user: "{{ nova_system_user_name }}"
changed_when: false changed_when: false

View File

@ -19,6 +19,7 @@
section: "nova" section: "nova"
option: "install_method" option: "install_method"
value: "{{ nova_install_method }}" value: "{{ nova_install_method }}"
mode: "0644"
- name: Refresh local facts to ensure the nova section is present - name: Refresh local facts to ensure the nova section is present
setup: setup:
@ -59,7 +60,8 @@
venv_build_distro_package_list: "{{ nova_devel_distro_packages }}" venv_build_distro_package_list: "{{ nova_devel_distro_packages }}"
venv_install_destination_path: "{{ nova_bin | dirname }}" venv_install_destination_path: "{{ nova_bin | dirname }}"
venv_pip_install_args: "{{ nova_pip_install_args }}" venv_pip_install_args: "{{ nova_pip_install_args }}"
venv_packages_to_symlink: "{{ (nova_services['nova-compute']['group'] in group_names and nova_virt_type != 'ironic') | ternary(nova_compute_kvm_packages_to_symlink, []) }}" venv_packages_to_symlink: >-
{{ (nova_services['nova-compute']['group'] in group_names and nova_virt_type != 'ironic') | ternary(nova_compute_kvm_packages_to_symlink, []) }}
venv_pip_packages: "{{ nova_venv_packages }}" venv_pip_packages: "{{ nova_venv_packages }}"
venv_facts_when_changed: venv_facts_when_changed:
- section: "nova" - section: "nova"
@ -73,7 +75,8 @@
value: "{{ nova_venv_tag }}" value: "{{ nova_venv_tag }}"
when: nova_install_method == 'source' when: nova_install_method == 'source'
- include_tasks: "consoles/nova_console_{{ nova_console_type }}_install.yml" - name: Including nova_console tasks
include_tasks: "consoles/nova_console_{{ nova_console_type }}_install.yml"
when: when:
- "nova_services['nova-novncproxy']['group'] in group_names or - "nova_services['nova-novncproxy']['group'] in group_names or
nova_services['nova-spicehtml5proxy']['group'] in group_names or nova_services['nova-spicehtml5proxy']['group'] in group_names or
@ -144,6 +147,7 @@
section: nova section: nova
option: venv_tag option: venv_tag
value: "{{ nova_venv_tag }}" value: "{{ nova_venv_tag }}"
mode: "0644"
- name: Initialise the upgrade facts - name: Initialise the upgrade facts
ini_file: ini_file:
@ -151,6 +155,7 @@
section: nova section: nova
option: "{{ item.name }}" option: "{{ item.name }}"
value: "{{ item.state }}" value: "{{ item.state }}"
mode: "0644"
with_items: with_items:
- name: "need_service_restart" - name: "need_service_restart"
state: "True" state: "True"

View File

@ -14,12 +14,14 @@
# limitations under the License. # limitations under the License.
- name: Check if the mdev folder exist - name: Check if the mdev folder exist
stat: path=/sys/class/mdev_bus stat:
path: /sys/class/mdev_bus
register: mdev_folder register: mdev_folder
- name: Get mdev info content and store as var - name: Get mdev info content and store as var
command: "/bin/sh -c 'ls -1 /sys/class/mdev_bus/*/mdev_supported_types'" command: "/bin/sh -c 'ls -1 /sys/class/mdev_bus/*/mdev_supported_types'"
register: mdev register: mdev
changed_when: false
when: mdev_folder.stat.exists when: mdev_folder.stat.exists
- name: Register a fact for nova enabled_mdev_types - name: Register a fact for nova enabled_mdev_types

View File

@ -17,7 +17,8 @@
# dynamically loading facts from the nova_virt_types based on the # dynamically loading facts from the nova_virt_types based on the
# nova_virt_type setting. # nova_virt_type setting.
- name: Set nova config facts - name: Set nova config facts
set_fact: '{{ item.key }}="{{ item.value }}"' set_fact:
"{{ item.key }}": "{{ item.value }}" # noqa: var-naming[no-jinja]
with_dict: "{{ nova_virt_types[nova_virt_type] }}" with_dict: "{{ nova_virt_types[nova_virt_type] }}"
when: when:
- item.key not in hostvars[inventory_hostname] or item.key is undefined - item.key not in hostvars[inventory_hostname] or item.key is undefined
@ -31,8 +32,8 @@
file: file:
path: "{{ item.path | default(omit) }}" path: "{{ item.path | default(omit) }}"
state: "directory" state: "directory"
owner: "{{ item.owner|default(nova_system_user_name) }}" owner: "{{ item.owner | default(nova_system_user_name) }}"
group: "{{ item.group|default(nova_system_group_name) }}" group: "{{ item.group | default(nova_system_group_name) }}"
mode: "{{ item.mode | default(omit) }}" mode: "{{ item.mode | default(omit) }}"
with_items: with_items:
- path: "/etc/nova/rootwrap.d" - path: "/etc/nova/rootwrap.d"
@ -45,6 +46,7 @@
dest: "/etc/nova/rootwrap.d/" dest: "/etc/nova/rootwrap.d/"
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644"
with_fileglob: with_fileglob:
- rootwrap.d/* - rootwrap.d/*
notify: notify:
@ -59,7 +61,7 @@
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
owner: "root" owner: "root"
group: "{{ item.group|default(nova_system_group_name) }}" group: "{{ item.group | default(nova_system_group_name) }}"
mode: "0640" mode: "0640"
config_overrides: "{{ item.config_overrides }}" config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}" config_type: "{{ item.config_type }}"
@ -99,7 +101,7 @@
dest: "/etc/nova/provider_config/{{ item.name }}.yaml" dest: "/etc/nova/provider_config/{{ item.name }}.yaml"
owner: "root" owner: "root"
group: "{{ nova_system_group_name }}" group: "{{ nova_system_group_name }}"
mode: 0640 mode: "0640"
config_type: yaml config_type: yaml
with_items: with_items:
- "{{ nova_provider_overrides }}" - "{{ nova_provider_overrides }}"

View File

@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: create the system group - name: Create the system group
group: group:
name: "{{ nova_system_group_name }}" name: "{{ nova_system_group_name }}"
gid: "{{ nova_system_group_gid|default(omit) }}" gid: "{{ nova_system_group_gid | default(omit) }}"
state: "present" state: "present"
system: "yes" system: "yes"
tags: tags:
@ -25,7 +25,7 @@
- name: Create the nova system user - name: Create the nova system user
user: user:
name: "{{ nova_system_user_name }}" name: "{{ nova_system_user_name }}"
uid: "{{ nova_system_user_uid|default(omit) }}" uid: "{{ nova_system_user_uid | default(omit) }}"
group: "{{ nova_system_group_name }}" group: "{{ nova_system_group_name }}"
comment: "{{ nova_system_comment }}" comment: "{{ nova_system_comment }}"
shell: "{{ nova_system_shell }}" shell: "{{ nova_system_shell }}"
@ -72,8 +72,8 @@
path: "{{ item.path }}" path: "{{ item.path }}"
src: "{{ item.src | default(omit) }}" src: "{{ item.src | default(omit) }}"
state: "{{ item.state | default('directory') }}" state: "{{ item.state | default('directory') }}"
owner: "{{ item.owner|default(nova_system_user_name) }}" owner: "{{ item.owner | default(nova_system_user_name) }}"
group: "{{ item.group|default(nova_system_group_name) }}" group: "{{ item.group | default(nova_system_group_name) }}"
mode: "{{ item.mode | default('0755') }}" mode: "{{ item.mode | default('0755') }}"
force: "{{ item.force | default(omit) }}" force: "{{ item.force | default(omit) }}"
when: when:

View File

@ -40,4 +40,4 @@
set_fact: set_fact:
nova_virt_type: "qemu" nova_virt_type: "qemu"
when: when:
- nova_virt_type is not defined - nova_virt_type is not defined

View File

@ -13,7 +13,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
_nova_is_first_play_host: "{{ (nova_services['nova-conductor']['group'] in group_names and inventory_hostname == (groups[nova_services['nova-conductor']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" _nova_is_first_play_host: >-
{{
(nova_services['nova-conductor']['group'] in group_names and
inventory_hostname == (groups[nova_services['nova-conductor']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
nova_venv_packages: |- nova_venv_packages: |-
{%- set pkg_list = nova_pip_packages | union(nova_user_pip_packages) %} {%- set pkg_list = nova_pip_packages | union(nova_user_pip_packages) %}
@ -106,7 +110,7 @@ nova_core_files:
_nova_scheduler_filters: |- _nova_scheduler_filters: |-
{% set default_filters = nova_scheduler_default_filters %} {% set default_filters = nova_scheduler_default_filters %}
{% if default_filters is not iterable and default_filters is string %} {% if default_filters is not iterable and default_filters is string %}
{% set filters = default_filters.split(',') %} {% set filters = default_filters.split(',') %}
{% else %} {% else %}
{% set filters = default_filters %} {% set filters = default_filters %}
{% endif %} {% endif %}