Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip break_system_packages method and Ubuntu 24.04 support #83

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions molecule/default/Containerfile_ubuntu.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ubuntu:24.04

RUN apt-get update && apt-get install -y \
init \
python3 \
&& apt-get clean all
17 changes: 17 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ platforms:
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro

- name: molecule-ubuntu
image: ubuntu:24.04
dockerfile: Containerfile_ubuntu.j2
pre_build_image: false
systemd: true
privileged: true
command: "/usr/lib/systemd/systemd"
tmpfs:
"/run": "rw,mode=1777"
"/tmp": "rw,mode=1777"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro

provisioner:
name: ansible
inventory:
Expand All @@ -42,3 +55,7 @@ provisioner:
ansible_connection: containers.podman.podman
podman_user: receptor
podman_group: receptor
molecule-ubuntu:
ansible_connection: containers.podman.podman
podman_user: receptor
podman_group: receptor
2 changes: 2 additions & 0 deletions roles/setup/tasks/python_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
when: python_version.stdout is version(minimum_python_version, '<')

- name: Install additional python packages
environment:
PIP_BREAK_SYSTEM_PACKAGES: 1 # Allow pip to modify externally-managed Python installation
ansible.builtin.pip:
name: "{{ additional_python_packages | default([]) }}"
executable: "{{ pip_executable }}"
Expand Down
35 changes: 35 additions & 0 deletions roles/setup/tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
---
- name: Install receptor packages
ansible.builtin.package:
name: "{{ receptor_packages }}"
state: present
when:
- receptor_install_method == 'package'
- receptor_packages
notify:
- Restart Receptor

# Installing receptor via a package manager already lays down
# a systemd service file. Instead of replacing it with a new
# systemd_receptor.service file, we can just use an overrides
# file to tweak it.
- name: Setup systemd overrides
when: receptor_install_method == 'package'
block:
- name: Ensure systemd override directory exists
ansible.builtin.file:
dest: "{{ systemd_folder }}/receptor.service.d"
state: directory
owner: root
group: root
mode: '0755'

- name: Override receptor's systemd service runuser
ansible.builtin.template:
src: templates/systemd_receptor_override.conf.j2
dest: "{{ systemd_folder }}/receptor.service.d/override.conf"
mode: '0644'
owner: root
group: root
notify:
- Restart Receptor

- name: Install dependencies specific to the node type
ansible.builtin.apt:
name: "{{ additional_system_packages | default([]) }}"
Expand Down
1 change: 1 addition & 0 deletions roles/setup/tasks/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
file: "{{ item }}"
with_first_found:
- files:
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_os_family }}.yml'
paths:
Expand Down
5 changes: 5 additions & 0 deletions roles/setup/vars/Ubuntu-24.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
receptor_packages:
- receptor
- python3-receptorctl
systemd_folder: "/usr/lib/systemd/system"