first commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
# Ansible role for installing vncserver and cinnamon desktop
|
||||||
|
URL:
|
||||||
|
|
||||||
|
## Required variables
|
||||||
|
- vnc.user
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
- name: Install vncserver
|
||||||
|
yum:
|
||||||
|
name:
|
||||||
|
- tigervnc-server
|
||||||
|
- xterm
|
||||||
|
- xorg-x11-xauth
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: Install cinnamon desktop group package
|
||||||
|
yum:
|
||||||
|
name: '@Cinnamon Desktop'
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: Create .vnc directory
|
||||||
|
file:
|
||||||
|
path: "~{{vnc.user}}/.vnc"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Create vncpassword
|
||||||
|
shell: "echo {{vnc.pass}} | vncpasswd -f > ~{{vnc.user}}/.vnc/passwd"
|
||||||
|
|
||||||
|
- name: Create xstartup file
|
||||||
|
copy:
|
||||||
|
dest: "~{{vnc.user}}/.vnc/xstartup"
|
||||||
|
content: |
|
||||||
|
#!/bin/bash
|
||||||
|
# Uncomment the following two lines for normal desktop:
|
||||||
|
unset SESSION_MANAGER
|
||||||
|
unset DBUS_SESSION_BUS_ADDRESS
|
||||||
|
#. /etc/X11/xinit/xinitrc
|
||||||
|
/bin/cinnamon-session
|
||||||
|
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
|
||||||
|
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
|
||||||
|
xsetroot -solid grey
|
||||||
|
vncconfig -iconic &
|
||||||
|
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
|
||||||
|
x-window-manager &
|
||||||
|
|
||||||
|
- name: Change ownership of .vnc
|
||||||
|
file:
|
||||||
|
path: "~{{ vnc.user }}/.vnc"
|
||||||
|
owner: {{ vnc.user }}
|
||||||
|
recurse: yes
|
||||||
|
|
||||||
|
- name: Create systemd config
|
||||||
|
copy:
|
||||||
|
dest: /etc/systemd/system/vncserver@:1.service
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=Remote desktop service (VNC)
|
||||||
|
After=syslog.target network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
User={{vnc.user}}
|
||||||
|
PIDFile=/home/%u/.vnc/%H%i.pid
|
||||||
|
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
|
||||||
|
ExecStart=/usr/bin/vncserver %i
|
||||||
|
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl start vncserver@:1
|
||||||
|
|
||||||
|
- name: Start and enable vncserver
|
||||||
|
service:
|
||||||
|
name: vncserver@:1
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: Display vnc.pass
|
||||||
|
debug:
|
||||||
|
var: vnc.pass
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
vnc.pass: "{{ lookup('password', '/dev/shm/.vncpass chars=ascii_letters,digits,hexdigits length=15') }}"
|
||||||
Reference in New Issue
Block a user