Skip to content

Commit 0d511ad

Browse files
authored
Merge pull request #50 from Oefenweb/pr-49
Add non-free-firmware
2 parents 0d82f16 + cc1aafa commit 0d511ad

11 files changed

Lines changed: 71 additions & 65 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ jobs:
4747
- distro: debian10
4848
- distro: debian11
4949
- distro: debian12
50-
- distro: ubuntu1604
51-
ansible-version: '>=2.10, <2.11'
52-
- distro: ubuntu1604
5350
- distro: ubuntu1804
5451
- distro: ubuntu2004
52+
- distro: ubuntu2204
5553

5654
steps:
5755
- name: Check out the codebase
@@ -65,8 +63,8 @@ jobs:
6563
python-version: '3.x'
6664

6765
- name: Install test dependencies
68-
run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker
69-
66+
run: |
67+
pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker
7068
- name: Run Molecule tests
7169
run: |
7270
molecule test

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,33 @@ Manage packages and up(date|grade)s in Debian-like systems.
1212

1313
#### Variables
1414

15-
* `apt_manage_sources_list`: [default: `false`]: Whether or not to manage `/etc/apt/sources.list`
15+
* `apt_manage_sources_list`: [default: `false`]: Whether to manage `/etc/apt/sources.list`
1616
* `apt_ubuntu_mirror`: [default: `mirror://mirrors.ubuntu.com/mirrors.txt`]: The mirror to use
17-
* `apt_ubuntu_security_mirror`: [default: `http://security.ubuntu.com/ubuntu`]: The security-mirror to use
18-
* `apt_src_enable`: [default: `true`]: Whether or not to enable source code repositories
19-
* `apt_backports_enable`: [default: `true`]: Whether or not to enable the `backports` repository
20-
* `apt_ubuntu_universe_enable`: [default: `true`]: Whether or not to enable the `universe` repository
21-
* `apt_ubuntu_multiverse_enable`: [default: `true`]: Whether or not to enable the `multiverse` repository
22-
* `apt_ubuntu_backports_enable`: [default: `true`]: Whether or not to enable the `backports` repository [deprecated in favour of `apt_backports_enable`]
23-
* `apt_ubuntu_partner_enable`: [default: `false`]: Whether or not to enable the `partner` repository
24-
* `apt_ubuntu_extras_enable`: [default: `false`]: Whether or not to enable the `extras` repository (only applies to < 16.04)
25-
* `apt_debian_mirror`: [default: `http://deb.debian.org/debian/`]: The mirror to use
26-
* `apt_debian_security_mirror`: [default: `http://security.debian.org/`]: The security-mirror to use
27-
* `apt_debian_contrib_nonfree_enable`: [default: `false`]: Whether or not to enable the `contrib` `non-free` repository
17+
* `apt_ubuntu_security_mirror`: [default: `https://security.ubuntu.com/ubuntu`]: The security-mirror to use
18+
* `apt_src_enable`: [default: `true`]: Whether to enable source code repositories
19+
* `apt_backports_enable`: [default: `true`]: Whether to enable the `backports` repository
20+
* `apt_ubuntu_universe_enable`: [default: `true`]: Whether to enable the `universe` repository
21+
* `apt_ubuntu_multiverse_enable`: [default: `true`]: Whether to enable the `multiverse` repository
22+
* `apt_ubuntu_backports_enable`: [default: `true`]: Whether to enable the `backports` repository [deprecated in favour of `apt_backports_enable`]
23+
* `apt_ubuntu_partner_enable`: [default: `false`]: Whether to enable the `partner` repository
24+
* `apt_ubuntu_extras_enable`: [default: `false`]: Whether to enable the `extras` repository (only applies to < 16.04)
25+
* `apt_debian_mirror`: [default: `https://deb.debian.org/debian/`]: The mirror to use
26+
* `apt_debian_security_mirror`: [default: `https://security.debian.org/`]: The security-mirror to use
27+
* `apt_debian_contrib_nonfree_enable`: [default: `false`]: Whether to enable the `contrib` `non-free` `non-free-firmware` repository
2828

