diff --git a/rustdesk.yml b/rustdesk.yml new file mode 100644 index 0000000..b99ac91 --- /dev/null +++ b/rustdesk.yml @@ -0,0 +1,74 @@ +--- +- name: rustdesk setup + hosts: all + + vars: + this_arch: "{{ '-arm64v8' if ansible_architecture == 'aarch64' }}" + + tasks: + + - name: Allow port 21115:21119/tcp + community.general.ufw: + rule: allow + port: '21115:21119' + proto: tcp + + - name: Allow port 21116/udp + community.general.ufw: + rule: allow + port: '21116' + proto: udp + + - name: /home/docker/rustdesk.{{inventory_hostname}}/docker-compose.yml Container Configuration + blockinfile: + path: /home/docker/rustdesk.{{inventory_hostname}}/docker-compose.yml + create: yes + mode: 0440 + owner: root + group: docker + marker: "# {mark} ANSIBLE MANAGED BLOCK" + block: | + version: '3' + services: + rustdesk.{{inventory_hostname}}-hbbs: + ports: + - 21115:21115 + - 21116:21116 + - 21116:21116/udp + - 21118:21118 + image: rustdesk/rustdesk-server:latest{{this_arch}} + command: hbbs -r rustdesk.{{inventory_hostname}}:21117 -k _ + volumes: + - ./data:/root + networks: + - rustdesk.{{inventory_hostname}}--network + depends_on: + - rustdesk.{{inventory_hostname}}-hbbr + restart: unless-stopped + + rustdesk.{{inventory_hostname}}-hbbr: + ports: + - 21117:21117 + - 21119:21119 + image: rustdesk/rustdesk-server:latest{{this_arch}} + command: hbbr -k _ + volumes: + - ./data:/root + networks: + - rustdesk.{{inventory_hostname}}--network + restart: unless-stopped + + networks: + rustdesk.{{inventory_hostname}}--network: + external: false + backup: yes + notify: Restart rustdesk + + + handlers: + + - name: Restart rustdesk + ansible.builtin.shell: docker-compose up -d + args: + chdir: /home/docker/rustdesk.{{inventory_hostname}} +