82 lines
2.2 KiB
YAML
82 lines
2.2 KiB
YAML
---
|
|
- name: Validate known health-check profile
|
|
ansible.builtin.assert:
|
|
that:
|
|
- healthcheck_profile in healthcheck_profiles
|
|
fail_msg: "Unsupported healthcheck_profile: {{ healthcheck_profile }}"
|
|
|
|
- name: Install health-check directories
|
|
ansible.builtin.file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "{{ item.mode }}"
|
|
loop:
|
|
- path: "{{ healthcheck_install_root }}"
|
|
mode: "0755"
|
|
- path: "{{ healthcheck_state_dir }}"
|
|
mode: "0750"
|
|
- path: "{{ healthcheck_log_dir }}"
|
|
mode: "0750"
|
|
|
|
- name: Install common health-check library
|
|
ansible.builtin.template:
|
|
src: health-common.sh.j2
|
|
dest: "{{ healthcheck_install_root }}/health-common.sh"
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: Install service health-check script
|
|
ansible.builtin.template:
|
|
src: "{{ healthcheck_profiles[healthcheck_profile] }}.j2"
|
|
dest: "{{ healthcheck_install_root }}/{{ healthcheck_profiles[healthcheck_profile] }}"
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: Install health-check dispatcher
|
|
ansible.builtin.template:
|
|
src: healthcheck-runner.sh.j2
|
|
dest: "{{ healthcheck_install_root }}/run"
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: Install health-check systemd unit
|
|
ansible.builtin.template:
|
|
src: vps-healthcheck.service.j2
|
|
dest: "/etc/systemd/system/{{ healthcheck_service_name }}.service"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Reload systemd
|
|
|
|
- name: Install persistent health-check timer
|
|
ansible.builtin.template:
|
|
src: vps-healthcheck.timer.j2
|
|
dest: "/etc/systemd/system/{{ healthcheck_service_name }}.timer"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Reload systemd
|
|
|
|
- name: Install health-check log rotation
|
|
ansible.builtin.template:
|
|
src: logrotate-vps-healthcheck.j2
|
|
dest: /etc/logrotate.d/vps-healthcheck
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
|
|
- name: Enable health-check timer
|
|
ansible.builtin.systemd_service:
|
|
name: "{{ healthcheck_service_name }}.timer"
|
|
enabled: true
|
|
state: started
|
|
daemon_reload: true
|
|
|
|
- name: Flush health-check systemd changes
|
|
ansible.builtin.meta: flush_handlers
|