diff --git a/playbooks/debian/install-zerotier.yml b/playbooks/debian/install-zerotier.yml index e69de29..5946c67 100644 --- a/playbooks/debian/install-zerotier.yml +++ b/playbooks/debian/install-zerotier.yml @@ -0,0 +1,49 @@ +--- +- name: Install ZeroTier on Debian hosts + hosts: debian + become: true + gather_facts: true + + tasks: + - name: Verify the host is running Debian + ansible.builtin.assert: + that: + - ansible_distribution == "Debian" + fail_msg: "This playbook only supports Debian hosts." + + - name: Install prerequisites + ansible.builtin.apt: + name: + - ca-certificates + - curl + - gpg + state: present + update_cache: true + cache_valid_time: 3600 + + - name: Download the official ZeroTier installer + ansible.builtin.get_url: + url: https://install.zerotier.com/ + dest: /tmp/zerotier-install.sh + mode: "0755" + + - name: Install ZeroTier + ansible.builtin.command: + cmd: bash /tmp/zerotier-install.sh + creates: /usr/sbin/zerotier-one + + - name: Enable and start ZeroTier + ansible.builtin.systemd: + name: zerotier-one + enabled: true + state: started + + - name: Check ZeroTier status + ansible.builtin.command: + cmd: zerotier-cli info + register: zerotier_status + changed_when: false + + - name: Display ZeroTier status + ansible.builtin.debug: + msg: "{{ inventory_hostname }}: {{ zerotier_status.stdout }}" \ No newline at end of file