openvpn/tasks/main.yml
Knut Ahlers 7fd7b799a1
Use cache_valid_time for apt module
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-03-19 16:13:05 +01:00

23 lines
496 B
YAML

---
- name: Install required package
apt:
name: openvpn
cache_valid_time: 86400
- name: Install client connection
template:
src: templates/client.conf
dest: /etc/openvpn/client.conf
register: openvpn_config
- name: Enable autostart for OpenVPN connection "client"
systemd:
name: openvpn@client.service
enabled: yes
- name: Restart OpenVPN connection when required
systemd:
name: openvpn@client.service
state: restarted
when: openvpn_config.changed