This commit is contained in:
2025-01-30 23:39:54 +01:00
parent e2410e7e30
commit 3808a8bb3f
4 changed files with 68 additions and 48 deletions

View File

@ -43,6 +43,15 @@
owner: root
group: root
when: inventory_hostname != 'nas.home.lan'
- name: Upload script
ansible.builtin.copy:
src: "{{ dest_folder }}/docker_backups.py"
dest: /myapps/docker_backups.py
remote_src: true
mode: '0755'
owner: root
group: root
when: inventory_hostname != 'nas.home.lan'
- name: Upload requirements
ansible.builtin.copy:
src: "{{ dest_folder }}/requirements.txt"

View File

@ -1,5 +1,7 @@
- block:
- name: include vault
ansible.builtin.include_vars:
file: jaydee.yml
- name: Install vnc packages
ansible.builtin.apt:
name:
@ -7,40 +9,45 @@
- tigervnc-common
update_cache: yes
- name: Creating config
become: true
ansible.builtin.copy:
dest: "/etc/systemd/system/vncserver@.service"
content: |
[Unit]
Description=VNC Server
After=syslog.target network.target
[Service]
Type=forking
WorkingDirectory=/home/jd
User=jd
Group=jd
ExecStartPre=/bin/sh -c '/usr/bin/tigervncserver -kill %i > /dev/null 2>&1 || :'
ExecStart = /usr/bin/tigervncserver -xstartup /usr/bin/mate-session -SecurityTypes VncAuth,TLSVnc -geometry 1600x900 -localhost no %i
ExecStop = /usr/bin/tigervncserver -kill %i
Environment="HOME=/home/jd"
[Install]
WantedBy=multi-user.target
owner: root
mode: '0744'
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /home/jd/.vnc/
path: /home/jd/.vnc
state: directory
mode: '0755'
mode: '0700'
owner: jd
group: jd
- name: Creating a file with content
copy:
dest: "/home/jd/.vnc/config"
content: |
session=mate
geometry=1200x721
localhost
alwaysshared
mode: '0755'
owner: jd
group: jd
- name: Reconfigure vnc
ansible.builtin.lineinfile:
path: /etc/tigervnc/vncserver-config-defaults
regexp: "^$localhost =.* "
line: '$localhost = "no";'
- name: Reconfigure vnc1
ansible.builtin.lineinfile:
path: /etc/tigervnc/vncserver.users
#regexp: "^:1=.*"
line: ':1=jd'
- name: Reconfigure zabbix agent Server
ansible.builtin.lineinfile:
path: "/etc/tigervnc/vncserver.users"
regexp: "^:1=jd"
line: ":1=jd"
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
- name: Set vnc password
ansible.builtin.shell:
cmd: echo "{{ vnc_password }}" | vncpasswd -f > /home/jd/.vnc/vncpasswd
- name: Set vnc password
ansible.builtin.shell:
cmd: echo "{{ vnc_password }}" | vncpasswd -f > /home/jd/.vnc/passwd
- name: Restart service vncserver, in all cases
ansible.builtin.service:
name: vncserver@:1
state: restarted
daemon-reload: true
enabled: true
become: true