ansible-role-openstack-oper.../tasks/validate_redis.yaml

44 lines
1.4 KiB
YAML

- name: Get the Redis masterauth password
shell: |
/bin/hiera -c /etc/puppet/hiera.yaml redis::masterauth
when: redis_masterauth_password is undefined
register: redis_masterauth_password_cmd_output
become: true
no_log: true
- name: Convert the Redis masterauth password if unknown
set_fact:
redis_masterauth_password: "{{ redis_masterauth_password_cmd_output.stdout_lines[0] }}"
when: redis_masterauth_password is undefined
no_log: true
- name: Get the Redis VIP
shell: |
/bin/hiera -c /etc/puppet/hiera.yaml redis_vip
when: redis_vip is undefined
register: redis_vip_cmd_output
become: true
- name: Convert the Redis VIP if unknown
set_fact:
redis_vip: "{{ redis_vip_cmd_output.stdout_lines[0] }}"
when: redis_vip is undefined
- name: Perform a Redis check
command: /bin/redis-cli -h {{ redis_vip }} -a {{ redis_masterauth_password }} ping
register: redis_status_check_output
no_log: true
- name: Convert the Redis status
set_fact:
redis_status_check: "{{ redis_status_check_output.stdout_lines[0] }}"
- name: Fail if Redis is not running on the node
fail:
msg: "Redis not running on node: {{ inventory_hostname }}. Check the service is running on the node and try again."
when: redis_status_check != "PONG"
- name: Report Redis success
debug:
msg: "Redis running on node: {{ inventory_hostname }}"
when: redis_status_check == "PONG"