refactor: reorganize Ansible tasks for better structure and include common package installations
All checks were successful
Nix Format Check / check-format (pull_request) Successful in 40s
All checks were successful
Nix Format Check / check-format (pull_request) Successful in 40s
This commit is contained in:
37
config/ansible/tasks/global/tailscale.yml
Normal file
37
config/ansible/tasks/global/tailscale.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
- name: Ensure Tailscale is installed
|
||||
ansible.builtin.package:
|
||||
name: tailscale
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Check if Tailscale is installed
|
||||
ansible.builtin.command: tailscale
|
||||
register: tailscale_check
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Install Tailscale
|
||||
ansible.builtin.command: tailscale up
|
||||
args:
|
||||
creates: /var/lib/tailscale/tailscaled.state
|
||||
when: tailscale_check.rc != 0
|
||||
become: true
|
||||
|
||||
- name: Check if Tailscale is running
|
||||
ansible.builtin.command: tailscale status
|
||||
register: tailscale_status
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Enable and start Tailscale service
|
||||
ansible.builtin.systemd:
|
||||
name: tailscaled
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
become: true
|
||||
|
||||
- name: Notify user to authenticate Tailscale
|
||||
ansible.builtin.debug:
|
||||
msg: "Please authenticate Tailscale by running: sudo tailscale up --operator=$USER"
|
||||
when: tailscale_status.rc != 0
|
Reference in New Issue
Block a user