Execution
Date
15 Dec 2025 10:16:58 +0000
Duration
00:02:05.54
Controller
aio1.openstack.local
User
root
Versions
Ansible
2.18.6
ara
1.7.4 / 1.7.4
Python
3.12.3
Summary
17
Hosts
64
Tasks
194
Results
13
Plays
46
Files
0
Records
File: /etc/ansible/ansible_collections/openstack/osa/playbooks/healthcheck/infrastructure.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | --- # Copyright 2017, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This playbook is meant to run after setup-infrastructure, and expects # the infrastructure bits to have properly deployed to succeed. # Test unbound-install.yml # TO BE IMPLEMENTED # Test repo-install.yml - name: Ensure all repo-servers are built and are accessible by hosts. hosts: all_containers[0]:physical_hosts[0] gather_facts: true vars: repo_requirements_file: "constraints/upper_constraints_cached.txt" tasks: - name: Setup installation variables ansible.builtin.include_role: name: openstack.osa.install_defaults defaults_from: "{{ install_method }}" public: true - name: Check the repo sync file on each repo server ansible.builtin.uri: url: "{{ openstack_repo_protocol }}://{{ hostvars[item]['management_address'] }}:{{ repo_server_port }}/{{ repo_requirements_file }}" with_inventory_hostnames: "{{ groups['repo_all'] }}" when: install_method == 'source' tags: - healthcheck - healthcheck-repo-install # Test haproxy-install.yml - name: Ensuring haproxy runs hosts: haproxy gather_facts: true tasks: - name: Check if host can connect to external keepalived ping IP ansible.builtin.command: "ping -c 2 {{ keepalived_external_ping_address }}" changed_when: false - name: Check if host can connect to internal keepalived ping IP ansible.builtin.command: "ping -c 2 {{ keepalived_internal_ping_address }}" changed_when: false - name: Checking if keepalived is running ansible.builtin.command: "pgrep keepalived" changed_when: false when: groups['haproxy'] | length > 1 - name: Install netcat ansible.builtin.package: name: "{% if ansible_facts['os_family'] | lower == 'redhat' %}nmap-ncat{% else %}netcat-openbsd{% endif %}" state: present # Fails if HAProxy is not running - name: Recording haproxy stats as a way to ensure haproxy runs ansible.builtin.shell: 'echo "show info;show stat" | nc -U /var/run/haproxy.stat' changed_when: false register: haproxy_stats # Run this playbook with -v and you'll see your DOWN issues - name: Printing the output of haproxy stats ansible.builtin.debug: var: haproxy_stats verbosity: 1 tags: - healthcheck - healthcheck-haproxy-install # Test repo-use.yml - name: Ensure all the containers can connect to the repos hosts: all_containers gather_facts: true # By having serial, you ensure that the first three containers are hitting # the load balancer at the same time, which would then cause hitting three # different repos servers. # When this is done, the rest can be done with all the nodes at the same time. serial: - 3 - 100% tasks: - name: Run check only for source method when: - install_method == 'source' block: - name: Setup installation variables ansible.builtin.include_role: name: openstack.osa.install_defaults defaults_from: "{{ install_method }}" public: true # Repo release path points to the internal LB vip - name: Check the presence of upper constraints on your repos and check load balancing ansible.builtin.uri: url: "{{ openstack_repo_url }}/constraints/upper_constraints_cached.txt" tags: - healthcheck - healthcheck-repo-use # Test utility-install.yml - name: Ensure the service setup host is ready to run openstack calls hosts: "{{ openstack_service_setup_host | default('localhost') }}" gather_facts: false vars: ansible_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default(ansible_facts['python']['executable']) }}" pre_tasks: - name: Setup installation variables ansible.builtin.import_role: name: openstack.osa.install_defaults defaults_from: "{{ install_method | default('source') }}" tasks: - name: Get openstack client config openstack.cloud.config: - name: Show openstack client config ansible.builtin.debug: var: openstack.clouds verbosity: 1 tags: - healthcheck - healthcheck-utility-install # Test memcached-install.yml - name: Check memcached for keystone hosts: keystone_all gather_facts: false tasks: - name: Set facts about memcached ansible.builtin.setup: delegate_to: "{{ item }}" delegate_facts: true with_items: "{{ groups['memcached'] }}" - name: Install netcat ansible.builtin.package: name: "{% if ansible_facts['os_family'] | lower == 'redhat' %}nmap-ncat{% else %}netcat-openbsd{% endif %}" state: present - name: Connect to remote memcache servers (full mesh testing) ansible.builtin.shell: "echo stats | nc -w 3 {{ hostvars[memcached_host]['management_address'] }} {{ memcached_port }}" changed_when: false register: memcache_stats with_items: "{{ groups['memcached'] }}" loop_control: loop_var: memcached_host - name: Output memcache stats if in verbose mode ansible.builtin.debug: var: memcache_stats verbosity: 1 tags: - healthcheck - healthcheck-memcached-install # Test galera-install.yml - name: Sanity checks for all containers hosts: all_containers:physical_hosts gather_facts: false tasks: - name: Connect to galera port ansible.builtin.wait_for: port: 3306 host: "{{ internal_lb_vip_address }}" state: started tags: - healthcheck - healthcheck-galera-install - name: Run functional tests hosts: galera_all user: root gather_facts: true vars: _mariadb_client_binary: "{{ galera_mariadb_client_binary | default('mariadb') }}" tasks: - name: Wait for cluster to be ready block: - name: Wait for cluster ready state ansible.builtin.command: | {{ _mariadb_client_binary }} -h {{ management_address }} \ -u "{{ galera_root_user | default('root') }}" \ -p"{{ galera_root_password }}" \ -e "show status like 'wsrep_incoming_addresses';" \ --silent \ --skip-column-names register: mysql_instance_ready retries: 20 delay: 5 changed_when: false until: mysql_instance_ready is success and mysql_instance_ready.stdout.split()[-1].split(',') | length == groups['galera_all'] | length rescue: - name: Restarting weird maria instance ansible.builtin.service: name: mariadb state: restarted - name: Wait for cluster ready state ansible.builtin.command: | {{ _mariadb_client_binary }} -h {{ management_address }} \ -u "{{ galera_root_user | default('root') }}" \ -p"{{ galera_root_password }}" \ -e "show status like 'wsrep_incoming_addresses';" \ --silent \ --skip-column-names register: mysql_instance_ready retries: 20 delay: 5 changed_when: false until: mysql_instance_ready is success and mysql_instance_ready.stdout.split()[-1].split(',') | length == groups['galera_all'] | length - name: Check cluster local state ansible.builtin.command: | {{ _mariadb_client_binary }} -h {{ management_address }} \ -u "{{ galera_root_user | default('root') }}" \ -p"{{ galera_root_password }}" \ -e "show status like 'wsrep_local_state_comment';" \ --silent \ --skip-column-names register: wsrep_local_state_comment changed_when: false tags: - skip_ansible_lint - name: Check cluster evs state ansible.builtin.command: | {{ _mariadb_client_binary }} -h {{ management_address }} \ -u "{{ galera_root_user | default('root') }}" \ -p"{{ galera_root_password }}" \ -e "show status like 'wsrep_evs_state';" \ --silent \ --skip-column-names register: wsrep_evs_state changed_when: false tags: - skip_ansible_lint - name: Check contents ansible.builtin.assert: that: - "'Synced' in wsrep_local_state_comment.stdout" - "'OPERATIONAL' in wsrep_evs_state.stdout" - name: Create DB for service on "{{ groups['galera_all'][0] }}" community.mysql.mysql_db: login_user: "{{ galera_root_user | default('root') }}" login_password: "{{ galera_root_password }}" login_host: "{{ management_address }}" name: "OSA-test" state: "present" check_hostname: true when: inventory_hostname == groups['galera_all'][0] tags: - skip_ansible_lint - name: Grant access to the DB on "{{ groups['galera_all'][-1] }}" community.mysql.mysql_user: login_user: "{{ galera_root_user | default('root') }}" login_password: "{{ galera_root_password }}" # noqa no-log-password login_host: "{{ management_address }}" name: "osa-tester" password: "tester-secrete" # noqa no-log-password host: "{{ item }}" state: "present" priv: "OSA-test.*:ALL" check_hostname: true with_items: - "localhost" - "%" when: inventory_hostname == groups['galera_all'][-1] - name: Try to login with user to DB delegate_to: "{{ groups['utility_all'][0] }}" ansible.builtin.command: | {{ _mariadb_client_binary }} -h {{ internal_lb_vip_address }} \ -p"tester-secrete" \ -u osa-tester \ OSA-test \ -e "SHOW TABLES;" changed_when: false when: inventory_hostname == groups['galera_all'][-1] - name: Remove created user community.mysql.mysql_user: login_user: "{{ galera_root_user | default('root') }}" login_password: "{{ galera_root_password }}" # noqa no-log-password login_host: "{{ management_address }}" name: "osa-tester" state: "absent" host: "{{ item }}" check_hostname: true with_items: - "localhost" - "%" when: inventory_hostname == groups['galera_all'][-1] - name: Remove created DB community.mysql.mysql_db: login_user: "{{ galera_root_user | default('root') }}" login_password: "{{ galera_root_password }}" # noqa no-log-password login_host: "{{ management_address }}" name: "OSA-test" state: "absent" check_hostname: true when: inventory_hostname == groups['galera_all'][0] tags: - skip_ansible_lint # Test rabbitmq-install.yml - name: Add a user for rabbitmq hosts: rabbitmq_all[0] gather_facts: false tasks: - name: Configure Rabbitmq vhost community.rabbitmq.rabbitmq_vhost: name: "/testvhost" state: "present" - name: Configure Rabbitmq user community.rabbitmq.rabbitmq_user: user: "testguest" password: "secrete" # noqa no-log-password vhost: "/testvhost" configure_priv: ".*" read_priv: ".*" write_priv: ".*" state: "present" tags: - healthcheck - healthcheck-rabbitmq-install - name: Ensure all the usual openstack containers can connect to rabbit hosts: all_containers:!galera_all:!memcached:!haproxy:!rabbitmq_all:!unbound:!repo_all gather_facts: false vars: venv_path: /tmp/rabbitmqtest post_tasks: - name: Setup installation variables ansible.builtin.include_role: name: openstack.osa.install_defaults defaults_from: "{{ install_method }}" public: true - name: Generate venv for rabbitmq testing ansible.builtin.include_role: name: "python_venv_build" vars: venv_install_destination_path: "{{ venv_path }}" venv_pip_packages: - pika - name: Copying test script ansible.builtin.copy: src: "scripts/rabbitmq-test.py" dest: "{{ venv_path }}/rabbitmq-test.py" mode: "0755" - name: Connect to rabbitmq ansible.builtin.command: "{{ venv_path }}/bin/python {{ venv_path }}/rabbitmq-test.py {{ hostvars[groups['rabbitmq_all'][0]]['management_address'] }}" changed_when: false tags: - healthcheck - healthcheck-rabbitmq-install - name: Remove guest user for rabbitmq hosts: rabbitmq_all[0] gather_facts: false tasks: - name: Remove test user community.rabbitmq.rabbitmq_user: user: testguest password: secrete vhost: "/testvhost" state: absent no_log: true - name: Remove test vhost community.rabbitmq.rabbitmq_vhost: name: "/testvhost" state: "absent" tags: - healthcheck - healthcheck-rabbitmq-install - healthcheck-teardown # Test zookeeper-install - name: Ensure coordination is running and accepting connections hosts: utility_all[0] tasks: - name: Probing TCP connection to zookeeper ansible.builtin.wait_for: host: "{{ hostvars[item]['management_address'] }}" port: "{{ coordination_port | default(2181) }}" with_items: "{{ groups[coordination_host_group | default('zookeeper_all')] }}" - name: Ensure zookeeper is healthy hosts: "zookeeper_all" tasks: - name: Esuring netcat is installed ansible.builtin.package: name: "{% if ansible_facts['os_family'] | lower == 'redhat' %}nmap-ncat{% else %}netcat-openbsd{% endif %}" state: present - name: Gathering zookeeper state ansible.builtin.shell: "echo ruok | nc localhost {{ coordination_port | default(2181) }}" register: zookeeper_ok changed_when: false - name: Gathering zookeeper rw/ro ansible.builtin.shell: "echo isro | nc localhost {{ coordination_port | default(2181) }}" register: zookeeper_ro changed_when: false - name: Check zookeeper results ansible.builtin.assert: that: - "'imok' in zookeeper_ok.stdout" - "'rw' in zookeeper_ro.stdout" # TODO: Other playbook's tests. |