1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_collection_wireguard.git synced 2024-10-27 22:47:42 +01:00
ansible_collection_wireguard/roles/wireguardui/tasks/systemd.yml

34 lines
711 B
YAML
Raw Permalink Normal View History

2024-10-14 01:34:07 +02:00
---
- name: Make sure wireguard config exist
become: true
ansible.builtin.file:
path: '/etc/wireguard/wg0.conf'
state: 'touch'
owner: 'root'
group: 'root'
mode: '0644'
- name: Copy systemd units
become: true
ansible.builtin.template:
src: "templates/{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
owner: 'root'
group: 'root'
mode: '0644'
with_items:
- 'wgui.path'
- 'wgui.service'
notify: "systemctl restart {{ item }}"
- name: Run systemctl start wgui
become: true
ansible.builtin.systemd_service:
name: "{{ item }}"
enabled: true
state: 'started'
daemon_reload: true
with_items:
- 'wgui.path'
- 'wgui.service'