Skip to content

Commit

Permalink
Change variable prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
DO1JLR committed Apr 27, 2024
1 parent 4c679af commit d80ba95
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
exclude_paths:
- .github/
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ By default it will also add the [ETH Zürich Debian Packages Mirror](https://deb

| variable | default value | useage |
| --- | --- | --- |
| ``package__install_advanced`` | ``false`` | Install some advanced packages like tcpdump, mtr, fio and ethertools. See ``vars/main.yml`` for details |
| ``package__install_python`` | ``false`` | Install some Python packages like python3-pip. See ``vars/main.yml`` for details |
| ``package__install_cli`` | ``false`` | Install some CLI packages like htop, ranger and asciinema. See ``vars/main.yml`` for details |
| ``package__install_extra_packages`` | | List of additional packages to install |
| ``package__package_state`` | ``present`` | Package State, set to ``latest`` to upgrade packages managed by this role |
| ``package__upgrade_all`` | ``false`` | Can upgrade all packages if ``package__package_state`` is to ``latest`` and the value is ``true`` |
| ``package__adding_ethz`` | ``true`` | Adding the swiss ETH package mirror |
| ``package__ethz_contrib`` | ``true`` | contrib packages contain DFSG-compliant software |
| ``package__ethz_non_free`` | ``true`` | non-free contains software that does not comply with the DFSG. |
| ``package__ethz_non_free_firmware`` | ``true`` | contains non-free-firmware packages |
| ``package__ethz_security`` | ``true`` | Inofficial Debian Security Mirror |
| ``package__ethz_updates`` | ``true`` | Updates Mirror |
| ``package__ethz__backports`` | ``true`` | Backports Mirror |
| ``packages__install_advanced`` | ``false`` | Install some advanced packages like tcpdump, mtr, fio and ethertools. See ``vars/main.yml`` for details |
| ``packages__install_python`` | ``false`` | Install some Python packages like python3-pip. See ``vars/main.yml`` for details |
| ``packages__install_cli`` | ``false`` | Install some CLI packages like htop, ranger and asciinema. See ``vars/main.yml`` for details |
| ``packages__install_extra_packages`` | | List of additional packages to install |
| ``packages__package_state`` | ``present`` | Package State, set to ``latest`` to upgrade packages managed by this role |
| ``packages__upgrade_all`` | ``false`` | Can upgrade all packages if ``packages__packages_state`` is to ``latest`` and the value is ``true`` |
| ``packages__adding_ethz`` | ``true`` | Adding the swiss ETH package mirror |
| ``packages__ethz_contrib`` | ``true`` | contrib packages contain DFSG-compliant software |
| ``packages__ethz_non_free`` | ``true`` | non-free contains software that does not comply with the DFSG. |
| ``packages__ethz_non_free_firmware`` | ``true`` | contains non-free-firmware packages |
| ``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 |

Contributing
Expand Down
26 changes: 13 additions & 13 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
---
# Adding additional Package Server hosted by ETH Zürich
l3d_pkgs__adding_ethz: true
l3d_pkgs__ethz_contrib: true
l3d_pkgs__ethz_non_free: true
l3d_pkgs__ethz_non_free_firmware: true
l3d_pkgs__ethz_security: true
l3d_pkgs__ethz_updates: true
l3d_pkgs__ethz__backports: true
packages__adding_ethz: true
packages__ethz_contrib: true
packages__ethz_non_free: true
packages__ethz_non_free_firmware: true
packages__ethz_security: true
packages__ethz_updates: true
packages__ethz__backports: true

# Methods for updating Packages
# set this to latest for updating packages managed by this role
l3d_pkgs__package_state: 'present'
l3d_pkgs__upgrade_all: false
packages__package_state: 'present'
packages__upgrade_all: false

# Select packages to install
l3d_pkgs__install_advanced: false
l3d_pkgs__install_python: false
l3d_pkgs__install_cli: false
l3d_pkgs__install_extra_packages: []
packages__install_advanced: false
packages__install_python: false
packages__install_cli: false
packages__install_extra_packages: []

# Optional perform simple Versionscheck
submodules_versioncheck: false
12 changes: 6 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
---
- name: Show Information about target OS (on verbose)
ansible.builtin.include_tasks:
file: os_info.yml
file: 'os_info.yml'

- name: Run simple versionscheck (optional)
ansible.builtin.include_tasks:
file: versioncheck.yml
file: 'versioncheck.yml'
when: submodules_versioncheck | bool

- name: Adding additional apt sources (optional)
ansible.builtin.include_tasks:
file: sources_ethz.yml
file: 'sources_ethz.yml'
when:
- l3d_pkgs__adding_ethz | bool
- packages__adding_ethz | bool
- ansible_architecture == 'x86_64'
- ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8
- ansible_pkg_mgr == "apt"

- name: Install packages based on selection
ansible.builtin.include_tasks:
file: packages.yml
file: 'packages.yml'

- name: Upgrade all packages to latest
become: true
ansible.builtin.package:
name: "*"
state: "{{ base__package_state }}"
when:
- l3d_pkgs__upgrade_all | bool
- packages__upgrade_all | bool
26 changes: 13 additions & 13 deletions tasks/os_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
- name: Print used variables # noqa: H500
ansible.builtin.debug:
msg: |
l3d_pkgs__adding_ethz: '{{ l3d_pkgs__adding_ethz }}'
l3d_pkgs__ethz_contrib: '{{ l3d_pkgs__ethz_contrib }}'
l3d_pkgs__ethz_non_free: '{{ l3d_pkgs__ethz_non_free }}'
l3d_pkgs__ethz_non_free_firmware: '{{ l3d_pkgs__ethz_non_free_firmware }}'
l3d_pkgs__ethz_security: '{{ l3d_pkgs__ethz_security }}'
l3d_pkgs__ethz_updates: '{{ l3d_pkgs__ethz_updates }}'
l3d_pkgs__ethz__backports: '{{ l3d_pkgs__ethz__backports }}'
l3d_pkgs__package_state: '{{ l3d_pkgs__package_state }}'
l3d_pkgs__upgrade_all: '{{ l3d_pkgs__upgrade_all }}'
l3d_pkgs__install_advanced: '{{ l3d_pkgs__install_advanced }}'
l3d_pkgs__install_python: '{{ l3d_pkgs__install_python }}'
l3d_pkgs__install_cli: '{{ l3d_pkgs__install_cli }}'
l3d_pkgs__install_extra_packages: '{{ l3d_pkgs__install_extra_packages }}'
packages__adding_ethz: '{{ packages__adding_ethz }}'
packages__ethz_contrib: '{{ packages__ethz_contrib }}'
packages__ethz_non_free: '{{ packages__ethz_non_free }}'
packages__ethz_non_free_firmware: '{{ packages__ethz_non_free_firmware }}'
packages__ethz_security: '{{ packages__ethz_security }}'
packages__ethz_updates: '{{ packages__ethz_updates }}'
packages__ethz__backports: '{{ packages__ethz__backports }}'
packages__package_state: '{{ packages__package_state }}'
packages__upgrade_all: '{{ packages__upgrade_all }}'
packages__install_advanced: '{{ packages__install_advanced }}'
packages__install_python: '{{ packages__install_python }}'
packages__install_cli: '{{ packages__install_cli }}'
packages__install_extra_packages: '{{ packages__install_extra_packages }}'
submodules_versioncheck: '{{ submodules_versioncheck }}'
verbosity: 1
26 changes: 13 additions & 13 deletions tasks/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,34 @@
block:
- name: Adding Advances Packages to installation list
ansible.builtin.set_fact:
l3d_pkgs__advanced: []
packages__advanced: []
when:
not l3d_pkgs__install_advanced | bool
not packages__install_advanced | bool

- name: Adding Python Packages to installation list
ansible.builtin.set_fact:
ll3d_pkgs__python: []
lpackages__python: []
when:
not l3d_pkgs__install_python | bool
not packages__install_python | bool

- name: Adding CLI Packages to installation list
ansible.builtin.set_fact:
l3d_pkgs__cli: []
packages__cli: []
when:
not l3d_pkgs__install_cli | bool
not packages__install_cli | bool

- name: Combine Lists
ansible.builtin.set_fact:
l3d_pkgs__install: "{{ l3d_pkgs__base + l3d_pkgs__advanced + l3d_pkgs__python + l3d_pkgs__cli + l3d_pkgs__install_extra_packages }}"
packages__install: "{{ packages__base + packages__advanced + packages__python + packages__cli + packages__install_extra_packages }}"

- name: Show l3d_pkgs__install on verbose run # noqa: H500
- name: Show packages__install on verbose run # noqa: H500
ansible.builtin.debug:
msg: "{{ l3d_pkgs__install }}"
msg: "{{ packages__install }}"
verbosity: 1
rescue:
- name: Show l3d_pkgs__install on verbose run # noqa: H500
- name: Show packages__install on verbose run # noqa: H500
ansible.builtin.debug:
msg: "{{ l3d_pkgs__install }}"
msg: "{{ packages__install }}"
verbosity: 1

- name: Error Info
Expand All @@ -56,5 +56,5 @@
become: true
ansible.builtin.package:
name: "{{ item }}"
state: "{{ l3d_pkgs__package_state }}"
loop: "{{ l3d_pkgs__install | flatten(1) }}"
state: "{{ packages__package_state }}"
loop: "{{ packages__install | flatten(1) }}"
24 changes: 12 additions & 12 deletions tasks/sources_ethz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@

- name: Set ETHZ debian packages to main
ansible.builtin.set_fact:
l3d_pkgs__debian_packages_version: 'main contrib'
packages__debian_packages_version: 'main contrib'
when:
- not l3d_pkgs__ethz_contrib | bool
- not l3d_pkgs__ethz_non_free | bool
- not packages__ethz_contrib | bool
- not packages__ethz_non_free | bool

- name: Set ETHZ debian packages to main contrib
ansible.builtin.set_fact:
l3d_pkgs__debian_packages_version: 'main contrib'
packages__debian_packages_version: 'main contrib'
when:
- l3d_pkgs__ethz_contrib | bool
- not l3d_pkgs__ethz_non_free | bool
- packages__ethz_contrib | bool
- not packages__ethz_non_free | bool

- name: Set ETHZ debian packages to main contrib non-free
ansible.builtin.set_fact:
l3d_pkgs__debian_packages_version: 'main contrib non-free'
packages__debian_packages_version: 'main contrib non-free'
when:
- l3d_pkgs__ethz_contrib | bool
- l3d_pkgs__ethz_non_free | bool
- packages__ethz_contrib | bool
- packages__ethz_non_free | bool
- not ansible_distribution_major_version >= '12'

- name: Set ETHZ debian packages to main contrib non-free non-free-firmware
ansible.builtin.set_fact:
l3d_pkgs__debian_packages_version: 'main contrib non-free non-free-firmware'
packages__debian_packages_version: 'main contrib non-free non-free-firmware'
when:
- l3d_pkgs__ethz_contrib | bool
- l3d_pkgs__ethz_non_free | bool
- packages__ethz_contrib | bool
- packages__ethz_non_free | bool
- ansible_distribution_major_version >= '12'

- name: Add ETH zurich apt for Debian
Expand Down
24 changes: 12 additions & 12 deletions templates/apt.sources.list.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
# https://wiki.debianforum.de/Sources.list

# HTTPS mirror:
deb https://debian.ethz.ch/debian {{ ansible_distribution_release }} {{ l3d_pkgs__debian_packages_version }}
deb-src https://debian.ethz.ch/debian {{ ansible_distribution_release }} {{ l3d_pkgs__debian_packages_version }}
deb https://debian.ethz.ch/debian {{ ansible_distribution_release }} {{ packages__debian_packages_version }}
deb-src https://debian.ethz.ch/debian {{ ansible_distribution_release }} {{ packages__debian_packages_version }}

{% if ansible_distribution_major_version >= '11' %}
deb https://security.debian.ethz.ch/ {{ ansible_distribution_release }}-security {{ l3d_pkgs__debian_packages_version }}
deb-src https://security.debian.ethz.ch/ {{ ansible_distribution_release }}-security {{ l3d_pkgs__debian_packages_version }}
deb https://security.debian.ethz.ch/ {{ ansible_distribution_release }}-security {{ packages__debian_packages_version }}
deb-src https://security.debian.ethz.ch/ {{ ansible_distribution_release }}-security {{ packages__debian_packages_version }}
{% else %}
deb https://security.debian.ethz.ch/ {{ ansible_distribution_release }}/updates {{ l3d_pkgs__debian_packages_version }}
deb-src https://security.debian.ethz.ch/ {{ ansible_distribution_release }}/updates {{ l3d_pkgs__debian_packages_version }}
deb https://security.debian.ethz.ch/ {{ ansible_distribution_release }}/updates {{ packages__debian_packages_version }}
deb-src https://security.debian.ethz.ch/ {{ ansible_distribution_release }}/updates {{ packages__debian_packages_version }}
{% endif %}

{% if l3d_pkgs__ethz_updates %}
{% if packages__ethz_updates %}
# {{ ansible_distribution_release }}-updates, previously known as 'volatile'
deb https://debian.ethz.ch/debian {{ ansible_distribution_release }}-updates {{ l3d_pkgs__debian_packages_version }}
deb-src https://debian.ethz.ch/debian {{ ansible_distribution_release }}-updates {{ l3d_pkgs__debian_packages_version }}
deb https://debian.ethz.ch/debian {{ ansible_distribution_release }}-updates {{ packages__debian_packages_version }}
deb-src https://debian.ethz.ch/debian {{ ansible_distribution_release }}-updates {{ packages__debian_packages_version }}
{% endif %}

{% if l3d_pkgs__ethz__backports %}
{% if packages__ethz__backports %}
# {{ ansible_distribution_release }}-backports
deb https://debian.ethz.ch/debian {{ ansible_distribution_release }}-backports {{ l3d_pkgs__debian_packages_version }}
deb-src https://debian.ethz.ch/debian {{ ansible_distribution_release }}-backports {{ l3d_pkgs__debian_packages_version }}
deb https://debian.ethz.ch/debian {{ ansible_distribution_release }}-backports {{ packages__debian_packages_version }}
deb-src https://debian.ethz.ch/debian {{ ansible_distribution_release }}-backports {{ packages__debian_packages_version }}
{% endif %}

# Contact for proplems with the mirror:
Expand Down

0 comments on commit d80ba95

Please sign in to comment.