mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-26 13:50:20 +00:00
32d15d4361
Signed-off-by: Mark Tomich <tomichms@nih.gov>
74 lines
2.4 KiB
YAML
74 lines
2.4 KiB
YAML
---
|
|
- name: Create the ipmi_exporter group
|
|
ansible.builtin.group:
|
|
name: "{{ ipmi_exporter_system_group }}"
|
|
state: present
|
|
system: true
|
|
when: ipmi_exporter_system_group != "root"
|
|
|
|
- name: Create the ipmi_exporter user
|
|
ansible.builtin.user:
|
|
name: "{{ ipmi_exporter_system_user }}"
|
|
groups: "{{ ipmi_exporter_system_group }}"
|
|
append: true
|
|
shell: /usr/sbin/nologin
|
|
system: true
|
|
create_home: false
|
|
home: /
|
|
when: ipmi_exporter_system_user != "root"
|
|
|
|
- name: Get binary
|
|
when:
|
|
- ipmi_exporter_binary_local_dir | length == 0
|
|
- not ipmi_exporter_skip_install
|
|
block:
|
|
|
|
- name: Download ipmi_exporter binary to local folder
|
|
become: false
|
|
ansible.builtin.get_url:
|
|
url: "{{ ipmi_exporter_binary_url }}"
|
|
dest: "{{ ipmi_exporter_archive_path }}/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{ go_arch }}.tar.gz"
|
|
checksum: "sha256:{{ __ipmi_exporter_checksum }}"
|
|
mode: '0644'
|
|
register: _download_binary
|
|
until: _download_binary is succeeded
|
|
retries: 5
|
|
delay: 2
|
|
delegate_to: localhost
|
|
check_mode: false
|
|
|
|
- name: Unpack ipmi_exporter binary
|
|
become: false
|
|
ansible.builtin.unarchive:
|
|
src: "{{ ipmi_exporter_archive_path }}/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{ go_arch }}.tar.gz"
|
|
dest: "{{ ipmi_exporter_archive_path }}"
|
|
creates: "{{ ipmi_exporter_archive_path }}/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{ go_arch }}/ipmi_exporter"
|
|
delegate_to: localhost
|
|
check_mode: false
|
|
|
|
- name: Propagate ipmi_exporter binaries
|
|
ansible.builtin.copy:
|
|
src: "{{ ipmi_exporter_archive_path }}/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{ go_arch }}/ipmi_exporter"
|
|
dest: "{{ ipmi_exporter_binary_install_dir }}/ipmi_exporter"
|
|
mode: 0755
|
|
owner: root
|
|
group: root
|
|
notify: restart ipmi_exporter
|
|
when: not ansible_check_mode
|
|
|
|
- name: Propagate locally distributed ipmi_exporter binary
|
|
ansible.builtin.copy:
|
|
src: "{{ ipmi_exporter_binary_local_dir }}/ipmi_exporter"
|
|
dest: "{{ ipmi_exporter_binary_install_dir }}/ipmi_exporter"
|
|
mode: 0755
|
|
owner: root
|
|
group: root
|
|
when:
|
|
- ipmi_exporter_binary_local_dir | length > 0
|
|
- not ipmi_exporter_skip_install
|
|
notify: restart ipmi_exporter
|
|
|
|
- name: Install freeipmi package
|
|
ansible.builtin.package:
|
|
name: freeipmi
|
|
state: present
|