forked from ansible_roles/dn42
Compare commits
7 Commits
ipv4_link_
...
main
Author | SHA1 | Date |
---|---|---|
n0emis | 4f3c580294 | 4 years ago |
n0emis | 90249ad430 | 4 years ago |
n0emis | ddb126248f | 4 years ago |
n0emis | ede924e821 | 4 years ago |
n0emis | d8a6a48bd9 | 4 years ago |
Moritz 'e1mo' Fromm | 9b2d0af2ef | 4 years ago |
n0emis | ae21588748 | 4 years ago |
@ -1,23 +1,38 @@
|
||||
|
||||
- name: Install wg-quick@{{ peer.if.name | default("dn42_" + peer.name) }} config
|
||||
- name: Install wg-quick@{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }} config
|
||||
template:
|
||||
dest: "/etc/wireguard/{{ peer.if.name | default('dn42_' + peer.name) }}.conf"
|
||||
dest: "/etc/wireguard/{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }}.conf"
|
||||
src: "wg-quick.j2"
|
||||
when: "peer.wg is defined"
|
||||
when:
|
||||
- peer.wg is defined
|
||||
- (not peer.state is defined) or peer.state != "absent"
|
||||
register: "configuration"
|
||||
|
||||
- name: Enable wg-quick@{{ peer.if.name | default("dn42_" + peer.name) }} service
|
||||
- name: Enable wg-quick@{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }} service
|
||||
service:
|
||||
name: "wg-quick@{{ peer.if.name | default('dn42_' + peer.name) }}"
|
||||
name: "wg-quick@{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }}"
|
||||
enabled: yes
|
||||
when:
|
||||
- peer.wg is defined
|
||||
- (not peer.state is defined) or peer.state != "absent"
|
||||
|
||||
- name: Restart wg-quick@{{ peer.if.name | default('dn42_' + peer.name) }}
|
||||
- name: Restart wg-quick@{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }}
|
||||
service:
|
||||
name: "wg-quick@{{ peer.if.name | default('dn42_' + peer.name) }}"
|
||||
name: "wg-quick@{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }}"
|
||||
state: restarted
|
||||
when: "configuration is changed"
|
||||
|
||||
|
||||
|
||||
|
||||
when:
|
||||
- "configuration is changed"
|
||||
- (not peer.state is defined) or peer.state != "absent"
|
||||
|
||||
- name: Stop wg-quick@{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }}
|
||||
service:
|
||||
name: "wg-quick@{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }}"
|
||||
state: stopped
|
||||
enabled: no
|
||||
when: peer.state is defined and peer.state == "absent"
|
||||
|
||||
- name: Remove wg-quick@{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }} config
|
||||
file:
|
||||
path: "/etc/wireguard/{{ peer.if.name | default(dn42_wg_default_if_prefix + peer.name) }}.conf"
|
||||
state: absent
|
||||
when: peer.state is defined and peer.state == "absent"
|
||||
|
Loading…
Reference in New Issue