Skip to content

Commit

Permalink
feat: base support for noble (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCoffee authored Jul 16, 2024
1 parent 6823e0a commit 727f4c6
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 6 deletions.
55 changes: 55 additions & 0 deletions dockerfiles/Dockerfile.noble
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Docker image to use with Vagrant
# Aims to be as similar to normal Vagrant usage as possible
# Adds SSH daemon, Systemd
# Adapted from https://github.com/BashtonLtd/docker-vagrant-images/blob/master/ubuntu1404/Dockerfile

FROM ubuntu:24.04
ENV container docker

RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update -y && apt-get dist-upgrade -y

# Install system dependencies, you may not need all of these
RUN apt-get install -y --no-install-recommends ssh sudo libffi-dev systemd openssh-client wget gnupg-utils gnupg apt-utils ca-certificates dbus locales cron dialog rsyslog iproute2 logrotate

RUN locale-gen en_US.UTF-8
COPY ./etc/locale.conf /etc/locale.conf
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

COPY ./etc/ssl/private/dhparams.pem /etc/ssl/private/dhparams.pem

# Install Vim
RUN apt-get install -y vim

# Needed to run systemd
# VOLUME [ "/sys/fs/cgroup" ]
# Doesn't appear to be necessary? See comments

# Add vagrant user and key for SSH
RUN useradd --create-home -s /bin/bash vagrant
RUN echo -n 'vagrant:vagrant' | chpasswd
RUN echo 'vagrant ALL = NOPASSWD: ALL' > /etc/sudoers.d/vagrant
RUN chmod 440 /etc/sudoers.d/vagrant
RUN mkdir -p /home/vagrant/.ssh
RUN chmod 700 /home/vagrant/.ssh
RUN echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==" > /home/vagrant/.ssh/authorized_keys
RUN chmod 600 /home/vagrant/.ssh/authorized_keys
RUN chown -R vagrant:vagrant /home/vagrant/.ssh
RUN sed -i -e 's/Defaults.*requiretty/#&/' /etc/sudoers
RUN sed -i -e 's/\(UsePAM \)yes/\1 no/' /etc/ssh/sshd_config

# Start SSH
RUN mkdir /var/run/sshd
EXPOSE 22
RUN /usr/sbin/sshd

# Setup Salt Common
RUN wget --quiet -O /etc/apt/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/salt/py3/ubuntu/24.04/$(dpkg --print-architecture)/SALT-PROJECT-GPG-PUBKEY-2023.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch=$(dpkg --print-architecture)] https://repo.saltproject.io/salt/py3/ubuntu/24.04/$(dpkg --print-architecture)/3007 noble main" > /etc/apt/sources.list.d/saltstack.list
RUN apt-get update -y && apt-get install -y --no-install-recommends salt-minion

# Start Systemd (systemctl)
CMD ["/lib/systemd/systemd"]
3 changes: 3 additions & 0 deletions salt/base/config/sources.list.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
{% set base_repo = "us.archive.ubuntu.com/ubuntu/" %}
{% endif %}

{# 24.04 Noble is the first to use /etc/apt/sources.list.d/ubuntu.list instead of 'sources.list' #}
{% if grains["oscodename"] != "noble" %}
###### Ubuntu Main Repos
deb http://{{ base_repo }} {{ grains["oscodename"] }} main restricted universe
deb-src http://{{ base_repo }} {{ grains["oscodename"] }} main restricted universe
Expand All @@ -13,3 +15,4 @@ deb http://{{ base_repo }} {{ grains["oscodename"] }}-security main restricted u
deb http://{{ base_repo }} {{ grains["oscodename"] }}-updates main restricted universe
deb-src http://{{ base_repo }} {{ grains["oscodename"] }}-security main restricted universe
deb-src http://{{ base_repo }} {{ grains["oscodename"] }}-updates main restricted universe
{% endif %}
2 changes: 1 addition & 1 deletion salt/base/repo.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if grains["oscodename"] == "jammy" %}
{% if grains["oscodename"] in ["jammy", "noble"] %}
psfkey:
file.managed:
- name: /etc/apt/keyrings/packagecloud.asc
Expand Down
11 changes: 8 additions & 3 deletions salt/base/salt.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ python-msgpack:
pkg.latest:
- name: python3-msgpack

{% elif grains["oscodename"] == "jammy" %}
{% elif grains["oscodename"] in ["jammy", "noble"] %}
python-requests:
pkg.latest:
- name: python3-requests
Expand All @@ -28,17 +28,22 @@ python3-pip:
pkg.latest

{% if grains["os"] == "Ubuntu" %}
salt-2018.3:
salt-repo:
pkgrepo.managed:
- humanname: repo.saltstack.org
{% if grains["oscodename"] == "focal" %}
- name: deb https://archive.repo.saltproject.io/py3/ubuntu/20.04/{{ grains["osarch"] }}/archive/3004 focal main
- key_url: https://archive.repo.saltproject.io/py3/ubuntu/20.04/{{ grains["osarch"] }}/archive/3004/salt-archive-keyring.gpg
{% elif grains["oscodename"] == "jammy" %}
- name: deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch={{ grains["osarch"] }}] https://repo.saltproject.io/salt/py3/ubuntu/22.04/{{ grains["osarch"] }}/latest jammy main
- name: deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch={{ grains["osarch"] }}] https://repo.saltproject.io/salt/py3/ubuntu/22.04/{{ grains["osarch"] }}/3007 jammy main
- file: /etc/apt/sources.list.d/salt.list
- key_url: https://repo.saltproject.io/salt/py3/ubuntu/22.04/{{ grains["osarch"] }}/SALT-PROJECT-GPG-PUBKEY-2023.gpg
- aptkey: False
{% elif grains["oscodename"] == "noble" %}
- name: deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch={{ grains["osarch"] }}] https://repo.saltproject.io/salt/py3/ubuntu/24.04/{{ grains["osarch"] }}/3007 noble main
- file: /etc/apt/sources.list.d/salt.list
- key_url: https://repo.saltproject.io/salt/py3/ubuntu/24.04/{{ grains["osarch"] }}/SALT-PROJECT-GPG-PUBKEY-2023.gpg
- aptkey: False
{% else %}
- name: deb http://archive.repo.saltstack.com/py3/ubuntu/{{ grains["osrelease"] }}/{{ grains["osarch"] }}/2018.3 {{ grains["oscodename"] }} main
- key_url: https://archive.repo.saltstack.com/py3/ubuntu/18.04/amd64/2018.3/SALTSTACK-GPG-KEY.pub
Expand Down
2 changes: 1 addition & 1 deletion salt/nginx/init.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if grains["oscodename"] == "jammy" %}
{% if grains["oscodename"] in ["jammy", "noble"] %}
nginxkey:
file.managed:
- name: /etc/apt/keyrings/nginx.asc
Expand Down
2 changes: 1 addition & 1 deletion salt/postgresql/base/init.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if grains["oscodename"] == "jammy" %}
{% if grains["oscodename"] in ["jammy", "noble"] %}
postgresql-key:
file.managed:
- name: /etc/apt/keyrings/postgresql.asc
Expand Down

0 comments on commit 727f4c6

Please sign in to comment.