From a37514256954bf2835876b02b9b33170548e15a8 Mon Sep 17 00:00:00 2001 From: jonas Date: Tue, 26 Oct 2021 15:34:18 +0200 Subject: [PATCH] . --- salt/pillars/tlu-harvester.sls | 4 +-- .../files/manifests/cloudinit.yaml | 30 +++++++++++++++++++ salt/states/tlu-harvester/manifests.sls | 2 ++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 salt/states/tlu-harvester/files/manifests/cloudinit.yaml diff --git a/salt/pillars/tlu-harvester.sls b/salt/pillars/tlu-harvester.sls index 82f757c..48385f2 100644 --- a/salt/pillars/tlu-harvester.sls +++ b/salt/pillars/tlu-harvester.sls @@ -14,8 +14,8 @@ tlu-harvester: images: opensuse: - name: openSUSE Leap 15.3 - url: https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2 - checksum: da11e3ed78cdadb0c8a15e9dd82c3c2b2746ba61cb98c3c03cfb156e5b8adb10 + url: https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-OpenStack-Cloud.qcow2 + checksum: 7207cce5b77d9d040610c39cd3d09437489797882b1b834acfb8b0f9d82be26c ns: default - name: openSUSE MicroOS url: https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-kvm-and-xen.qcow2 diff --git a/salt/states/tlu-harvester/files/manifests/cloudinit.yaml b/salt/states/tlu-harvester/files/manifests/cloudinit.yaml new file mode 100644 index 0000000..38de091 --- /dev/null +++ b/salt/states/tlu-harvester/files/manifests/cloudinit.yaml @@ -0,0 +1,30 @@ +{% set fqdn = "rmt." + pillar['network']['domain'] -%} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + harvesterhci.io/cloud-init-template: user + harvesterhci.io/creator: "" + name: rmt-client-register + namespace: default +data: + cloudInit: |- + runcmd: + - [ bash, "-c", "type SUSEConnect >/dev/null 2>&1 || { sudo zypper --non-interactive install SUSEConnect; }" ] + - [ curl, -O, "http://{{ fqdn }}/tools/rmt-client-setup" ] + - [ sudo, sh, rmt-client-setup, --host, {{ fqdn }}, --yes, --regcert, "http://{{ fqdn }}/rmt.crt", --fingerprint, "{{ fingerprint }}" ] +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + harvesterhci.io/cloud-init-template: user + harvesterhci.io/creator: "" + name: password-config-default-user + namespace: default +data: + cloudInit: |- + password: {{ pillar['tlu-harvester']['password'] }} + chpasswd: { expire: False } + ssh_pwauth: True diff --git a/salt/states/tlu-harvester/manifests.sls b/salt/states/tlu-harvester/manifests.sls index a9655e0..63e1d88 100644 --- a/salt/states/tlu-harvester/manifests.sls +++ b/salt/states/tlu-harvester/manifests.sls @@ -9,6 +9,8 @@ Add tlu-harvester manifests: - include_empty: True - makedirs: True - dir_modes: "0700" + - context: + fingerprint: {{ salt['cmd.shell']('/usr/bin/openssl x509 -in /etc/rmt/ssl/rmt-ca.crt -noout -fingerprint | /usr/bin/cut -d= -f2') }} {%- set images = salt['file.find']('/srv/www/htdocs/images/suse',type='f',mindepth=1,maxdepth=1,print='name') %} Adding image manifest for SUSE images: