fnltochka.zerotier
ZeroTier
This Ansible role adds the ZeroTier repository and installs the zerotier-one package using your system's package manager. Depending on the provided variables this role can also add and authorize new members to (existing) ZeroTier networks, and tell the new member to join the network.
Requirements
Technically this role has no requirements. If it's ran without any variables set it will only run the installation tasks. The following variables impact the role's behavior:
zerotier_network_id: when set hosts are told to join this network.
zerotier_api_accesstoken: when set the role can handle member authentication and configuration using the ZeroTier API.
Role Variables
zerotier_network_id
Type: string
Default value:
Description: The 16 character network ID of the network the new members should join. The node will not join any network if omitted.
zerotier_member_register_short_hostname
Type: boolean
Default value: false
Description: By default inventory_hostname will be used to name a member in a network. If set to true, inventory_hostname_short will be used instead.
zerotier_member_ip_assignments
Type: list
Default value: ""
Description: A list of IP addresses to assign this member. For example, “[192.168.0.1, 192.168.0.2]". If you write “[]”, the system will select the addresses for you. If you don't write anything, the IP addresses will remain the same.
zerotier_member_description
Type: string
Default value: ""
Description: Optional description for a member.
zerotier_allow_managed
Type: string
Default value: true
Description: Allow ZeroTier to set IP Addresses and Routes ( local/private ranges only)
zerotier_allow_global
Type: string
Default value: false
Description: Allow ZeroTier to set Global/Public/Not-Private range IPs and Routes.
zerotier_allow_default
Type: string
Default value: false
Description: Allow ZeroTier to set the Default Route on the system.
zerotier_allow_dns
Type: string
Default value: false
Description: Allow ZeroTier to set DNS servers.
zerotier_api_accesstoken
Type: string
Default value: ""
Description: The access token needed to authorize with the ZeroTier API. You can generate one in your account settings at https://my.zerotier.com/. If this is left out then the newly joined member will not be automatically authorized.
zerotier_api_url
Type: string
Default value: https://my.zerotier.com
Description: The url where the Zerotier API lives. Must use HTTPS protocol.
zerotier_api_delegate
Type: string
Default value: localhost
Description: Option to delegate tasks for Zerotier API calls. This is useful in a situation where API calls can only be made from a white-listed management server, for example.
Example Playbook
- hosts: servers
vars:
zerotier_network_id: 1234567890qwerty
zerotier_api_accesstoken: "{{ vault_zerotier_accesstoken }}"
zerotier_register_short_hostname: true
zerotier_allow_dns: true
roles:
- { role: fnltochka.zerotier, become: true }
Example Inventory
[servers]
web1.example.com zerotier_member_ip_assignments='["192.168.195.1", "192.168.195.2"]'
web2.example.com zerotier_member_ip_assignments='["192.168.195.3", "192.168.195.4"'
db1.example.com zerotier_member_ip_assignments='["192.168.195.10"]'
db2.example.com zerotier_member_ip_assignments='["192.168.195.11"]'
db3.example.com zerotier_member_ip_assignments='["192.168.195.12"]'
[webservers]
web1.example.com
web2.example.com
[dbservers]
db1.example.com
db2.example.com
db3.example.com
[webservers:vars]
zerotier_member_description='<AppName> webserver'
[dbservers:vars]
zerotier_member_description='<AppName> db cluster node'
Installation and configuration of the zerotier-one package. Improved fork m4rcu5nl.zerotier-one
ansible-galaxy install fnltochka.zerotier