11 Commits

Author SHA1 Message Date
Marcus
f82ab21515 Merge pull request #11 from m4rcu5nl/develop
Debian support added
2018-01-29 22:29:36 +01:00
Marcus Meurs
03786a8f7d Added Debian support to meta file
Also removed "yum repo" from readme to reflect multi platform support.
2018-01-29 22:21:51 +01:00
Marcus
3b0cdf725f Merge pull request #10 from flantel/master
Add support for Debian distros
2018-01-29 21:45:23 +01:00
Barry flanagan
5ab3e67331 Add support for Debian distros 2018-01-29 15:11:08 +00:00
Marcus
097a4f055b Merge pull request #9 from m4rcu5nl/develop
Bug fixes
2017-12-17 05:59:41 +01:00
Marcus
62682def92 Merge pull request #8 from m4rcu5nl/feature/skip_tasks_in_check_mode
Resolved errors in check-mode
2017-12-17 05:52:44 +01:00
Marcus Meurs
c90f7556c2 Resolved errors in check-mode
Fixes #3
2017-12-17 05:49:36 +01:00
Marcus
9b6296e678 Merge pull request #7 from m4rcu5nl/feature/import_tasks_propperly
Move away from deprecated way to include tasks
2017-12-17 05:40:03 +01:00
Marcus Meurs
51d2085c02 Move away from deprecated way to include tasks
Fixes #6
2017-12-17 05:32:14 +01:00
Marcus
e70be64ef7 Merge pull request #5 from gbraad/patch-1
Change headers for rendering
2017-09-11 16:51:46 +02:00
Gerard Braad
769e901ca1 Change headers for rendering
... and make example into code-block with syntax definition
2017-09-11 11:33:20 +08:00
5 changed files with 38 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
Zerotier Zerotier
========= =========
This Ansible role installs the zerotier-one package from Zerotier's yum repo, adds and authorizes new members to (existing) Zerotier network and tells the new members to join the network. This Ansible role installs the zerotier-one package, adds and authorizes new members to (existing) Zerotier network and tells the new members to join the network.
Requirements Requirements
------------ ------------
@@ -13,24 +13,24 @@ This roles requires an access token for the Zerotier API. This enables the role
Role Variables Role Variables
-------------- --------------
###zerotier_api_url ### zerotier_api_url
The url where the Zerotier API lives. Must use https protocol. The url where the Zerotier API lives. Must use https protocol.
Default: https://my.zerotier.com Default: https://my.zerotier.com
###zerotier_accesstoken ### zerotier_accesstoken
The access token needed to authorize with the Zerotier API. You can generate one in your account settings on my.zerotier.com. The access token needed to authorize with the Zerotier API. You can generate one in your account settings on my.zerotier.com.
###zerotier_network_id (required) ### zerotier_network_id (required)
The 16 character network ID of the network the new members should join. The 16 character network ID of the network the new members should join.
Example Playbook Example Playbook
---------------- ----------------
```yaml
- hosts: servers - hosts: servers
vars: vars:
zerotier_network_id: 1234567890qwerty zerotier_network_id: 1234567890qwerty
zerotier_accesstoken: "{{ vault_zerotier_accesstoken }}" zerotier_accesstoken: "{{ vault_zerotier_accesstoken }}"
roles: roles:
- { role: m4rcu5nl.zerotier } - { role: m4rcu5nl.zerotier }
```

View File

@@ -36,6 +36,9 @@ galaxy_info:
- name: EL - name: EL
versions: versions:
- 7 - 7
- name: Debian
versions:
- all
# - name: Fedora # - name: Fedora
# versions: # versions:
# - all # - all
@@ -49,7 +52,6 @@ galaxy_info:
galaxy_tags: galaxy_tags:
- zerotier-one - zerotier-one
- CentOS 7
# List tags for your role here, one per line. A tag is a keyword that describes # List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to # and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list. # remove the '[]' above, if you add tags to this list.

View File

@@ -1,4 +1,6 @@
--- ---
# Redhat variants
- block: # Add zerotier repo and it's gpg key - block: # Add zerotier repo and it's gpg key
- name: Add zerotier gpg key - name: Add zerotier gpg key
rpm_key: rpm_key:
@@ -13,10 +15,29 @@
gpgcheck: yes gpgcheck: yes
enabled: yes enabled: yes
register: zerotier_repo register: zerotier_repo
tags: tags:
- installation - installation
- repositories - repositories
when: ansible_os_family == "RedHat"
# Debian variants
- block: # Add zerotier repo and it's gpg key if not already done.
- name: Check if zerotier is already installed
package:
name: zerotier-one
state: present
check_mode: true
register: zerotier_repo
- name: Install zerotier
shell: curl -s 'https://pgp.mit.edu/pks/lookup?op=get&search=0x1657198823E52A61' | gpg --import && \
if z=$(curl -s 'https://install.zerotier.com/' | gpg); then echo "$z" | sudo bash; fi
register: zerotier_repo
when: zerotier_repo.changed
tags:
- installation
- repositories
when: ansible_os_family == "Debian"
- block: #Install and enable zerotier-one - block: #Install and enable zerotier-one
- name: Install zerotier-one - name: Install zerotier-one
@@ -36,6 +57,7 @@
when: when:
- zerotier_repo|succeeded - zerotier_repo|succeeded
- not ansible_check_mode
tags: tags:
- installation - installation
- packages - packages

View File

@@ -1,7 +1,7 @@
--- ---
- block: # Join Zerotier network - block: # Join Zerotier network
- name: Get Zerotier NodeID - name: Get Zerotier NodeID
shell: /sbin/zerotier-cli info | awk '{print $3}' shell: zerotier-cli info | awk '{print $3}'
register: nodeid register: nodeid
- name: Set NodeID as fact - name: Set NodeID as fact
@@ -23,11 +23,12 @@
register: apiresult register: apiresult
- name: Join Zerotier network - name: Join Zerotier network
command: /sbin/zerotier-cli join {{ zerotier_network_id }} command: zerotier-cli join {{ zerotier_network_id }}
args: args:
creates: /var/lib/zerotier-one/networks.d/{{ zerotier_network_id }}.conf creates: /var/lib/zerotier-one/networks.d/{{ zerotier_network_id }}.conf
when: when:
- zerotier_accesstoken is defined - zerotier_accesstoken is defined
- not ansible_check_mode
tags: tags:
- configuration - configuration

View File

@@ -1,12 +1,13 @@
--- ---
# tasks file for ansible-role-zerotier # tasks file for ansible-role-zerotier
- include: install.yml - import_tasks: install.yml
- name: Check for successfully joined networks - name: Check for successfully joined networks
shell: zerotier-cli listnetworks | grep 'OK'| awk '{print $3}' shell: zerotier-cli listnetworks | grep 'OK'| awk '{print $3}'
register: joinednetworks register: joinednetworks
check_mode: yes
- include: join_network.yml - include_tasks: join_network.yml
when: when:
- 'zerotier_network_id not in joinednetworks.stdout' - 'zerotier_network_id not in joinednetworks.stdout'
- zerotier_accesstoken is defined - zerotier_accesstoken is defined