instance-status/tasks/main.yml
Knut Ahlers 6858efedc6
Fix: Condition broken
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2017-12-25 02:34:51 +01:00

55 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
shell: "/usr/local/bin/elb-instance-status --version || true"
check_mode: no
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.stdout
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