2929
* `apt_dependencies`: [default: `[python3-apt, aptitude]`]: General dependencies for apt modules to work
30-
* `apt_update`: [default: `true`]: Whether or not to update
30+
* `apt_update`: [default: `true`]: Whether to update
3131
* `apt_update_cache_valid_time`: [default: `3600`]: Number of seconds the apt cache stays valid
32-
* `apt_upgrade`: [default: `true`]: Whether or not to upgrade
32+
* `apt_upgrade`: [default: `true`]: Whether to upgrade
3333
* `apt_upgrade_type`: [default: `dist`]: If yes or safe, performs an aptitude safe-upgrade. If full, performs an aptitude full-upgrade. If dist, performs an apt-get dist-upgrade
3434
* `apt_upgrade_dpkg_options`: [default: `['force-confdef', 'force-confold']`]: Add `dpkg` options to `apt` command
35-
* `apt_clean`: [default: `true`]: Whether or not to clean
36-
* `apt_dpkg_configure`: [default: `false`]: Whether or not to run `dpkg --configure -a`
37-
* `apt_autoremove`: [default: `true`]: Whether or not to autoremove
35+
* `apt_clean`: [default: `true`]: Whether to clean
36+
* `apt_dpkg_configure`: [default: `false`]: Whether to run `dpkg --configure -a`
37+
* `apt_autoremove`: [default: `true`]: Whether to autoremove
3838
* `apt_install`: [default: `[]`]: Packages to install
3939
* `apt_install_state`: [default: `latest`]: State of packages to install (e.g. `present`)
4040
* `apt_remove`: [default: `[]`]: Packages to remove
41-
* `apt_remove_purge`: [default: `false`]: Whether or not to purge
41+
* `apt_remove_purge`: [default: `false`]: Whether to purge
4242

4343
* `apt_etc_apt_apt_conf`: [default: `[]`]: List of lines to be added to `/etc/apt/apt.conf`
4444
* `apt_etc_apt_apt_conf_d_files_absent`: [default: `[]`]: List of files to be removed from `/etc/apt/apt.conf.d`

Vagrantfile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
role = File.basename(File.expand_path(File.dirname(__FILE__)))
55

