mirror of
https://github.com/luzifer-ansible/instance-status.git
synced 2024-11-09 22:20:04 +00:00
54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
---
|
|
|
|
- name: Install required packages
|
|
apt:
|
|
name: "{{ item }}"
|
|
with_items: '{{ instance_status_apt_required }}'
|
|
|
|
- name: Set up checks file for ELB Instance Status
|
|
template:
|
|
src: templates/checks.yml
|
|
dest: /etc/elb-instance-status.yml
|
|
register: instance_status_config
|
|
|
|
- name: Get current elb-instance-status version
|
|
command: /usr/local/bin/elb-instance-status --version
|
|
register: instance_status_version_cmd
|
|
|
|
- name: Download elb-instance-status release
|
|
get_url:
|
|
url: 'https://github.com/Luzifer/elb-instance-status/releases/download/{{ instance_status_version }}/elb-instance-status_linux_amd64'
|
|
dest: /usr/local/bin/elb-instance-status
|
|
mode: 0755
|
|
when: instance_status_version not in instance_status_version_cmd.output
|
|
register: instance_status_binary
|
|
|
|
- name: Install system.d service
|
|
copy:
|
|
content: |
|
|
[Unit]
|
|
Description=Machine health checking service
|
|
After=network-online.target
|
|
Requires=network-online.target
|
|
|
|
[Service]
|
|
TimeoutStartSec=0
|
|
TimeoutStopSec=0
|
|
Restart=on-failure
|
|
RestartSec=30
|
|
SyslogIdentifier=elb-instance-status
|
|
ExecStart=/usr/local/bin/elb-instance-status \
|
|
--listen=:9001
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
dest: /etc/systemd/system/elb-instance-status.service
|
|
register: instance_status_service
|
|
|
|
- name: Ensure elb-instance-status is restarted on changes
|
|
systemd:
|
|
daemon_reload: yes
|
|
name: elb-instance-status
|
|
state: restarted
|
|
enabled: yes
|
|
when: instance_status_config.changed or instance_status_binary.changed or instance_status_service.changed
|