Skip to content

Commit

Permalink
Improve linting
Browse files Browse the repository at this point in the history
  • Loading branch information
DO1JLR committed Apr 27, 2024
1 parent d80ba95 commit 3635fbf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ By default it will also add the [ETH Zürich Debian Packages Mirror](https://deb
| ``packages__ethz_security`` | ``true`` | Inofficial Debian Security Mirror |
| ``packages__ethz_updates`` | ``true`` | Updates Mirror |
| ``packages__ethz__backports`` | ``true`` | Backports Mirror |
| ``submodules_versioncheck`` | ``false`` | Enable simple versioncheck to prevent running old versions of this role |
| ``packages__submodules_versioncheck`` | ``false`` | Enable simple versioncheck to prevent running old versions of this role |

Contributing
-------------
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ packages__install_cli: false
packages__install_extra_packages: []

# Optional perform simple Versionscheck
submodules_versioncheck: false
packages__submodules_versioncheck: false
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- name: Run simple versionscheck (optional)
ansible.builtin.include_tasks:
file: 'versioncheck.yml'
when: submodules_versioncheck | bool
when: packages__submodules_versioncheck | bool

- name: Adding additional apt sources (optional)
ansible.builtin.include_tasks:
Expand Down
22 changes: 11 additions & 11 deletions tasks/versioncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@
path: '/etc/.ansible-version'
state: directory
mode: "0755"
when: submodules_versioncheck | bool
when: packages__submodules_versioncheck | bool

- name: Check playbook version
become: true
ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ playbook_version_path }}"
src: "/etc/.ansible-version/{{ packages__playbook_version_path }}"
register: playbook_version
when: submodules_versioncheck | bool
when: packages__submodules_versioncheck | bool
failed_when: false

- name: Print remote role version # noqa: H500
ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: submodules_versioncheck | bool
when: packages__submodules_versioncheck | bool

- name: Print locale role version # noqa: H500
ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number | string }}'."
when: submodules_versioncheck | bool
msg: "Local role version: '{{ packages__playbook_version_number | string }}'."
when: packages__submodules_versioncheck | bool

- name: Check if your version is outdated
ansible.builtin.fail:
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
msg: "Your ansible module has the version '{{ packages__playbook_version_number }}' and is outdated. You need to update it!"
when:
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck | bool
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= packages__playbook_version_number|int and packages__submodules_versioncheck | bool

- name: Write new version to remote disk
become: true
ansible.builtin.copy:
content: "{{ playbook_version_number }}"
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
content: "{{ packages__playbook_version_number }}"
dest: "/etc/.ansible-version/{{ packages__playbook_version_path }}"
mode: '0644'
when: submodules_versioncheck | bool
when: packages__submodules_versioncheck | bool
tags: skip_ansible_lint_template-instead-of-copy
12 changes: 6 additions & 6 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# must-have packages for all systems
package__base:
packages__base:
- rsync
- tmux
- sudo
Expand All @@ -16,7 +16,7 @@ package__base:
- lsof
- pwgen

package__advanced:
packages__advanced:
- tcpdump
- sysstat
- debian-goodies
Expand All @@ -31,12 +31,12 @@ package__advanced:
- python3-apt
- ethstatus

package__python:
packages__python:
- python3-pip
- python3-dev
- python3

package__cli:
packages__cli:
- links
- ranger
- htop
Expand All @@ -51,5 +51,5 @@ package__cli:
- jq
- zstd

playbook_version_number: 8
playbook_version_path: 'l3d.base.packages.version'
packages__playbook_version_number: 9
packages__playbook_version_path: 'l3d.base.packages.version'

0 comments on commit 3635fbf

Please sign in to comment.