--- - name: Create the chrony_exporter group ansible.builtin.group: name: "{{ chrony_exporter_system_group }}" state: present system: true when: chrony_exporter_system_group != "root" - name: Create the chrony_exporter user ansible.builtin.user: name: "{{ chrony_exporter_system_user }}" groups: "{{ chrony_exporter_system_group }}" append: true shell: /usr/sbin/nologin system: true create_home: false home: / when: chrony_exporter_system_user != "root" - name: Get binary when: - chrony_exporter_binary_local_dir | length == 0 - not chrony_exporter_skip_install block: - name: Download chrony_exporter binary to local folder become: false ansible.builtin.get_url: url: "{{ chrony_exporter_binary_url }}" dest: "/tmp/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch }}.tar.gz" checksum: "sha256:{{ __chrony_exporter_checksum }}" mode: '0644' register: _download_binary until: _download_binary is succeeded retries: 5 delay: 2 delegate_to: localhost check_mode: false - name: Unpack chrony_exporter binary become: false ansible.builtin.unarchive: src: "/tmp/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch }}.tar.gz" dest: "/tmp" creates: "/tmp/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch }}/chrony_exporter" delegate_to: localhost check_mode: false - name: Propagate chrony_exporter binaries ansible.builtin.copy: src: "/tmp/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch }}/chrony_exporter" dest: "{{ chrony_exporter_binary_install_dir }}/chrony_exporter" mode: 0755 owner: root group: root notify: restart chrony_exporter when: not ansible_check_mode - name: Propagate locally distributed chrony_exporter binary ansible.builtin.copy: src: "{{ chrony_exporter_binary_local_dir }}/chrony_exporter" dest: "{{ chrony_exporter_binary_install_dir }}/chrony_exporter" mode: 0755 owner: root group: root when: - chrony_exporter_binary_local_dir | length > 0 - not chrony_exporter_skip_install notify: restart chrony_exporter