66
boxes = [
7-
{
8-
:name => "ubuntu-1604",
9-
:box => "bento/ubuntu-16.04",
10-
:ip => '10.0.0.12',
11-
:cpu => "50",
12-
:ram => "256"
13-
},
147
{
158
:name => "ubuntu-1804",
169
:box => "bento/ubuntu-18.04",
@@ -23,7 +16,14 @@ boxes = [
2316
:box => "bento/ubuntu-20.04",
2417
:ip => '10.0.0.14',
2518
:cpu => "50",
26-
:ram => "384"
19+
:ram => "512"
20+
},
21+
{
22+
:name => "ubuntu-2204",
23+
:box => "bento/ubuntu-22.04",
24+
:ip => '10.0.0.15',
25+
:cpu => "50",
26+
:ram => "512"
2727
},
2828
{
2929
:name => "debian-10",
@@ -44,7 +44,7 @@ boxes = [
4444
:box => "bento/debian-12",
4545
:ip => '10.0.0.20',
4646
:cpu => "50",
47-
:ram => "256"
47+
:ram => "384"
4848
},
4949
]
5050

defaults/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ apt_ubuntu_backports_enable: true
1414
apt_ubuntu_partner_enable: false
1515
apt_ubuntu_extras_enable: false
1616
# Debian specific
17-
apt_debian_mirror: http://deb.debian.org/debian/
18-
apt_debian_security_mirror: "{{ (ansible_distribution == 'Debian' and ansible_distribution_major_version is version('10', '<=')) | ternary('http://security.debian.org/', 'http://security.debian.org/debian-security') }}"
17+
apt_debian_mirror: https://deb.debian.org/debian/
18+
apt_debian_security_mirror: "{{ (ansible_distribution == 'Debian' and ansible_distribution_major_version is version('10', '<=')) | ternary('https://security.debian.org/', 'https://security.debian.org/debian-security') }}"
1919
apt_debian_contrib_nonfree_enable: false
2020

2121
apt_dependencies:

meta/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ galaxy_info:
1010
platforms:
1111
- name: Ubuntu
1212
versions:
13-
- xenial
1413
- bionic
1514
- focal
15+
- jammy
1616
- name: Debian
1717
versions:
1818
- buster

molecule/default/collections.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
---
2-
collections:
3-
- name: community.docker
4-
version: '>=1.2.0,<2'
5-
- name: community.general
6-
version: '>=2,<3'
2+
collections: []

molecule/default/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ driver:
55
name: docker
66
platforms:
77
- name: instance
8-
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1604}-ansible:latest"
8+
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest"
99
command: ${MOLECULE_DOCKER_COMMAND:-""}
1010
volumes:
1111
- /sys/fs/cgroup:/sys/fs/cgroup:rw

tasks/main.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
# tasks file
22
---
3-
- name: update configuration file - /etc/apt/sources.list
4-
ansible.builtin.template:
5-
src: "etc/apt/sources.list.{{ ansible_distribution }}.j2"
6-
dest: /etc/apt/sources.list
7-
owner: root
8-
group: root
9-
mode: 0644
10-
register: apt_config_updated
3+
- name: manage sources.list
114
when: apt_manage_sources_list | bool
125
tags:
136
- configuration
147
- apt
158
- apt-configuration
9+
block:
10+
- name: install dependencies (pre)
11+
ansible.builtin.apt:
12+
name: "{{ apt_dependencies_pre }}"
13+
state: "{{ apt_install_state | default('latest') }}"
14+
update_cache: true
15+
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"
16+
17+
- name: update configuration file - /etc/apt/sources.list
18+
ansible.builtin.template:
19+
src: "etc/apt/sources.list.{{ ansible_distribution }}.j2"
20+
dest: /etc/apt/sources.list
21+
owner: root
22+
group: root
23+
mode: 0644
24+
register: _apt_config_updated
1625

1726
- name: update configuration file - /etc/apt/apt.conf
1827
ansible.builtin.template:
@@ -51,7 +60,7 @@
5160
- name: update
5261
ansible.builtin.apt:
5362
update_cache: true
54-
cache_valid_time: "{{ 0 if apt_config_updated is defined and apt_config_updated.changed else apt_update_cache_valid_time }}"
63+
cache_valid_time: "{{ 0 if _apt_config_updated is defined and _apt_config_updated.changed else apt_update_cache_valid_time }}"
5564
when: apt_update | bool
5665
tags:
5766
- configuration

templates/etc/apt/sources.list.Debian.j2

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ deb {{ apt_debian_mirror }} {{ ansible_distribution_release }}-updates main
1313
# Contrib packages contain DFSG-compliant software,
1414
# but have dependencies not in main (possibly packaged for Debian in non-free).
1515
# Non-free contains software that does not comply with the DFSG.
16-
{% if apt_debian_contrib_nonfree_enable %}
17-
deb {{ apt_debian_mirror }} {{ ansible_distribution_release }} contrib non-free
18-
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_debian_mirror }} {{ ansible_distribution_release }} contrib non-free
16+
{% if apt_debian_contrib_nonfree_enable | bool %}
17+
deb {{ apt_debian_mirror }} {{ ansible_distribution_release }} contrib non-free{{ ansible_distribution_major_version is version('12', '>=') | ternary(' non-free-firmware', '') }}
18+
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_debian_mirror }} {{ ansible_distribution_release }} contrib non-free{{ ansible_distribution_major_version is version('12', '>=') | ternary(' non-free-firmware', '') }}
1919
{% endif %}
2020

2121
# # N.B. software from this repository may not have been tested as
2222
# # extensively as that contained in the main release, although it includes
2323
# # newer versions of some applications which may provide useful features.
24-
{% if apt_backports_enable %}
25-
deb {{ apt_debian_mirror }} {{ ansible_distribution_release }}-backports main contrib non-free
26-
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_debian_mirror }} {{ ansible_distribution_release }}-backports main contrib non-free
24+
{% if apt_backports_enable | bool %}
25+
deb {{ apt_debian_mirror }} {{ ansible_distribution_release }}-backports main contrib non-free{{ ansible_distribution_major_version is version('12', '>=') | ternary(' non-free-firmware', '') }}
26+
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_debian_mirror }} {{ ansible_distribution_release }}-backports main contrib non-free{{ ansible_distribution_major_version is version('12', '>=') | ternary(' non-free-firmware', '') }}
2727
{% endif %}
28-

