Skip to content

Commit

Permalink
States run on ubunut 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Nov 8, 2024
1 parent 5c1c493 commit 45eb01d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
7 changes: 7 additions & 0 deletions custom/testing/golden-state-tree/config/sshd_config.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% set ssh_config = '/etc/ssh/sshd_config' %}

{%- if salt["file.file_exists"](ssh_config) %}

ClientAliveInterval:
file.line:
- name: {{ ssh_config }}
Expand Down Expand Up @@ -36,6 +38,7 @@ TCPKeepAlive:
- location: end
{%- endif %}

{%- endif %}

{%- if grains['os'] == 'VMware Photon OS' %}
{%- for algo in ("ssh-ed25519", "ecdsa-sha2-nistp256") %}
Expand All @@ -50,6 +53,8 @@ HostKeyAlgorithms-{{ algo }}:
{%- endfor %}
{%- endif %}

{%- if grains.get("systemd", None) %}

stop-sshd:
service.dead:
{%- if grains['os'] == 'Ubuntu' and grains['osmajorrelease'] >= 23 %}
Expand All @@ -75,3 +80,5 @@ start-sshd:
- reload: True
- require:
- stop-sshd

{%- endif %}
4 changes: 3 additions & 1 deletion custom/testing/golden-state-tree/os/debian/pkgs/timesync.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- if not grains['osmajorrelease'] in (9, 10, 18) %}
{%- if grains.get('systemd', None) %}
{%- if grains['osmajorrelease'] in (9, 10, 18) %}
install-systemd-timesyncd:
pkg.installed:
- name: systemd-timesyncd
Expand All @@ -21,3 +22,4 @@ remove-drift-file:
- name: /var/lib/chrony/
- require:
- stop-chrony
{%- endif %}
6 changes: 3 additions & 3 deletions custom/testing/golden-state-tree/os/ubuntu/pkgs/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include:
- pkgs.libsodium
- pkgs.libxml
- pkgs.libxslt
- pkgs.lxc
# - pkgs.lxc
- pkgs.make
- pkgs.man
- pkgs.nginx
Expand All @@ -41,6 +41,6 @@ include:
- pkgs.xz
- pkgs.tree
- pkgs.cargo {#-
- pkgs.awscli
- pkgs.amazon-cloudwatch-agent #}
# - pkgs.awscli
# - pkgs.amazon-cloudwatch-agent #}
- pkgs.samba
2 changes: 1 addition & 1 deletion custom/testing/golden-state-tree/pkgs/nginx.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nginx:
pkg.installed

{%- if grains["os_family"] == 'Debian' %}
{%- if grains["os_family"] == 'Debian' and grains.get("systemd", None) %}
{#- Debian based distributions always start services #}
disable-nginx-service:
service.disabled:
Expand Down
1 change: 1 addition & 0 deletions custom/testing/ubuntu-22.04-systemd.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ RUN apt update -y \
# RUN echo "root\nroot" | passwd -q root
RUN echo "systemd.debug_shell=tty1" >> /etc/sysctl.conf
COPY rescue.service /etc/systemd/system/rescue.service.d/override.conf
RUN echo "alias exit='init 0'" >> /root/.bashrc

CMD [ "/sbin/init", "1" ]
17 changes: 14 additions & 3 deletions custom/testing/ubuntu-22.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
FROM ubuntu:22.04
FROM ubuntu:22.04 as build

COPY 01_nodoc /etc/dpkg/dpkg.cfg.d/01_nodoc
COPY golden-pillar-tree golden-pillar-tree
COPY golden-state-tree golden-state-tree

RUN apt update -y \
&& echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
&& echo 'tzdata tzdata/Zones/America select Phoenix' | debconf-set-selections \
&& DEBIAN_FRONTEND="noninteractive" apt install -y \
python3 python3-venv python3-pip unzip sudo tree \
wget systemd
# python3 python3-venv python3-pip unzip sudo tree \
tar wget xz-utils vim-nox apt-utils \
&& wget https://packages.broadcom.com/artifactory/saltproject-generic/onedir/3007.1/salt-3007.1-onedir-linux-$(uname -m).tar.xz \
&& tar xvf salt-3007.1-onedir-linux-$(uname -m).tar.xz \
&& ./salt/salt-call --local --pillar-root=/golden-pillar-tree --file-root=/golden-state-tree state.apply provision \
&& rm -rf salt \
&& rm -rf salt-3007.1-onedir-linux-$(uname -m).tar.xz \
&& rm -rf golden-pillar-tree \
&& rm -rf golden-state-tree

0 comments on commit 45eb01d

Please sign in to comment.