tripleo-validations/roles/undercloud-process-count/tasks/main.yml

51 lines
2.2 KiB
YAML

---
- name: Get the path of tripleo undercloud config file
become: true
hiera:
name: "tripleo_undercloud_conf_file"
- name: Get the Container CLI from the undercloud.conf file
become: true
validations_read_ini:
path: "{{ tripleo_undercloud_conf_file }}"
section: DEFAULT
key: container_cli
ignore_missing_file: true
register: container_cli
- name: Collect the number of running processes per OpenStack service
command: "{{ container_cli.value|default('podman', true) }} 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') }}"