diff --git a/ansible/browbeat/adjustment-nova-allocation.yml b/ansible/browbeat/adjust-nova-allocation.yml similarity index 62% rename from ansible/browbeat/adjustment-nova-allocation.yml rename to ansible/browbeat/adjust-nova-allocation.yml index 4450daebd..86be347da 100644 --- a/ansible/browbeat/adjustment-nova-allocation.yml +++ b/ansible/browbeat/adjust-nova-allocation.yml @@ -2,25 +2,27 @@ # # Playbook to adjust Nova allocation ratios # -# Versions tested: Newton, Ocata +# Versions tested: Newton, Ocata, Pike +# +# Newton, Ocata apply changes to the Controllers as Pike applies changes to the Computes # # Examples: -# ansible-playbook -i hosts browbeat/adjustment-nova-allocation.yml -e "cpu_allocation_ratio=24" -# ansible-playbook -i hosts browbeat/adjustment-nova-allocation.yml -e "cpu_allocation_ratio=24 ram_allocation_ratio=10.0" -# ansible-playbook -i hosts browbeat/adjustment-nova-allocation.yml -e "cpu_allocation_ratio=24 ram_allocation_ratio=10.0 disk_allocation_ratio=10.0" +# 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" # # 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/adjustment-nova-allocation.yml -e "cpu_allocation_ratio=24 ram_allocation_ratio=10.0 disk_allocation_ratio=10.0 restart_nova=true" +# 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" # # * 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/adjustment-nova-allocation.yml +# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml # -- hosts: controller +- hosts: controller,compute remote_user: "{{ host_remote_user }}" gather_facts: false vars_files: @@ -49,6 +51,11 @@ nova_config_file: /etc/nova/nova.conf when: "('Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode)" + - name: (Pike) 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" + - name: Set default cpu_allocation_ratio/ram_allocation_ratio/disk_allocation_ratio configuration for Nova set_fact: nova_configuration: @@ -93,3 +100,30 @@ roles: - nova-config + + post_tasks: + + - name: (Newton, Ocata) Restart Nova Services + become: true + service: + name: "{{ item }}" + state: restarted + with_items: + - openstack-nova-scheduler + - openstack-nova-api + - openstack-nova-conductor + - openstack-nova-novncproxy + - openstack-nova-consoleauth + - httpd + when: + - "'Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode" + - "'controller' in group_names" + - restart_nova + + - name: (Pike) Restart Nova Compute Container + become: true + command: docker restart nova_compute + when: + - "'Pike' in osp_version['content'] | b64decode" + - "'compute' in group_names" + - restart_nova diff --git a/ansible/browbeat/adjustment-nova-scheduler.yml b/ansible/browbeat/adjustment-nova-scheduler.yml index 6ae6eb7d7..d8ae588f6 100644 --- a/ansible/browbeat/adjustment-nova-scheduler.yml +++ b/ansible/browbeat/adjustment-nova-scheduler.yml @@ -114,3 +114,25 @@ roles: - nova-config + + post_tasks: + - name: (Newton, Ocata) Restart Nova Services + become: true + service: + name: "{{ item }}" + state: restarted + with_items: + - openstack-nova-scheduler + - openstack-nova-api + - openstack-nova-conductor + - openstack-nova-novncproxy + - openstack-nova-consoleauth + - httpd + when: "('Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode) and (restart_nova)" + + - name: (Pike) Restart Nova Scheduler Container + become: true + command: "docker restart {{item}}" + with_items: + - nova_scheduler + when: "('Pike' in osp_version['content'] | b64decode) and (restart_nova)" diff --git a/ansible/browbeat/roles/nova-config/tasks/main.yml b/ansible/browbeat/roles/nova-config/tasks/main.yml index 896401c60..3563f1386 100644 --- a/ansible/browbeat/roles/nova-config/tasks/main.yml +++ b/ansible/browbeat/roles/nova-config/tasks/main.yml @@ -16,24 +16,3 @@ backup: yes with_items: - "{{nova_configuration}}" - -- name: (Newton, Ocata) Restart Nova Services - become: true - service: - name: "{{ item }}" - state: restarted - with_items: - - openstack-nova-scheduler - - openstack-nova-api - - openstack-nova-conductor - - openstack-nova-novncproxy - - openstack-nova-consoleauth - - httpd - when: "('Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode) and (restart_nova)" - -- name: (Pike) Restart Nova Scheduler Container - become: true - command: "docker restart {{item}}" - with_items: - - nova_scheduler - when: "('Pike' in osp_version['content'] | b64decode) and (restart_nova)"