From f4b5268ba692228b0fd35fb71a948cdb5d030235 Mon Sep 17 00:00:00 2001 From: Claude Ebaneck Date: Wed, 8 Apr 2020 19:56:32 +0200 Subject: [PATCH] salt: package & install httpd-tools on Bootstrap node We need `htpasswd` to generate password hashes for the Dex static user. The htpasswd is provided by httpd-tools on redhat based os Fixes: #2352 --- buildchain/buildchain/salt_tree.py | 4 ++++ buildchain/buildchain/versions.py | 1 + salt/metalk8s/roles/bootstrap/init.sls | 1 + salt/metalk8s/utils/httpd-tools/init.sls | 12 ++++++++++++ salt/metalk8s/utils/httpd-tools/installed.sls | 16 ++++++++++++++++ salt/metalk8s/utils/init.sls | 10 ++++++++++ 6 files changed, 44 insertions(+) create mode 100644 salt/metalk8s/utils/httpd-tools/init.sls create mode 100644 salt/metalk8s/utils/httpd-tools/installed.sls create mode 100644 salt/metalk8s/utils/init.sls diff --git a/buildchain/buildchain/salt_tree.py b/buildchain/buildchain/salt_tree.py index 7d15467990..a53946dcaa 100644 --- a/buildchain/buildchain/salt_tree.py +++ b/buildchain/buildchain/salt_tree.py @@ -549,6 +549,10 @@ def _get_parts(self) -> Iterator[str]: Path('salt/metalk8s/solutions/available.sls'), Path('salt/metalk8s/solutions/init.sls'), + Path('salt/metalk8s/utils/init.sls'), + Path('salt/metalk8s/utils/httpd-tools/init.sls'), + Path('salt/metalk8s/utils/httpd-tools/installed.sls'), + Path('salt/metalk8s/volumes/init.sls'), Path('salt/metalk8s/volumes/prepared/init.sls'), Path('salt/metalk8s/volumes/prepared/installed.sls'), diff --git a/buildchain/buildchain/versions.py b/buildchain/buildchain/versions.py index 488c2535aa..6cf2a5ca3a 100644 --- a/buildchain/buildchain/versions.py +++ b/buildchain/buildchain/versions.py @@ -331,6 +331,7 @@ def deb_full_name(self) -> str: release='1.el7' ), PackageVersion(name='container-selinux'), # TODO #1710 + PackageVersion(name='httpd-tools'), PackageVersion( name='metalk8s-sosreport', version=SHORT_VERSION, diff --git a/salt/metalk8s/roles/bootstrap/init.sls b/salt/metalk8s/roles/bootstrap/init.sls index 8973827821..8ec54d347a 100644 --- a/salt/metalk8s/roles/bootstrap/init.sls +++ b/salt/metalk8s/roles/bootstrap/init.sls @@ -5,3 +5,4 @@ include: - metalk8s.repo.installed - metalk8s.salt.master - metalk8s.kubectl + - metalk8s.utils diff --git a/salt/metalk8s/utils/httpd-tools/init.sls b/salt/metalk8s/utils/httpd-tools/init.sls new file mode 100644 index 0000000000..dfb72ecfab --- /dev/null +++ b/salt/metalk8s/utils/httpd-tools/init.sls @@ -0,0 +1,12 @@ +# +# +# Available states +# ================ +# +# * installed -> install the given utility +# +# +# + +include: + - .installed diff --git a/salt/metalk8s/utils/httpd-tools/installed.sls b/salt/metalk8s/utils/httpd-tools/installed.sls new file mode 100644 index 0000000000..c4686cb262 --- /dev/null +++ b/salt/metalk8s/utils/httpd-tools/installed.sls @@ -0,0 +1,16 @@ +{%- from "metalk8s/macro.sls" import pkg_installed with context %} + +include: + - metalk8s.repo + +{%- if grains['os_family'].lower() == 'redhat' %} +Install httpd-tools: + {{ pkg_installed('httpd-tools') }} + - require: + - test: Repositories configured +{% else %} + +Os family is debian-based: + test.succeed_without_changes: [] + +{%- endif %} diff --git a/salt/metalk8s/utils/init.sls b/salt/metalk8s/utils/init.sls new file mode 100644 index 0000000000..1f395a5a1a --- /dev/null +++ b/salt/metalk8s/utils/init.sls @@ -0,0 +1,10 @@ +# +# State to install utilities . +# +# Available states +# ================ +# +# + +include: + - .httpd-tools