diff --git a/salt/pillars/network.sls b/salt/pillars/network.sls index 45f1b65..0f1994b 100644 --- a/salt/pillars/network.sls +++ b/salt/pillars/network.sls @@ -7,7 +7,7 @@ network: interface: internal: eth0 - external: eth0.1000 + external: eth1 vlan: - diff --git a/salt/pillars/remote-desktop.sls b/salt/pillars/remote-desktop.sls new file mode 100644 index 0000000..efea92a --- /dev/null +++ b/salt/pillars/remote-desktop.sls @@ -0,0 +1,2 @@ +remote-desktop: + password: linux0 diff --git a/salt/pillars/top.sls b/salt/pillars/top.sls index 1dc794b..98b94e5 100644 --- a/salt/pillars/top.sls +++ b/salt/pillars/top.sls @@ -5,6 +5,7 @@ base: - mysql - rmt - docker + - remote-desktop {% if salt['pillar.file_exists']('local.sls') %} - local {% endif %} diff --git a/salt/states/remote-desktop/files/x0vncserver.desktop.template b/salt/states/remote-desktop/files/x0vncserver.desktop.template new file mode 100644 index 0000000..2a4bc4d --- /dev/null +++ b/salt/states/remote-desktop/files/x0vncserver.desktop.template @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Exec=x0vncserver -passwordfile /home/{{ pillar['user'] }}/.vnc/passwd +Hidden=false +X-GNOME-Autostart-enabled=true +Name=x0vncserver +Comment=x0vncserver diff --git a/salt/states/remote-desktop/init.sls b/salt/states/remote-desktop/init.sls new file mode 100644 index 0000000..2e9ed4a --- /dev/null +++ b/salt/states/remote-desktop/init.sls @@ -0,0 +1,24 @@ +Install xorg-x11-Xvnc: + pkg.installed: + - name: xorg-x11-Xvnc + +Set vnc password if no passwd file: + cmd.run: + - name: bash -c "echo {{ pillar['remote-desktop']['password'] }} | vncpasswd -f > /home/{{ pillar['username'] }}/.vnc/passwd" + - runas: {{ pillar['username'] }} + - unless: bash -c "[[ -f /home/{{ pillar['username'] }}/.vnc/passwd ]]" + +Check that passwd file has correct settings: + file.managed: + - name: /home/{{ pillar['username'] }}/.vnc/passwd + - user: {{ pillar['username'] }} + - group: users + - mode: "0600" + +Create x0vncserver desktop file: + file.managed: + - name: /home/{{ pillar['username'] }}/.config/autostart/x0vncserver.desktop + - source: salt://remote-desktop/files/x0vncserver.desktop.template + - user: {{ pillar['username'] }} + - group: users + - mode: "0600" diff --git a/salt/states/top.sls b/salt/states/top.sls index 0311bdb..fe0e3c8 100644 --- a/salt/states/top.sls +++ b/salt/states/top.sls @@ -10,3 +10,4 @@ base: - rmt - podman - docker.registry + - remote-desktop