add rustdesk role

This commit is contained in:
Sergey Malyuk
2025-12-17 11:20:05 +03:00
parent 87cf29448b
commit 7fd2c6d60a
25 changed files with 458 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
---
- name: "Get public IP"
register: public_ip
changed_when: false
ansible.builtin.uri:
url: https://ifconfig.me
return_content: true
headers:
Accept: text/plain
User-Agent: curl/7.68.0
- name: "Get public key"
register: public_key
changed_when: false
ansible.builtin.command: "cat /opt/rustdesk-server/lib/id_ed25519.pub"
- name: "Get client rustdesk binary information"
changed_when: false
register: rustdesk_bin
ansible.builtin.stat:
path: "/opt/rustdesk-server/lib/rustdesk-host={{ public_ip.content }},key={{ public_key.stdout }}.exe"
- name: "Check if client binary exists"
changed_when: false
ansible.builtin.assert:
that: "rustdesk_bin.stat.exists"
success_msg: "Rustdesk binary exists and named correctly"
fail_msg: "Rustdesk binary not found"

View File

@@ -0,0 +1,5 @@
---
- name: Converge
hosts: all
roles:
- role: "genlab.rustdesk_server"

View File

@@ -0,0 +1,27 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: ubuntu
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2404}-ansible:latest
pre_build_image: true
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint .

View File

@@ -0,0 +1,27 @@
---
- name: Verify
hosts: all
gather_facts: false
any_errors_fatal: true
vars_files:
- ../../defaults/main.yml
tasks:
- name: "Gather service facts"
ansible.builtin.service_facts:
- name: "Check if rustdesk-hbbr is running"
ansible.builtin.assert:
that: "ansible_facts.services['rustdesk-hbbr.service'].state == 'running'"
success_msg: "rustdesk-hbbr is running"
fail_msg: "rustdesk-hbbr is NOT running"
- name: "Check if rustdesk-hbbs is running"
ansible.builtin.assert:
that: "ansible_facts.services['rustdesk-hbbs.service'].state == 'running'"
success_msg: "rustdesk-hbbs is running"
fail_msg: "rustdesk-hbbs is NOT running"
- name: "Check client binary existance"
ansible.builtin.include_tasks: client-binary-existance.yml