--- - hosts: undercloud vars: metadata: name: Check the number of OpenStack processes on undercloud description: > The default settings for OpenStack is to run one process (heat-engine, keystone, etc.) per CPU core. On a machine with a lot of cores this is both unnecessary and can consume a significant amount of RAM, leading to crashes due to OOMKiller. groups: - pre-deployment max_process_count: 8 tasks: - name: Collect the number of running processes per OpenStack service command: 'docker exec {{ item.container }} pgrep -f -c {{ item.proc }}' become: true ignore_errors: yes register: "process_count" changed_when: False loop: - {container: "heat_engine", proc: "heat-engine"} - {container: "ironic_inspector", proc: "ironic-inspector"} - {container: "ironic_conductor", proc: "ironic-conductor"} - {container: "nova_api", proc: "nova_api"} - {container: "nova_scheduler", proc: "nova-scheduler"} - {container: "nova_conductor", proc: "nova-conductor"} - {container: "nova_compute", proc: "nova-compute"} - {container: "glance_api", proc: "glance-api"} - {container: "swift_proxy", proc: "swift-proxy-server"} - {container: "swift_object_server", proc: "swift-object-server"} - {container: "swift_container_server", proc: "swift-container-server"} - {container: "zaqar", proc: "zaqar"} - {container: "zaqar_websocket", proc: "zaqar-server"} - {container: "mistral_api", proc: "mistral-server"} - {container: "mistral_engine", proc: "mistral-server"} - {container: "mistral_executor", proc: "mistral-server"} - name: Create warning messages command: echo "There are {{ item.stdout }} {{ item.item }} processes running. Having more than {{ max_process_count }} risks running out of memory." register: process_warnings with_items: "{{ process_count.results }}" when: "item.stdout|int > max_process_count" - name: Output warning message warn: msg={{ warning_msg }} when: "warning_msg|length > 0" vars: warning_msg: "{{ process_warnings.results|selectattr('changed')|map(attribute='stdout')|join('\n') }}"