Skip to content

Commit

Permalink
Fixed Ansible Lint warnings (#245)
Browse files Browse the repository at this point in the history
In preparation for Molecule upgrade.
  • Loading branch information
freemanjp authored Sep 3, 2023
1 parent 2ff57d6 commit e2357be
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 86 deletions.
3 changes: 2 additions & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ rules:
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
truthy:
allowed-values: ['true', 'false', 'on']
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
Expand All @@ -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
```
Expand All @@ -117,15 +117,15 @@ 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,
"files.associations": {
"Vagrantfile": "ruby"
}
}
visual_studio_code_keybindings_overwrite: yes
visual_studio_code_keybindings_overwrite: true
visual_studio_code_keybindings: [
{
"key": "ctrl+'",
Expand Down
14 changes: 7 additions & 7 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
14 changes: 7 additions & 7 deletions molecule/code-only/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@

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
- test_usr3

- 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
Expand Down
28 changes: 14 additions & 14 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,55 +18,55 @@

- 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
state: directory
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:
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions molecule/ubuntu-min-trusted-yes/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
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
when: ansible_pkg_mgr == 'apt'

roles:
- role: ansible-role-visual-studio-code
visual_studio_code_gpgcheck: no
visual_studio_code_gpgcheck: false

post_tasks:
- name: Install which
Expand Down
2 changes: 1 addition & 1 deletion molecule/ubuntu-min-trusted-yes/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
36 changes: 18 additions & 18 deletions molecule/ubuntu-min/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,75 +18,75 @@

- 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
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
state: directory
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:
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit e2357be

Please sign in to comment.