Skip to content

Commit

Permalink
Lint again, ansible-lint 6.17.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sdarwin committed Jul 6, 2023
1 parent 97493ba commit 5c26c29
Show file tree
Hide file tree
Showing 23 changed files with 101 additions and 104 deletions.
5 changes: 2 additions & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

# Installer:
# #!/bin/bash
# apt-get update
Expand Down Expand Up @@ -93,7 +92,7 @@ platforms:
provisioner:
attributes:
extra_vars:
vnc_testvar: "testz"
vnc_testvar: testz
# - name: tightvnc-gnome
# attributes:
# extra_vars:
Expand Down Expand Up @@ -125,7 +124,7 @@ suites:
vnc_desktop: mate
vnc_server: tigervnc
default_vnc_users:
- username: 'ec2-user'
- username: ec2-user
# usergroup: 'admin'
# port 5901 is 1
vnc_num: 1
Expand Down
6 changes: 3 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ vnc_desktop: gnome
# vnc_server: tigervnc

# Used with older vnc servers.
vnc_server_options: "-geometry 1920x1200 -localhost"
vnc_server_options: -geometry 1920x1200 -localhost

# Used by this role on newer tiger vnc servers.
vnc_config_options:
- "geometry=1920x1200"
- "localhost"
- geometry=1920x1200
- localhost

### Should the role generate and enable per-user systemd services for VNC desktops?
### This variable refers to a previous implementation of per-user systemd, before the newer TigerVNC update, where standard systemd is used.
Expand Down
3 changes: 2 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
msg:
- "***********************"
- " "
- "You should reboot this server {{ inventory_hostname }}, as a one-time action, if it hasn't ever been rebooted."
- You should reboot this server {{ inventory_hostname }}, as a one-time action, if it hasn't ever been rebooted.
- " "
- "***********************"
when:
- vnc_reboot_once is not defined or not vnc_reboot_once

- name: Reboot once
ansible.builtin.shell: reboot # noqa command-instead-of-shell
changed_when: true
args:
chdir: /
when:
Expand Down
25 changes: 12 additions & 13 deletions tasks/autostart-perusersystemd.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Checking existence of per-user basic scripts to start vnc
ansible.builtin.stat:
path: "/home/{{ item.username }}/vncstart.sh"
path: /home/{{ item.username }}/vncstart.sh
register: checkvncstart
with_items: "{{ vnc_users }}"

- name: Update per-user basic scripts to start vnc
ansible.builtin.template:
src: "{{ vncstarttemplate }}"
dest: "/home/{{ item.item.username }}/vncstart.sh"
mode: 0755
dest: /home/{{ item.item.username }}/vncstart.sh
mode: "0755"
owner: "{{ item.item.username }}"
group: "{{ item.item.usergroup | default(item.item.username) }}"
when:
Expand All @@ -18,27 +18,26 @@

- name: Checking existence of per-user basic scripts to stop vnc
ansible.builtin.stat:
path: "/home/{{ item.username }}/vncstop.sh"
path: /home/{{ item.username }}/vncstop.sh
register: checkvncstop
with_items: "{{ vnc_users }}"

- name: Update per-user basic scripts to stop vnc
ansible.builtin.template:
src: "{{ vncstoptemplate }}"
dest: "/home/{{ item.item.username }}/vncstop.sh"
mode: 0755
dest: /home/{{ item.item.username }}/vncstop.sh
mode: "0755"
owner: "{{ item.item.username }}"
group: "{{ item.item.usergroup | default(item.item.username) }}"
when:
- vnc_ansible_managed_startup_scripts or not item.stat.exists
with_items: "{{ checkvncstop.results }}"


- name: Create ansible folder, if not already there. For next steps.
ansible.builtin.file:
path: /etc/ansible
state: directory
mode: 0755
mode: "0755"
owner: root
group: root

Expand All @@ -57,24 +56,24 @@

- name: Create systemd directories
ansible.builtin.file:
path: "/home/{{ item.username }}/.config/systemd/user"
path: /home/{{ item.username }}/.config/systemd/user
state: directory
mode: 0755
mode: "0755"
owner: "{{ item.username }}"
group: "{{ item.usergroup | default(item.username) }}"
with_items: "{{ vnc_users }}"

- name: Checking existence of per-user systemd service files
ansible.builtin.stat:
path: "/home/{{ item.username }}/.config/systemd/user/vncserver.service"
path: /home/{{ item.username }}/.config/systemd/user/vncserver.service
register: checksystemd
with_items: "{{ vnc_users }}"

- name: Update per-user systemd service files
ansible.builtin.template:
src: vncserver.j2
dest: "/home/{{ item.item.username }}/.config/systemd/user/vncserver.service"
mode: 0644
dest: /home/{{ item.item.username }}/.config/systemd/user/vncserver.service
mode: "0644"
owner: "{{ item.item.username }}"
group: "{{ item.item.usergroup | default(item.item.username) }}"
when:
Expand Down
18 changes: 9 additions & 9 deletions tasks/autostart-standard.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Checking existence of per-user basic scripts to start vnc
ansible.builtin.stat:
path: "/home/{{ item.username }}/vncstart.sh"
path: /home/{{ item.username }}/vncstart.sh
register: checkvncstart
with_items: "{{ vnc_users }}"

- name: Update per-user basic scripts to start vnc
ansible.builtin.template:
src: "{{ vncstarttemplate }}"
dest: "/home/{{ item.item.username }}/vncstart.sh"
mode: 0755
dest: /home/{{ item.item.username }}/vncstart.sh
mode: "0755"
owner: "{{ item.item.username }}"
group: "{{ item.item.usergroup | default(item.item.username) }}"
when:
Expand All @@ -18,15 +18,15 @@

- name: Checking existence of per-user basic scripts to stop vnc
ansible.builtin.stat:
path: "/home/{{ item.username }}/vncstop.sh"
path: /home/{{ item.username }}/vncstop.sh
register: checkvncstop
with_items: "{{ vnc_users }}"

- name: Update per-user basic scripts to stop vnc
ansible.builtin.template:
src: "{{ vncstoptemplate }}"
dest: "/home/{{ item.item.username }}/vncstop.sh"
mode: 0755
dest: /home/{{ item.item.username }}/vncstop.sh
mode: "0755"
owner: "{{ item.item.username }}"
group: "{{ item.item.usergroup | default(item.item.username) }}"
when:
Expand All @@ -36,16 +36,16 @@
# Nautilus error. Unable to create a required folder.
- name: Create .config directories.
ansible.builtin.file:
path: "/home/{{ item.username }}/.config"
path: /home/{{ item.username }}/.config
state: directory
mode: 0700
mode: "0700"
owner: "{{ item.username }}"
group: "{{ item.usergroup | default(item.username) }}"
with_items: "{{ vnc_users }}"

- name: Add vncstart.sh to .bashrc for each user
ansible.builtin.lineinfile:
path: "/home/{{ item.username }}/.bashrc"
path: /home/{{ item.username }}/.bashrc
line: /home/{{ item.username }}/vncstart.sh 2> /dev/null
when:
- vnc_bashrc_startup
Expand Down
Loading

0 comments on commit 5c26c29

Please sign in to comment.