Add Train to adjust-nova-allocation.yml

This patch adds support for the Openstack Train version
to adjust-nova-allocation.yml

Change-Id: I4dcc085c049ca10a8ce74be6251ad6602f6277e3
This commit is contained in:
Sanjay Chari 2022-03-30 16:46:04 +05:30
parent 835dc69e6a
commit 3891260883
2 changed files with 21 additions and 11 deletions

View File

@ -2,24 +2,24 @@
#
# Playbook to adjust Nova allocation ratios
#
# Versions tested: Newton, Ocata, Pike
# Versions tested: Newton, Ocata, Pike, Train
#
# Newton, Ocata apply changes to the Controllers as Pike applies changes to the Computes
#
# Examples:
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0"
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0"
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0 disk_allocation_ratio=100.0"
# ansible-playbook -i hosts.yml browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0"
# ansible-playbook -i hosts.yml browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0"
# ansible-playbook -i hosts.yml browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0 disk_allocation_ratio=100.0"
#
# In order for new settings to take affect, you need to restart the Nova services
# by adding variable restart_nova=true into the extra vars.
#
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0 disk_allocation_ratio=100.0 restart_nova=true"
# ansible-playbook -i hosts.yml browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0 disk_allocation_ratio=100.0 restart_nova=true"
#
# * Note not setting a variable does not change that configuration item then. Setting no variables
# and running the playbook sets all configuration items to defaults (cpu/ram/disk - 16/1/1)
#
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml
# ansible-playbook -i hosts.yml browbeat/adjust-nova-allocation.yml
#
- hosts: Controller,Compute
@ -51,11 +51,21 @@
nova_config_file: /etc/nova/nova.conf
when: "('Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode)"
- name: (Pike, Queens) Set Config File based on OpenStack Version
- name: (Pike, Queens, Train) Set Config File based on OpenStack Version
set_fact:
nova_config_file: /var/lib/config-data/puppet-generated/nova_libvirt/etc/nova/nova.conf
when: "('Pike' in osp_version['content'] | b64decode or 'Queens' in osp_version['content'] | b64decode or 'Train' in osp_version['content'] | b64decode)"
- name: (Pike, Queens) Set container cli based on Openstack Version
set_fact:
container_cli: docker
when: "('Pike' in osp_version['content'] | b64decode or 'Queens' in osp_version['content'] | b64decode)"
- name: (Train) Set container cli based on Openstack Version
set_fact:
container_cli: podman
when: "('Train' in osp_version['content'] | b64decode)"
- name: Set default cpu_allocation_ratio/ram_allocation_ratio/disk_allocation_ratio configuration for Nova
set_fact:
nova_configuration:
@ -120,10 +130,10 @@
- "'Controller' in group_names"
- restart_nova
- name: (Pike, Queens) Restart Nova Compute Container
- name: (Pike, Queens, Train) Restart Nova Compute Container
become: true
command: docker restart nova_compute
command: "{{container_cli}} restart nova_compute"
when:
- "('Pike' in osp_version['content'] | b64decode or 'Queens' in osp_version['content'] | b64decode)"
- "('Pike' in osp_version['content'] | b64decode or 'Queens' in osp_version['content'] | b64decode or 'Train' in osp_version['content'] | b64decode)"
- "'Compute' in group_names"
- restart_nova

View File

@ -3,7 +3,7 @@
# Configure nova.conf tasks
#
- name: (Newton, Ocata, Pike) Configure nova.conf
- name: (Newton, Ocata, Pike, Train) Configure nova.conf
become: true
ini_file:
dest: "{{nova_config_file}}"