templates/etc/apt/sources.list.Ubuntu.j2

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ ansible_managed | comment }}
22

3-
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
3+
# See https://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
44
# newer versions of the distribution.
55
deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }} main restricted
66
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }} main restricted
@@ -13,7 +13,7 @@ deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }}-updates main rest
1313
# # N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
1414
# # team. Also, please note that software in universe WILL NOT receive any
1515
# # review or updates from the Ubuntu security team.
16-
{% if apt_ubuntu_universe_enable %}
16+
{% if apt_ubuntu_universe_enable | bool %}
1717
deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }} universe
1818
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }} universe
1919
deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }}-updates universe
@@ -25,7 +25,7 @@ deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }}-updates universe
2525
# # your rights to use the software. Also, please note that software in
2626
# # multiverse WILL NOT receive any review or updates from the Ubuntu
2727
# # security team.
28-
{% if apt_ubuntu_multiverse_enable %}
28+
{% if apt_ubuntu_multiverse_enable | bool %}
2929
deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }} multiverse
3030
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }} multiverse
3131
deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }}-updates multiverse
@@ -37,32 +37,32 @@ deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }}-updates multivers
3737
# # newer versions of some applications which may provide useful features.
3838
# # Also, please note that software in backports WILL NOT receive any review
3939
# # or updates from the Ubuntu security team.
40-
{% if apt_backports_enable or apt_ubuntu_backports_enable %}
40+
{% if apt_backports_enable or apt_ubuntu_backports_enable | bool %}
4141
deb {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }}-backports main restricted universe multiverse
4242
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_ubuntu_mirror }} {{ ansible_distribution_release }}-backports main restricted universe multiverse
4343
{% endif %}
4444

4545
deb {{ apt_ubuntu_security_mirror }} {{ ansible_distribution_release }}-security main restricted
4646
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_ubuntu_security_mirror }} {{ ansible_distribution_release }}-security main restricted
47-
{% if apt_ubuntu_universe_enable %}
47+
{% if apt_ubuntu_universe_enable | bool %}
4848
deb {{ apt_ubuntu_security_mirror }} {{ ansible_distribution_release }}-security universe
4949
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_ubuntu_security_mirror }} {{ ansible_distribution_release }}-security universe
5050
{% endif %}
51-
{% if apt_ubuntu_multiverse_enable %}
51+
{% if apt_ubuntu_multiverse_enable | bool %}
5252
deb {{ apt_ubuntu_security_mirror }} {{ ansible_distribution_release }}-security multiverse
5353
{{ '# ' if not apt_src_enable else '' }}deb-src {{ apt_ubuntu_security_mirror }} {{ ansible_distribution_release }}-security multiverse
5454
{% endif %}
5555

5656
# # This software is not part of Ubuntu, but is offered by Canonical and the
5757
# # respective vendors as a service to Ubuntu users.
58-
{% if apt_ubuntu_partner_enable %}
58+
{% if apt_ubuntu_partner_enable | bool %}
5959
deb http://archive.canonical.com/ubuntu {{ ansible_distribution_release }} partner
6060
{{ '# ' if not apt_src_enable else '' }}deb-src http://archive.canonical.com/ubuntu {{ ansible_distribution_release }} partner
6161
{% endif %}
6262

6363
# # This software is not part of Ubuntu, but is offered by third-party
6464
# # developers who want to ship their latest software.
65-
{% if apt_ubuntu_extras_enable and ansible_distribution_version is version('16.04', '<') %}
65+
{% if apt_ubuntu_extras_enable | bool and ansible_distribution_version is version('16.04', '<') %}
6666
deb http://extras.ubuntu.com/ubuntu {{ ansible_distribution_release }} main
6767
{{ '# ' if not apt_src_enable else '' }}deb-src http://extras.ubuntu.com/ubuntu {{ ansible_distribution_release }} main
6868
{% endif %}

0 commit comments

Comments
 (0)