1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_rustdesk.git synced 2024-08-16 10:19:48 +02:00

Create rustdesk and start config

This commit is contained in:
L3D 2024-02-18 05:49:34 +01:00
parent 23afb93340
commit aaf5b58ebd
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
6 changed files with 80 additions and 7 deletions

26
handlers/main.yml Normal file
View file

@ -0,0 +1,26 @@
---
- name: "Restart Rustdesk Signal Server"
listen: 'systemctl restart rustdesk-hbbs'
become: true
ansible.builtin.systemd:
name: rustdesk-hbbs
state: restarted
when: ansible_service_mgr == "systemd"
- name: "Restart Rustdesk Relay Server"
listen: 'systemctl restart rustdesk-hbbr'
become: true
ansible.builtin.systemd:
name: rustdesk-hbbr
state: restarted
when: ansible_service_mgr == "systemd"
- name: "Reload systemd"
listen: 'systemctl daemon-reload'
become: true
ansible.builtin.systemd:
daemon_reload: true
when: ansible_service_mgr == "systemd"
notify:
- 'systemctl restart rustdesk-hbbs'
- 'systemctl restart rustdesk-hbbr'

View file

@ -1,5 +1,5 @@
---
- name: "Create config and data directory"
- name: "Create rustdesk home"
become: true
ansible.builtin.file:
path: "{{ item }}"

38
tasks/keys.yml Normal file
View file

@ -0,0 +1,38 @@
---
- name: Make sure there is a key for rustdesk
become: true
block:
- name: Get public key of rustdesk
ansible.builtin.slurp:
src: "{{ rustdesk__home }}/id_ed25519.pub"
register: _rustdesk_pubkey
rescue:
- name: Run Rustdesk Signal Server once to generate pubkey
ansible.builtin.command:
cmd: "{{ rustdesk__rustdesk_utils_executable_path }} genkeypair"
register: _rustdesk_gen_keys
- name: Write secret key to Server
ansible.builtin.copy:
content: "{{ _rustdesk_gen_keys.stdout_lines[1].split(':') | last | trim }}"
dest: "{{ rustdesk__home }}/id_ed25519"
mode: '0644'
owner: "{{ rustdesk__user }}"
group: "{{ rustdesk__group }}"
- name: Write public key to Server
ansible.builtin.copy:
content: "{{ _rustdesk_gen_keys.stdout_lines[0].split(':') | last | trim }}"
dest: "{{ rustdesk__home }}/id_ed25519.pub"
mode: '0644'
owner: "{{ rustdesk__user }}"
group: "{{ rustdesk__group }}"
- name: Get public key of rustdesk
ansible.builtin.slurp:
src: "{{ rustdesk__home }}/id_ed25519.pub"
register: _rustdesk_pubkey
- name: debug
ansible.builtin.debug:
msg: "Pubkey: {{ _rustdesk_pubkey.content }}"

View file

@ -20,7 +20,11 @@
ansible.builtin.include_tasks:
file: 'directory.yml'
# - name: Setup homebox systemd service
# ansible.builtin.include_tasks:
# file: 'install_systemd.yml'
# when: ansible_service_mgr == "systemd"
- name: Create Keys for rustdesk
ansible.builtin.include_tasks:
file: 'keys.yml'
- name: Setup homebox systemd service
ansible.builtin.include_tasks:
file: 'install_systemd.yml'
when: ansible_service_mgr == "systemd"

View file

@ -60,10 +60,15 @@
rustdesk__version_target: "{{ rustdesk__version }}"
when: rustdesk__version != "latest"
- ansible.builtin.debug:
msg: |
rustdesk__hbbr_active_version.stdout: {{ rustdesk__hbbr_active_version.stdout[:-2] }}
rustdesk__remote_version: {{ rustdesk__remote_version[:-2] }}
- name: 'Assert that remote version is higher'
ansible.builtin.assert:
that:
- rustdesk__hbbr_active_version is version(rustdesk__remote_version, 'lt')
- rustdesk__hbbr_active_version.stdout is ansible.builtin.version(rustdesk__remote_version, '<=')
fail_msg: ERROR - Remote version is lower then current version!
when:
- rustdesk__version == "latest" and rustdesk__hbbr_active_version.stderr == ""

View file

@ -12,5 +12,5 @@ rustdesk__dl_filename: "rustdesk-server-{{ ansible_system }}-{{ rustdesk__arch }
rustdesk__dl_url: "https://github.com/rustdesk/rustdesk-server/releases/download/{{ rustdesk__version_target }}/{{ rustdesk__dl_filename }}.zip"
# versionscheck
playbook_version_number: 2
playbook_version_number: 3
playbook_version_path: 'role_l3d.rustdesk.version'