Add draft roles for cloudflared and tailscale
This commit is contained in:
parent
db1ee687a7
commit
7caf443b35
10
roles/cloudflared/defaults/main.yaml
Normal file
10
roles/cloudflared/defaults/main.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
cloudflared_package_name: cloudflared
|
||||
cloudflared_package_state: present
|
||||
|
||||
cloudflared_service_name: cloudflared.service
|
||||
cloudflared_service_enabled: true
|
||||
cloudflared_service_state: started
|
||||
|
||||
cloudflared_apt_repository_repo: "deb [signed-by=/etc/apt/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared {{ ansible_lsb.codename }} main"
|
||||
cloudflared_apt_repository_state: present
|
BIN
roles/cloudflared/files/cloudflare-main.gpg
Normal file
BIN
roles/cloudflared/files/cloudflare-main.gpg
Normal file
Binary file not shown.
14
roles/cloudflared/tasks/Debian.yaml
Normal file
14
roles/cloudflared/tasks/Debian.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: trust cloudflare apt respository key
|
||||
ansible.builtin.copy:
|
||||
src: "cloudflare-main.gpg"
|
||||
dest: "/etc/apt/keyrings/cloudflare-main.gpg"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: configure cloudflare apt repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "{{ cloudflared_apt_repository_repo }}"
|
||||
state: "{{ cloudflared_apt_repository_state | default('present') }}"
|
||||
filename: cloudflared
|
5
roles/cloudflared/tasks/install.yaml
Normal file
5
roles/cloudflared/tasks/install.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: install package
|
||||
ansible.builtin.package:
|
||||
name: "{{ cloudflared_package_name }}"
|
||||
state: "{{ cloudflared_package_state | default('present') }}"
|
28
roles/cloudflared/tasks/main.yaml
Normal file
28
roles/cloudflared/tasks/main.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: gather os specific variables
|
||||
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
paths:
|
||||
- vars
|
||||
|
||||
- name: include os specific tasks
|
||||
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
paths:
|
||||
- tasks
|
||||
|
||||
- ansible.builtin.include_tasks: install.yaml
|
||||
|
||||
# - ansible.builtin.include_tasks: configure.yaml
|
0
roles/cloudflared/vars/default.yaml
Normal file
0
roles/cloudflared/vars/default.yaml
Normal file
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
Loading…
Reference in New Issue
Block a user