feat: Create role

This commit is contained in:
2022-10-15 04:51:17 +02:00
committed by pulsar89.5
parent 079950f42f
commit 918c54bbc3
11 changed files with 267 additions and 4 deletions

35
handlers/main.yml Normal file
View File

@@ -0,0 +1,35 @@
---
# handlers file for hcio
- name: Write UUID in local facts
community.general.ini_file:
path: "{{ hcio_local_facts_file }}"
section: role_hcio
option: "{{ item.json.slug | replace(hcio_slug_prefix, '') }}"
value: "{{ item.json.ping_url.split('/') | last }}"
create: false
when: item.changed
become: true
loop: "{{ created.results }}"
loop_control:
label: "{{ item.get('json', {}).get('slug', '') }}"
- name: Reload local facts
ansible.builtin.setup:
filter: ansible_local
- name: Enable timer
ansible.builtin.systemd:
name: "{{ filename }}.timer"
state: started
enabled: true
daemon_reload: true
become: true
- name: Start service
ansible.builtin.systemd:
name: "{{ filename }}.service"
state: started
enabled: false
daemon_reload: true
become: true