Ansible/update-cloudflace-tunnel.yaml

28 lines
816 B
YAML

---
- name: Update cloud Flare Tunnel
hosts: cloudflare-tunnel.ki5bhv.com
tasks:
- name: Pull the newest package
ansible.builtin.command:
cmd: "curl --location --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb"
- name: installing package
become: true
ansible.builtin.command:
cmd: "dpkg -i cloudflared.deb"
- name: Restart the service
become: true
ansible.builtin.command:
cmd: "systemctl restart cloudflared.service"
- name: check before cleanup
ansible.builtin.stat:
path: cloudflared.deb
register: cloudflaredfile
- name: Cleanup
when: cloudflaredfile.stat.exists
ansible.builtin.command:
cmd: "rm cloudflared.deb"