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

View File

@ -26,4 +26,6 @@
- name: wazuh-agent
tags: wazuh-agent
- role: mqtt-srv
tags: mqtt-srv
tags: mqtt-srv
- role: vnc_server
tags: vnc_server

View File

@ -1,15 +1,17 @@
$ANSIBLE_VAULT;1.1;AES256
64653733616336656435326432346561323838316463303932623433633565636333383264353564
6564633266633362346565303764313735356437656534640a306435383934313333313761303433
63373839383236663233316330343161623435626334303934626161626664363833346134363931
6163623238373132340a346530336337313238353233633332383563343366383538343062353637
32646562343166393737346330306439373230663137383430313532383064633765643031653264
37663134613538636639376439383530623432353332633938623362336539653864663634353261
36663266323566666361353065643239363365626264666131393033346561666562363836626665
36646138653834306564363965343338613936306334343733366633666435363636333436356538
66343034646631366131353366343136636136633162663535343939636431326534353962393361
30663331376563653935666565333466363562656130663462646639626138613365636533646333
66626131633039373064396132626232626336653434613966363466393739383030346635623165
31613131656336363966383239356137393163613036343638363834353639636431626634613031
39666239323936343732616234353465613066386362303265323436373435363864663531616234
6639666332643335623237623366666465633437343663303736
37396163363830306632376461613061333432336166376338306632633139383336343536316463
3863643031313433613130613665373466383432323039350a333365363839616135353061653834
38396136343338366162366366326265346632656561636535633631346638333730613763373065
3732386136373565620a643661333137373738333332633631303535333836666465643862396634
62633466346463363363313162376464393533636335336533313536333531366139393134323733
64643535346530653865633034636466643635633430376539633061353037353236333531396531
64336133663630663438303266653662326463396565323664303764356264623661303465643038
36376531323365643363363465353064623630663662633238663661346630326464356232303564
30316265613438643731626463626564663963613036386235383766616561323235636566333438
31633933343138383237363765663735656362376132363336633631336462636531346664353435
33623935326532646136646436613662316431306336613632643639386534343532666237633433
63343031376462616262623965363139343961376162646133376232323365656663376361663539
62613637393630303830653232663563333436373663656434646632396162653030333034383961
62626334623833393536323035636135663530326138366332666535336130373733323835663232
36313035353436633962633435623232323362633265666330623761373162303235376264613339
37343139333730346362

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