Add draft roles for cloudflared and tailscale
This commit is contained in:
10
roles/tailscale/defaults/main.yaml
Normal file
10
roles/tailscale/defaults/main.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
# tailscale_package_name: tailscale
|
||||
# tailscale_package_state: present
|
||||
|
||||
# tailscale_service_name: tailscaled
|
||||
# tailscale_service_state: started
|
||||
# tailscale_service_enabled: true
|
||||
|
||||
tailscale_up_args:
|
||||
[]
|
13
roles/tailscale/tasks/Debian.yaml
Normal file
13
roles/tailscale/tasks/Debian.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: add tailscale repo
|
||||
block:
|
||||
- name: install apt key
|
||||
ansible.builtin.get_url:
|
||||
url: "https://pkgs.tailscale.com/stable/{{ ansible_distribution | lower }}/{{ ansible_distribution_release | lower }}.noarmor.gpg"
|
||||
dest: /etc/apt/trusted.gpg.d/tailscale-archive-keyring.gpg
|
||||
|
||||
- name: install apt repo
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [signed-by=/etc/apt/trusted.gpg.d/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }} main"
|
||||
state: present
|
||||
filename: tailscale
|
11
roles/tailscale/tasks/configure.yaml
Normal file
11
roles/tailscale/tasks/configure.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: manage service
|
||||
ansible.builtin.service:
|
||||
name: "{{ tailscale_service_name | default('tailscaled') }}"
|
||||
state: "{{ tailscale_service_state | default('started') }}"
|
||||
enabled: "{{ tailscale_service_enabled | default(true) }}"
|
||||
|
||||
- name: tailscale up
|
||||
ansible.builtin.shell:
|
||||
cmd: "tailscale up {{ tailscale_up_args | join(' ') }} --authkey {{ tailscale_authkey }}"
|
||||
no_log: true
|
0
roles/tailscale/tasks/default.yaml
Normal file
0
roles/tailscale/tasks/default.yaml
Normal file
5
roles/tailscale/tasks/install.yaml
Normal file
5
roles/tailscale/tasks/install.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: install
|
||||
ansible.builtin.package:
|
||||
name: "{{ tailscale_package_name | default('tailscale') }}"
|
||||
state: "{{ tailscale_package_state | default('present') }}"
|
31
roles/tailscale/tasks/main.yaml
Normal file
31
roles/tailscale/tasks/main.yaml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
- name: gather OS specific variables
|
||||
ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
paths:
|
||||
- vars
|
||||
|
||||
- name: run os specific tasks
|
||||
ansible.builtin.include_tasks: "{{ lookup('ansible.builtin.first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
paths:
|
||||
- tasks
|
||||
|
||||
- debug:
|
||||
var: ansible_facts
|
||||
|
||||
- include_tasks: install.yaml
|
||||
|
||||
- include_tasks: configure.yaml
|
0
roles/tailscale/vars/default.yaml
Normal file
0
roles/tailscale/vars/default.yaml
Normal file
Reference in New Issue
Block a user