Add more configuration variables

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-04-26 14:00:31 +02:00
parent f7aa68432b
commit 8debfb2845
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 29 additions and 6 deletions

View file

@ -1,8 +1,16 @@
--- ---
instance_status_apt_required: [] instance_status_apt_required: []
instance_status_global_checks: {}
instance_status_checks: {} instance_status_checks: {}
instance_status_check_interval: 1m
instance_status_checks_file: /etc/host-status.yml
instance_status_config_refresh: 10m
instance_status_port: 9000
instance_status_unhealthy_threshold: 5
instance_status_verbose: false
instance_status_version: v0.5.2 instance_status_version: v0.5.2
... ...

View file

@ -8,8 +8,9 @@
- name: Set up checks file for ELB Instance Status - name: Set up checks file for ELB Instance Status
template: template:
src: templates/checks.yml src: templates/checks.yml
dest: /etc/elb-instance-status.yml dest: '{{ instance_status_checks_file }}'
register: instance_status_config register: instance_status_config
when: "'http://' not in instance_status_checks_file and 'https://' not in instance_status_checks_file"
- name: Get current elb-instance-status version - name: Get current elb-instance-status version
shell: "/usr/local/bin/elb-instance-status --version || true" shell: "/usr/local/bin/elb-instance-status --version || true"
@ -37,20 +38,29 @@
TimeoutStartSec=0 TimeoutStartSec=0
TimeoutStopSec=0 TimeoutStopSec=0
Restart=on-failure Restart=on-failure
RestartSec=30 RestartSec=10
SyslogIdentifier=elb-instance-status SyslogIdentifier=elb-instance-status
ExecStart=/usr/local/bin/elb-instance-status \ ExecStart=/usr/local/bin/elb-instance-status \
--listen=:9001 --check-definitions-file={{ instance_status_checks_file }} \
--check-interval={{ instance_status_check_interval }} \
--config-refresh={{ instance_status_config_refresh }} \
--listen=:{{ instance_status_port }} \
--unhealthy-threshold={{ instance_status_unhealthy_threshold }} \
--verbose={{ instance_status_verbose | to_json }}
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
dest: /etc/systemd/system/elb-instance-status.service dest: /etc/systemd/system/elb-instance-status.service
register: instance_status_service register: instance_status_service
- name: Ensure elb-instance-status is enabled
systemd:
name: elb-instance-status
daemon_reload: true
enabled: true
- name: Ensure elb-instance-status is restarted on changes - name: Ensure elb-instance-status is restarted on changes
systemd: systemd:
daemon_reload: yes
name: elb-instance-status name: elb-instance-status
state: restarted state: restarted
enabled: yes when: (instance_status_config.changed or instance_status_binary.changed or instance_status_service.changed) and packer_build_name is not defined
when: instance_status_config.changed or instance_status_binary.changed or instance_status_service.changed

View file

@ -1,5 +1,10 @@
--- ---
# {{ ansible_managed }}
# Global checks
{{ instance_status_global_checks | to_nice_yaml }}
# Instance checks
{{ instance_status_checks | to_nice_yaml }} {{ instance_status_checks | to_nice_yaml }}
... ...