From bbc35067088f1e4cc3ce7889f83eae66a416e61d Mon Sep 17 00:00:00 2001 From: John Freeman Date: Sun, 3 Sep 2023 20:21:24 +0100 Subject: [PATCH] Fixed Ansible Lint warnings In preparation for Molecule upgrade. --- .yamllint | 3 +- README.md | 22 ++++++------ defaults/main.yml | 14 ++++---- molecule/code-only/converge.yml | 14 ++++---- molecule/default/converge.yml | 28 +++++++-------- molecule/ubuntu-min-trusted-yes/converge.yml | 10 +++--- molecule/ubuntu-min-trusted-yes/molecule.yml | 2 +- molecule/ubuntu-min/converge.yml | 36 ++++++++++---------- tasks/install-apt.yml | 12 +++---- tasks/install-dnf.yml | 6 ++-- tasks/install-extensions.yml | 4 +-- tasks/install-yum.yml | 6 ++-- tasks/install-zypper.yml | 8 ++--- tasks/write-settings.yml | 8 ++--- 14 files changed, 87 insertions(+), 86 deletions(-) diff --git a/.yamllint b/.yamllint index 8827676..115eb8a 100644 --- a/.yamllint +++ b/.yamllint @@ -30,4 +30,5 @@ rules: new-lines: type: unix trailing-spaces: disable - truthy: disable + truthy: + allowed-values: ['true', 'false', 'on'] diff --git a/README.md b/README.md index d8c1844..45cd266 100644 --- a/README.md +++ b/README.md @@ -60,21 +60,21 @@ visual_studio_code_build: stable visual_studio_code_mirror: 'https://packages.microsoft.com' # should the gpgcheck of the repo enabled? -# if yes +# if true # - for apt repo the option trusted=yes is NOT added # - for dnf/yum the option gpgcheck is set to yes # - for zypper the option gpgcheck is set to 1 -# yes is the default -# if no +# true is the default +# if false # - for apt repo the option trusted=yes is added to repo definition # - for dnf/yum the option gpgcheck is set to no # - for zypper the option gpgcheck is set to 0 -visual_studio_code_gpgcheck: yes +visual_studio_code_gpgcheck: true # skip task to add repo for remote package manager -# if set to yes, the task 'install VS Code repo (apt/yum/dnf/zypper)' will be skipped -# if set to no, the repo will be added, this is the default -visual_studio_code_skip_add_repo: no +# if set to true, the task 'install VS Code repo (apt/yum/dnf/zypper)' will be skipped +# if set to false, the repo will be added, this is the default +visual_studio_code_skip_add_repo: false # Users to install extensions for and/or write settings.json users: [] @@ -88,9 +88,9 @@ users: visual_studio_code_extensions: - # extension 1 - # extension 2 - visual_studio_code_settings_overwrite: # Overwrite the settings file if it exists. Options: boolean "yes" or "no" (defaults to "no"). + visual_studio_code_settings_overwrite: # Overwrite the settings file if it exists. Options: boolean "true" or "false" (defaults to "false"). visual_studio_code_settings: # JSON object - visual_studio_code_keybindings_overwrite: # Overwrite the keybindings file if it exists. Options: boolean "yes" or "no" (defaults to "no"). + visual_studio_code_keybindings_overwrite: # Overwrite the keybindings file if it exists. Options: boolean "true" or "false" (defaults to "false"). visual_studio_code_keybindings: # JSON array ``` @@ -117,7 +117,7 @@ Playbook with extensions installed that overwrites settings and keybindings: - streetsidesoftware.code-spell-checker - wholroyd.jinja - ms-python.python - visual_studio_code_settings_overwrite: yes + visual_studio_code_settings_overwrite: true visual_studio_code_settings: { "editor.rulers": [80, 100, 120], "editor.renderWhitespace": true, @@ -125,7 +125,7 @@ Playbook with extensions installed that overwrites settings and keybindings: "Vagrantfile": "ruby" } } - visual_studio_code_keybindings_overwrite: yes + visual_studio_code_keybindings_overwrite: true visual_studio_code_keybindings: [ { "key": "ctrl+'", diff --git a/defaults/main.yml b/defaults/main.yml index 9d8745c..4f80a55 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,21 +15,21 @@ visual_studio_code_download_dir: "{{ x_ansible_download_dir | default(ansible_en visual_studio_code_mirror: 'https://packages.microsoft.com' # should the gpgcheck of the repo enabled? -# if yes +# if true # - for apt repo the option trusted=yes is NOT added # - for dnf/yum the option gpgcheck is set to yes # - for zypper the option gpgcheck is set to 1 -# yes is the default -# if no +# true is the default +# if false # - for apt repo the option trusted=yes is added to repo definition # - for dnf/yum the option gpgcheck is set to no # - for zypper the option gpgcheck is set to 0 -visual_studio_code_gpgcheck: yes +visual_studio_code_gpgcheck: true # skip task to add repo for remote package manager -# if set to yes, the task 'install VS Code repo (apt/yum/dnf/zypper)' will be skipped -# if set to no, the repo will be added, this is the default -visual_studio_code_skip_add_repo: no +# if set to true, the task 'install VS Code repo (apt/yum/dnf/zypper)' will be skipped +# if set to false, the repo will be added, this is the default +visual_studio_code_skip_add_repo: false # Users to install extensions for and/or write settings.json users: [] diff --git a/molecule/code-only/converge.yml b/molecule/code-only/converge.yml index f3eab3d..f7e6b00 100644 --- a/molecule/code-only/converge.yml +++ b/molecule/code-only/converge.yml @@ -4,12 +4,12 @@ pre_tasks: - name: Create test users - become: yes + become: true ansible.builtin.user: name: '{{ item }}' state: present home: '/home/{{ item }}' - createhome: yes + createhome: true with_items: - test_usr - test_usr2 @@ -17,26 +17,26 @@ - name: Update apt cache ansible.builtin.apt: - update_cache: yes - changed_when: no + update_cache: true + changed_when: false when: ansible_pkg_mgr == 'apt' - name: Install gnupg2 (apt) - become: yes + become: true ansible.builtin.apt: name: gnupg2 state: present when: ansible_pkg_mgr == 'apt' - name: Install extension cli dependencies (zypper) - become: yes + become: true community.general.zypper: name: libX11-xcb1 state: present when: ansible_pkg_mgr == 'zypper' - name: Install extension cli dependencies (apt) - become: yes + become: true ansible.builtin.apt: name: libx11-xcb1 state: present diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index b373b69..dcc0470 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -4,12 +4,12 @@ pre_tasks: - name: Create test users - become: yes + become: true ansible.builtin.user: name: '{{ item }}' state: present home: '/home/{{ item }}' - createhome: yes + createhome: true with_items: - test_usr - test_usr2 @@ -18,33 +18,33 @@ - name: Update apt cache ansible.builtin.apt: - update_cache: yes - changed_when: no + update_cache: true + changed_when: false when: ansible_pkg_mgr == 'apt' - name: Install gnupg2 (apt) - become: yes + become: true ansible.builtin.apt: name: gnupg2 state: present when: ansible_pkg_mgr == 'apt' - name: Install extension cli dependencies (zypper) - become: yes + become: true community.general.zypper: name: libX11-xcb1 state: present when: ansible_pkg_mgr == 'zypper' - name: Install extension cli dependencies (apt) - become: yes + become: true ansible.builtin.apt: name: libx11-xcb1 state: present when: ansible_pkg_mgr == 'apt' - name: Create settings directory - become: yes + become: true become_user: test_usr4 ansible.builtin.file: path: /home/test_usr4/.config/Code/User @@ -52,21 +52,21 @@ mode: 'u=rwx,go=' - name: Install default settings - become: yes + become: true become_user: test_usr4 ansible.builtin.copy: content: '{"remove_me": true}' dest: /home/test_usr4/.config/Code/User/settings.json - force: no + force: false mode: 'u=rw,go=' - name: Install default key bindings - become: yes + become: true become_user: test_usr4 ansible.builtin.copy: content: '[{"key":"ctrl+r","command": "remove_me"}]' dest: /home/test_usr4/.config/Code/User/keybindings.json - force: no + force: false mode: 'u=rw,go=' roles: @@ -101,9 +101,9 @@ - username: test_usr3 - username: test_usr4 visual_studio_code_settings: {} - visual_studio_code_settings_overwrite: yes + visual_studio_code_settings_overwrite: true visual_studio_code_keybindings: [] - visual_studio_code_keybindings_overwrite: yes + visual_studio_code_keybindings_overwrite: true - role: ansible-role-visual-studio-code visual_studio_code_build: 'insiders' users: diff --git a/molecule/ubuntu-min-trusted-yes/converge.yml b/molecule/ubuntu-min-trusted-yes/converge.yml index 662e001..c7351cb 100644 --- a/molecule/ubuntu-min-trusted-yes/converge.yml +++ b/molecule/ubuntu-min-trusted-yes/converge.yml @@ -5,19 +5,19 @@ pre_tasks: - name: Update apt cache ansible.builtin.apt: - update_cache: yes - changed_when: no + update_cache: true + changed_when: false when: ansible_pkg_mgr == 'apt' - name: Install gnupg2 (apt) - become: yes + become: true ansible.builtin.apt: name: gnupg2 state: present when: ansible_pkg_mgr == 'apt' - name: Install extension cli dependencies (apt) - become: yes + become: true ansible.builtin.apt: name: libx11-xcb1 state: present @@ -25,7 +25,7 @@ roles: - role: ansible-role-visual-studio-code - visual_studio_code_gpgcheck: no + visual_studio_code_gpgcheck: false post_tasks: - name: Install which diff --git a/molecule/ubuntu-min-trusted-yes/molecule.yml b/molecule/ubuntu-min-trusted-yes/molecule.yml index 5214c2e..6db1a67 100644 --- a/molecule/ubuntu-min-trusted-yes/molecule.yml +++ b/molecule/ubuntu-min-trusted-yes/molecule.yml @@ -14,7 +14,7 @@ lint: | flake8 platforms: - - name: ansible-role-visual-studio-code-ubuntu-min-trusted-yes + - name: ansible-role-visual-studio-code-ubuntu-min-trusted-true image: ubuntu:18.04 provisioner: diff --git a/molecule/ubuntu-min/converge.yml b/molecule/ubuntu-min/converge.yml index 42a688d..8f5f8c3 100644 --- a/molecule/ubuntu-min/converge.yml +++ b/molecule/ubuntu-min/converge.yml @@ -4,12 +4,12 @@ pre_tasks: - name: Create test users - become: yes + become: true ansible.builtin.user: name: '{{ item }}' state: present home: '/home/{{ item }}' - createhome: yes + createhome: true with_items: - test_usr - test_usr2 @@ -18,40 +18,40 @@ - name: Update apt cache ansible.builtin.apt: - update_cache: yes - changed_when: no + update_cache: true + changed_when: false when: ansible_pkg_mgr == 'apt' - name: Install gnupg2 (apt) - become: yes + become: true ansible.builtin.apt: name: gnupg2 state: present when: ansible_pkg_mgr == 'apt' - name: Install extension cli dependencies (zypper) - become: yes + become: true community.general.zypper: name: libX11-xcb1 state: present when: ansible_pkg_mgr == 'zypper' - name: Install extension cli dependencies (apt) - become: yes + become: true ansible.builtin.apt: name: libx11-xcb1 state: present when: ansible_pkg_mgr == 'apt' - name: Install key (apt) - become: yes + become: true ansible.builtin.apt_key: url: '{{ visual_studio_code_mirror }}/keys/microsoft.asc' state: present when: ansible_pkg_mgr == 'apt' - name: Install VS Code repo (apt) - become: yes + become: true ansible.builtin.apt_repository: repo: 'deb [arch=amd64] {{ visual_studio_code_mirror }}/repos/code stable main' filename: vscode @@ -59,7 +59,7 @@ when: ansible_pkg_mgr == 'apt' - name: Create settings directory - become: yes + become: true become_user: test_usr4 ansible.builtin.file: path: /home/test_usr4/.config/Code/User @@ -67,26 +67,26 @@ mode: 'u=rwx,go=' - name: Install default settings - become: yes + become: true become_user: test_usr4 ansible.builtin.copy: content: '{"remove_me": true}' dest: /home/test_usr4/.config/Code/User/settings.json - force: no + force: false mode: 'u=rw,go=' - name: Install default key bindings - become: yes + become: true become_user: test_usr4 ansible.builtin.copy: content: '[{"key":"ctrl+r","command": "remove_me"}]' dest: /home/test_usr4/.config/Code/User/keybindings.json - force: no + force: false mode: 'u=rw,go=' roles: - role: ansible-role-visual-studio-code - visual_studio_code_skip_add_repo: yes + visual_studio_code_skip_add_repo: true users: - username: test_usr visual_studio_code_extensions: @@ -117,11 +117,11 @@ - username: test_usr3 - username: test_usr4 visual_studio_code_settings: {} - visual_studio_code_settings_overwrite: yes + visual_studio_code_settings_overwrite: true visual_studio_code_keybindings: [] - visual_studio_code_keybindings_overwrite: yes + visual_studio_code_keybindings_overwrite: true - role: ansible-role-visual-studio-code - visual_studio_code_skip_add_repo: yes + visual_studio_code_skip_add_repo: true visual_studio_code_build: 'insiders' users: - username: test_usr diff --git a/tasks/install-apt.yml b/tasks/install-apt.yml index 97e8bd9..fdb4571 100644 --- a/tasks/install-apt.yml +++ b/tasks/install-apt.yml @@ -1,6 +1,6 @@ --- - name: Install dependencies (apt) - become: yes + become: true ansible.builtin.apt: name: - ca-certificates @@ -8,22 +8,22 @@ state: present - name: Create APT keyrings dir - become: yes + become: true ansible.builtin.file: path: '/etc/apt/keyrings' state: directory mode: 'u=rwx,go=rx' - name: Install key (apt) - become: yes + become: true ansible.builtin.get_url: url: '{{ visual_studio_code_mirror }}/keys/microsoft.asc' dest: '/etc/apt/keyrings/' mode: 'u=rw,go=r' - force: yes + force: true - name: Install VS Code repo (apt) - become: yes + become: true ansible.builtin.apt_repository: repo: >- deb [arch={{ visual_studio_code_deb_architecture }} @@ -35,7 +35,7 @@ when: not visual_studio_code_skip_add_repo - name: Install VS Code (apt) - become: yes + become: true ansible.builtin.apt: name: "{{ visual_studio_code_package }}{{ (visual_studio_code_version | length > 0) | ternary('=' + visual_studio_code_version, '') }}" state: present diff --git a/tasks/install-dnf.yml b/tasks/install-dnf.yml index 943d7c4..e1ff3a4 100644 --- a/tasks/install-dnf.yml +++ b/tasks/install-dnf.yml @@ -1,6 +1,6 @@ --- - name: Install dependencies (dnf) - become: yes + become: true ansible.builtin.dnf: name: - libdrm @@ -11,7 +11,7 @@ state: present - name: Install VS Code repo (dnf) - become: yes + become: true ansible.builtin.yum_repository: name: code description: Visual Studio Code repo @@ -22,7 +22,7 @@ when: not visual_studio_code_skip_add_repo - name: Install VS Code (dnf) - become: yes + become: true ansible.builtin.dnf: name: "{{ visual_studio_code_package }}{{ (visual_studio_code_version | length > 0) | ternary('-' + visual_studio_code_version, '') }}" state: present diff --git a/tasks/install-extensions.yml b/tasks/install-extensions.yml index e2c923c..e579a0c 100644 --- a/tasks/install-extensions.yml +++ b/tasks/install-extensions.yml @@ -1,6 +1,6 @@ --- - name: Install extensions - become: yes + become: true become_user: '{{ item.0.username }}' visual_studio_code_install_extension: executable: '{{ visual_studio_code_exe }}' @@ -8,6 +8,6 @@ with_subelements: - '{{ users }}' - visual_studio_code_extensions - - skip_missing: yes + - skip_missing: true loop_control: label: '{{ item.0.username }}: {{ item.1 }}' diff --git a/tasks/install-yum.yml b/tasks/install-yum.yml index 40c160d..4157241 100644 --- a/tasks/install-yum.yml +++ b/tasks/install-yum.yml @@ -1,12 +1,12 @@ --- - name: Install dependencies (yum) - become: yes + become: true ansible.builtin.yum: name: which state: present - name: Install VS Code repo (yum) - become: yes + become: true ansible.builtin.yum_repository: name: code description: Visual Studio Code repo @@ -17,7 +17,7 @@ when: not visual_studio_code_skip_add_repo - name: Install VS Code (yum) - become: yes + become: true ansible.builtin.yum: name: "{{ visual_studio_code_package }}{{ (visual_studio_code_version | length > 0) | ternary('-' + visual_studio_code_version, '') }}" state: present diff --git a/tasks/install-zypper.yml b/tasks/install-zypper.yml index c46544e..a95a2bd 100644 --- a/tasks/install-zypper.yml +++ b/tasks/install-zypper.yml @@ -1,6 +1,6 @@ --- - name: Install dependencies (zypper) - become: yes + become: true community.general.zypper: name: - libdrm2 @@ -11,13 +11,13 @@ state: present - name: Install key (zypper) - become: yes + become: true ansible.builtin.rpm_key: state: present key: '{{ visual_studio_code_mirror }}/keys/microsoft.asc' - name: Write repo configuration (zypper) - become: yes + become: true ansible.builtin.template: src: vscode.repo.j2 dest: '/etc/zypp/repos.d/vscode.repo' @@ -27,7 +27,7 @@ when: not visual_studio_code_skip_add_repo - name: Install VS Code (zypper) - become: yes + become: true community.general.zypper: name: "{{ visual_studio_code_package }}{{ (visual_studio_code_version | length > 0) | ternary('=' + visual_studio_code_version, '') }}" state: present diff --git a/tasks/write-settings.yml b/tasks/write-settings.yml index d262977..f32ce20 100644 --- a/tasks/write-settings.yml +++ b/tasks/write-settings.yml @@ -1,6 +1,6 @@ --- - name: Create config directories for users - become: yes + become: true become_user: '{{ user.username }}' ansible.builtin.file: path: '~{{ user.username }}/{{ visual_studio_code_config_path }}' @@ -13,7 +13,7 @@ when: "user.visual_studio_code_settings is defined and user.visual_studio_code_settings not in ({}, '', None, omit)" - name: Create settings directory - become: yes + become: true become_user: '{{ user.username }}' ansible.builtin.file: path: '~{{ user.username }}/{{ visual_studio_code_config_path }}/User' @@ -26,7 +26,7 @@ when: "user.visual_studio_code_settings is defined and user.visual_studio_code_settings not in ({}, '', None, omit)" - name: Write settings - become: yes + become: true become_user: '{{ user.username }}' ansible.builtin.template: src: settings.json.j2 @@ -43,7 +43,7 @@ and user.visual_studio_code_settings not in ({}, '', None, omit)) - name: Write keybindings - become: yes + become: true become_user: '{{ user.username }}' ansible.builtin.template: src: keybindings.json.j2