30 lines
973 B
YAML
30 lines
973 B
YAML
#!/usr/bin/env ansible-playbook
|
|
# vim:ft=ansible:
|
|
---
|
|
- name: configure zerotier for apt
|
|
block:
|
|
- name: ensure zerotier repo key
|
|
apt_key: url="{{ zerotier_repo_deb_key }}"
|
|
- name: ensure zerotier repo
|
|
apt_repository: repo="{{ zerotier_repo_deb }}"
|
|
- name: update apt cache
|
|
apt: update_cache=yes cache_valid_time=86400
|
|
- name: ensure packages
|
|
apt: name=zerotier-one
|
|
when: ansible_pkg_mgr == "apt"
|
|
- name: template unit file
|
|
template: src=zerotier-one.service dest=/etc/systemd/system/zerotier-one.service mode=0644
|
|
notify: restart zerotier
|
|
- name: join networks
|
|
command:
|
|
argv: [ zerotier-cli, join, "{{ item }}" ]
|
|
with_items: "{{ zerotier_networks_join }}"
|
|
changed_when: no
|
|
- name: leave networks
|
|
command:
|
|
argv: [ zerotier-cli, leave, "{{ item }}" ]
|
|
register: zerotierleave
|
|
with_items: "{{ zerotier_networks_leave }}"
|
|
changed_when: no
|
|
failed_when: "'0 leave connection failed' in zerotierleave.stdout"
|