browbeat/ansible/browbeat/adjustment-workers.yml
jkilpatr c60b55ec83 Update tox.ini with Ansible linting and Browbeat config linting
This commit enanbles Ansible linting and does some
minor refactoring to make existing Ansible roles
compatible with the new rules.

Several Ansible linting rules have been excluded to keep the number
of changes from being too onerous.

Also a new script in ci-scripts is used to check very config file
included in the Browbeat repo for validity using the template
Browbeat uses when it runs.

Here's a list of the new linting rules

* Ansible tasks must have names
* When you use shell you must use become not sudo
* Using become_user without using become is not allowed
* If a repo is pulled it must be a pinned version of commit, not latest
* Always_run is deprecated don't use it
* Variables without {{}} and not in when statements are deprecated don't use them
* No Trailing whitepaces
* YAML checking, catches big syntax errors but not less obvious ones

Change-Id: Ic531c91c408996d4e7d8899afe8b21d364998680
2017-03-29 07:35:34 -04:00

39 lines
1.5 KiB
YAML

---
#
# Playbook to change number of workers for nova, neutron, cinder and keystone services
#
# Change Workers Example:
# ansible-playbook -i hosts browbeat/adjustment-workers.yml -e "workers=12"
#
# Change Workers Example and change Keystone Threads (If deployed in httpd)
# ansible-playbook -i hosts browbeat/adjustment-workers.yml -e "service=keystone workers=12 threads=1"
#
# Change Workers and Keystone Deployment Example:
# ansible-playbook -i hosts browbeat/adjustment-workers.yml -e "service=keystone workers=12 keystone_deployment=httpd"
#
- hosts: controller
remote_user: heat-admin
gather_facts: false
vars:
default_threads: 6
pre_tasks:
- name: Check for variable (workers)
fail: msg="workers not defined"
when: workers is undefined
- name: Check for variable (threads)
debug: msg="threads (Keystone only) not set, using default ({{default_threads}})"
when: threads is undefined
- name: Set default threads variable for Keystone
set_fact:
threads: "{{default_threads}}"
when: threads is undefined
- name: Determine if keystone_deployment is set
debug: msg="keystone_deployment is not set therefore not changing keystone deployment"
when: keystone_deployment is undefined
roles:
- { role: keystone-workers, when: service == "keystone" }
- { role: nova-workers, when: service == "nova" }
- { role: neutron-workers, when: service == "neutron" }
- { role: cinder-workers, when: service == "cinder" }