update after testing

This commit is contained in:
xpk
2019-01-22 16:58:51 +08:00
parent d79b3260c8
commit 7d75f4474f
2 changed files with 28 additions and 18 deletions
+27 -17
View File
@@ -1,28 +1,37 @@
- name: Install EPEL repo
yum:
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
state: installed
# This environment group is tested on RHEL7 only
# See https://docs.ansible.com/ansible/latest/modules/yum_module.html#notes for package group vs environment group
#
- name: Install Server with GUI package group, may take a while...
yum:
name: '@^Server with GUI'
state: latest
- name: Install vncserver - name: Install vncserver
yum: yum:
name: name:
- tigervnc-server - tigervnc-server
- xterm - xterm
- xorg-x11-xauth - xorg-x11-xauth
state: latest - cinnamon
- name: Install cinnamon desktop group package
yum:
name: '@Cinnamon Desktop'
state: latest state: latest
- name: Create .vnc directory - name: Create .vnc directory
file: file:
path: "~{{vnc.user}}/.vnc" path: "~{{vncuser}}/.vnc"
state: directory state: directory
mode: 0755 mode: 0755
- name: Create vncpassword - name: Create vncpassword
shell: "echo {{vnc.pass}} | vncpasswd -f > ~{{vnc.user}}/.vnc/passwd" shell: "echo {{vncpass}} | vncpasswd -f > ~{{vncuser}}/.vnc/passwd"
- name: Create xstartup file - name: Create xstartup file
copy: copy:
dest: "~{{vnc.user}}/.vnc/xstartup" dest: "~{{vncuser}}/.vnc/xstartup"
content: | content: |
#!/bin/bash #!/bin/bash
# Uncomment the following two lines for normal desktop: # Uncomment the following two lines for normal desktop:
@@ -39,10 +48,15 @@
- name: Change ownership of .vnc - name: Change ownership of .vnc
file: file:
path: "~{{ vnc.user }}/.vnc" path: "~{{ vncuser }}/.vnc"
owner: {{ vnc.user }} owner: "{{ vncuser }}"
recurse: yes recurse: yes
- name: Change perm of passwd file
file:
path: "~{{ vncuser }}/.vnc/passwd"
mode: 0600
- name: Create systemd config - name: Create systemd config
copy: copy:
dest: /etc/systemd/system/vncserver@:1.service dest: /etc/systemd/system/vncserver@:1.service
@@ -53,7 +67,7 @@
[Service] [Service]
Type=forking Type=forking
User={{vnc.user}} User={{vncuser}}
PIDFile=/home/%u/.vnc/%H%i.pid PIDFile=/home/%u/.vnc/%H%i.pid
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver %i ExecStart=/usr/bin/vncserver %i
@@ -61,10 +75,6 @@
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start vncserver@:1
- name: Start and enable vncserver - name: Start and enable vncserver
service: service:
@@ -72,6 +82,6 @@
state: started state: started
enabled: yes enabled: yes
- name: Display vnc.pass - name: Display vncpass
debug: debug:
var: vnc.pass var: vncpass
+1 -1
View File
@@ -1 +1 @@
vnc.pass: "{{ lookup('password', '/dev/shm/.vncpass chars=ascii_letters,digits,hexdigits length=15') }}" vncpass: "{{ lookup('password', '/dev/shm/.vncpass chars=ascii_letters,digits,hexdigits length=15') }}"