Add roles for lego, logcli, mimir, process_exporter, smokeping_prober, and vector
This commit is contained in:
55
roles/smokeping_prober/tasks/configure.yaml
Normal file
55
roles/smokeping_prober/tasks/configure.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
---
|
||||
- name: create group
|
||||
ansible.builtin.group:
|
||||
name: "{{ smokeping_prober_group }}"
|
||||
system: true
|
||||
|
||||
- name: create user
|
||||
ansible.builtin.user:
|
||||
name: "{{ smokeping_prober_user }}"
|
||||
shell: "{{ smokeping_prober_user_shell }}"
|
||||
home: "{{ smokeping_prober_user_home }}"
|
||||
system: true
|
||||
group: "{{ smokeping_prober_group }}"
|
||||
|
||||
- name: create var path
|
||||
ansible.builtin.file:
|
||||
path: "{{ smokeping_prober_var_path }}"
|
||||
owner: "{{ smokeping_prober_var_path_owner }}"
|
||||
group: "{{ smokeping_prober_var_path_group }}"
|
||||
mode: "{{ smokeping_prober_var_path_mode }}"
|
||||
state: "{{ smokeping_prober_var_path_state }}"
|
||||
|
||||
- name: create etc path
|
||||
ansible.builtin.file:
|
||||
path: "{{ smokeping_prober_etc_path }}"
|
||||
owner: "{{ smokeping_prober_etc_path_owner }}"
|
||||
group: "{{ smokeping_prober_etc_path_group }}"
|
||||
mode: "{{ smokeping_prober_etc_path_mode }}"
|
||||
state: "{{ smokeping_prober_etc_path_state }}"
|
||||
|
||||
- name: configure
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ smokeping_prober_config_path }}"
|
||||
owner: "{{ smokeping_prober_config_path_owner }}"
|
||||
group: "{{ smokeping_prober_config_path_group }}"
|
||||
mode: "{{ smokeping_prober_config_path_mode }}"
|
||||
content: "{{ smokeping_prober_config | to_yaml }}"
|
||||
notify:
|
||||
- restart smokeping_prober
|
||||
|
||||
- name: configure systemd unit
|
||||
ansible.builtin.template:
|
||||
src: smokeping_prober.service.j2
|
||||
dest: "/etc/systemd/system/{{ smokeping_prober_service_name }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0444
|
||||
notify:
|
||||
- restart smokeping_prober
|
||||
|
||||
- name: manage service
|
||||
ansible.builtin.service:
|
||||
name: "{{ smokeping_prober_service_name }}"
|
||||
enabled: "{{ smokeping_prober_service_enabled | default(true) }}"
|
||||
state: "{{ smokeping_prober_service_state | default('started') }}"
|
0
roles/smokeping_prober/tasks/default.yaml
Normal file
0
roles/smokeping_prober/tasks/default.yaml
Normal file
56
roles/smokeping_prober/tasks/install.yaml
Normal file
56
roles/smokeping_prober/tasks/install.yaml
Normal file
@ -0,0 +1,56 @@
|
||||
---
|
||||
- name: determine install status
|
||||
ansible.builtin.stat:
|
||||
path: "{{ smokeping_prober_opt_path }}/smokeping_prober"
|
||||
register: st
|
||||
|
||||
- name: create opt path
|
||||
ansible.builtin.file:
|
||||
path: "{{ smokeping_prober_opt_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
state: directory
|
||||
|
||||
- block:
|
||||
- name: download
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ smokeping_prober_release_url }}"
|
||||
dest: "{{ smokeping_prober_download_path }}"
|
||||
checksum: "{{ smokeping_prober_checksums[smokeping_prober_release_file] }}"
|
||||
register: dl
|
||||
until: dl is success
|
||||
retries: 5
|
||||
delay: 10
|
||||
|
||||
- name: extract
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ smokeping_prober_download_path }}"
|
||||
dest: "{{ smokeping_prober_unarchive_dest_path }}"
|
||||
remote_src: true
|
||||
|
||||
- name: install
|
||||
ansible.builtin.copy:
|
||||
src: "{{ smokeping_prober_extracted_path }}/{{ item }}"
|
||||
dest: "{{ smokeping_prober_opt_path }}/{{ item }}"
|
||||
remote_src: true
|
||||
loop: "{{ smokeping_prober_binaries }}"
|
||||
when: not st.stat.exists
|
||||
|
||||
- name: permissions
|
||||
ansible.builtin.file:
|
||||
path: "{{ smokeping_prober_opt_path }}/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
loop: "{{ smokeping_prober_binaries }}"
|
||||
|
||||
- name: symlink
|
||||
ansible.builtin.file:
|
||||
src: "{{ smokeping_prober_opt_path }}/{{ item }}"
|
||||
dest: "/usr/local/bin/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
state: link
|
||||
loop: "{{ smokeping_prober_binaries }}"
|
28
roles/smokeping_prober/tasks/main.yaml
Normal file
28
roles/smokeping_prober/tasks/main.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: gather os specific variables
|
||||
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
paths:
|
||||
- vars
|
||||
|
||||
- name: include os specific tasks
|
||||
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
paths:
|
||||
- tasks
|
||||
|
||||
- ansible.builtin.include_tasks: install.yaml
|
||||
|
||||
- ansible.builtin.include_tasks: configure.yaml
|
Reference in New Issue
Block a user