Skip to content

Commit

Permalink
Migrate salt-master to Ubuntu 22.04('Jammy') (#331)
Browse files Browse the repository at this point in the history
* Migrate salt-master to jammy

This commit uncomments out code that will migrate our salt-master to run using Ubuntu 22.04 codename 'jammy'.

* Run salt-master as root user

In our previoius configuration, the salt master was running as root user. When migrating to salt latest 3006, the salt-master defaults to running as the salt user.
To bypass permissions errors around loading `consul.py` and `ca.py`, this commit runs the salt-master as the root user as done previously before attempting to upgrade salt.

* Expand condtional statement to include codename "jammy"

The `python-requests` and `python-msgpack` packages were not getting loaded for our salt-master because there was no condtion to match it's oscodename. This commit changes that.

* Upadte saltstack repository configuration for codename "jammy"

This commit applies a condition for codename jammy to use the appropriate salt repository, updating the repo URL, path name, and GPG key for Ubuntu 22.04.

* Adjust `consul` to run with jammy

Adjust `consul` configuration for compatibility with Ubuntu 22.04 ('Jammy')

* Remove comment

This comment is no longer necessary, as the salt-master now runs on Ubuntu 22.04 codename "Jammy".

* Update salt GPG keyring name

- this change reflects the GPG keyring name, and apt source file list in [Salt Install Guide]https://docs.saltproject.io/salt/install-guide/en/latest/topics/install-by-operating-system/ubuntu.html)

* Address apt-key deprecation for packagecloud

- this commit addresses the recommended approach for [apt-key deprecation in Ubunut 22.04](https://docs.saltproject.io/en/latest/ref/states/all/salt.states.pkgrepo.html)

* Address apt-key deprecation for salt

- this commit addresses the reccomended approach for  [apt-key deprecation in Ubunut 22.04](https://docs.saltproject.io/en/latest/ref/states/all/salt.states.pkgrepo.html)

* Address apt-key deprecation for datadoghq

- this commit addresses the reccomended approach for  [apt-key deprecation in Ubunut 22.04](https://docs.saltproject.io/en/latest/ref/states/all/salt.states.pkgrepo.html)

* Address apt-key deprecation for nginx

- this commit addresses the reccomended approach for  [apt-key deprecation in Ubunut 22.04](https://docs.saltproject.io/en/latest/ref/states/all/salt.states.pkgrepo.html)
  • Loading branch information
cegerhardson committed Jan 16, 2024
1 parent 6350a33 commit a89c21d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 12 deletions.
11 changes: 5 additions & 6 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SERVERS = [
"buildbot",
"cdn-logs",
"codespeed",
"consul",
{:name => "consul", :codename => "jammy"},
"docs",
"downloads",
"hg",
Expand Down Expand Up @@ -40,11 +40,10 @@ Vagrant.configure("2") do |config|
end

config.vm.define "salt-master" do |s_config|
# Uncomment below to migrate salt-master to jammy
# s_config.vm.provider "docker" do |docker, override|
# docker.build_dir = "dockerfiles"
# docker.dockerfile = "Dockerfile.jammy"
# end
s_config.vm.provider "docker" do |docker, override|
docker.build_dir = "dockerfiles"
docker.dockerfile = "Dockerfile.jammy"
end

s_config.vm.hostname = "salt-master.vagrant.psf.io"
s_config.vm.network "private_network", ip: MASTER1
Expand Down
2 changes: 2 additions & 0 deletions conf/vagrant/master.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ failhard: True

extension_modules: srv/salt/_extensions

user: root

pillar_roots:
base:
- /srv/pillar/dev
Expand Down
5 changes: 2 additions & 3 deletions dockerfiles/Dockerfile.jammy
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ EXPOSE 22
RUN /usr/sbin/sshd

# Setup Salt Common

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

# Start Systemd (systemctl)
Expand Down
3 changes: 2 additions & 1 deletion salt/base/repo.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

psf:
pkgrepo.managed:
- name: "deb https://packagecloud.io/psf/infra/ubuntu {{ grains['oscodename'] }} main"
- name: "deb [signed-by=/etc/apt/keyrings/packagecloud.gpg arch={{ grains["osarch"] }}] https://packagecloud.io/psf/infra/ubuntu {{ grains['oscodename'] }} main"
- file: /etc/apt/sources.list.d/psf.list
- key_url: salt://base/config/APT-GPG-KEY-PSF
- aptkey: False
# Make source list globally readable.
/etc/apt/sources.list.d/psf.list:
Expand Down
15 changes: 15 additions & 0 deletions salt/base/salt.sls
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ python-requests:
python-msgpack:
pkg.latest:
- name: python3-msgpack

{% elif grains["oscodename"] == "jammy" %}
python-requests:
pkg.latest:
- name: python3-requests

python-msgpack:
pkg.latest:
- name: python3-msgpack

{% else %}
python-requests:
pkg.latest
Expand All @@ -24,6 +34,11 @@ salt-2018.3:
{% 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
- 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
{% 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
3 changes: 2 additions & 1 deletion salt/datadog/init.sls
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
datadog_repo:
pkgrepo.managed:
- name: "deb https://apt.datadoghq.com stable 6"
- name: "deb [signed-by=/etc/apt/keyrings/datadoghq.gpg arch={{ grains["osarch"] }}] https://apt.datadoghq.com stable 6"
- file: /etc/apt/sources.list.d/datadog.list
- key_url: salt://datadog/config/APT-GPG-KEY-DATADOG
- aptkey: False
{% set in_datadog_tags = pillar.get('datadog_tags', []) + grains.get('datadog_tags', []) + grains.get('datadog_tags_from_metadata', []) %}
{% set datadog_tags = [] %}
Expand Down
3 changes: 2 additions & 1 deletion salt/nginx/init.sls
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
nginx:
pkgrepo.managed:
- name: deb http://nginx.org/packages/ubuntu {{ grains.oscodename }} nginx
- name: deb [signed-by=/etc/apt/keyrings/nginx.gpg arch={{ grains["osarch"] }}] http://nginx.org/packages/ubuntu {{ grains.oscodename }} nginx
- file: /etc/apt/sources.list.d/nginx.list
- key_url: salt://nginx/config/APT-GPG-KEY-NGINX
- aptkey: False
- order: 2
- require_in:
- pkg: nginx
Expand Down

0 comments on commit a89c21d

Please sign in to comment.