ansible-collection-prometheus/roles/smokeping_prober/tasks/install.yml
SuperQ 5879df729c
feat: Add role smokeping_prober
Add a role for the Smokeping Prober.

Signed-off-by: SuperQ <superq@gmail.com>
2023-07-10 21:41:40 +02:00

69 lines
2.3 KiB
YAML

---
- name: Create the smokeping_prober group
ansible.builtin.group:
name: "{{ smokeping_prober_system_group }}"
state: present
system: true
when: smokeping_prober_system_group != "root"
- name: Create the smokeping_prober user
ansible.builtin.user:
name: "{{ smokeping_prober_system_user }}"
groups: "{{ smokeping_prober_system_group }}"
append: true
shell: /usr/sbin/nologin
system: true
create_home: false
home: /
when: smokeping_prober_system_user != "root"
- name: Discover latest version
when:
- smokeping_prober_binary_local_dir | length == 0
- not smokeping_prober_skip_install
block:
- name: Download smokeping_prober binary to local folder
become: false
ansible.builtin.get_url:
url: "{{ smokeping_prober_binary_url }}"
dest: "/tmp/smokeping_prober-{{ smokeping_prober_version }}.linux-{{ go_arch }}.tar.gz"
checksum: "sha256:{{ __smokeping_prober_checksum }}"
mode: '0644'
register: _download_binary
until: _download_binary is succeeded
retries: 5
delay: 2
delegate_to: localhost
check_mode: false
- name: Unpack smokeping_prober binary
become: false
ansible.builtin.unarchive:
src: "/tmp/smokeping_prober-{{ smokeping_prober_version }}.linux-{{ go_arch }}.tar.gz"
dest: "/tmp"
creates: "/tmp/smokeping_prober-{{ smokeping_prober_version }}.linux-{{ go_arch }}/smokeping_prober"
delegate_to: localhost
check_mode: false
- name: Propagate smokeping_prober binaries
ansible.builtin.copy:
src: "/tmp/smokeping_prober-{{ smokeping_prober_version }}.linux-{{ go_arch }}/smokeping_prober"
dest: "{{ smokeping_prober_binary_install_dir }}/smokeping_prober"
mode: 0755
owner: root
group: root
notify: restart smokeping_prober
when: not ansible_check_mode
- name: Propagate locally distributed smokeping_prober binary
ansible.builtin.copy:
src: "{{ smokeping_prober_binary_local_dir }}/smokeping_prober"
dest: "{{ smokeping_prober_binary_install_dir }}/smokeping_prober"
mode: 0755
owner: root
group: root
when:
- smokeping_prober_binary_local_dir | length > 0
- not smokeping_prober_skip_install
notify: restart smokeping_prober