Compare commits
29 Commits
8c1016a231
...
Appliance.
Author | SHA1 | Date | |
---|---|---|---|
5740faeb9d | |||
e057f313ea | |||
ac38731dcf | |||
9cbb84a0f3 | |||
066ec9a967 | |||
dda14af238 | |||
2db1c4d623 | |||
1451e8f105 | |||
baf809159b | |||
066a21b1d2 | |||
46fe962e77 | |||
74070f266c | |||
20f28f7d8a | |||
2802b49d02 | |||
594e62cf71 | |||
544f98a8fb | |||
562e0b8167 | |||
88e37bb706 | |||
8323668aeb | |||
afe29e3407 | |||
2473aa05dc | |||
7870ef8cf0 | |||
e42479f214 | |||
d459c98045 | |||
bf7ccc8962 | |||
75309bdf11 | |||
1469ba08d8 | |||
8764634ea0 | |||
1b4c4b5d64 |
226
.drone.yml
226
.drone.yml
@ -1,226 +0,0 @@
|
|||||||
kind: pipeline
|
|
||||||
type: kubernetes
|
|
||||||
name: 'Packer Build'
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: output
|
|
||||||
claim:
|
|
||||||
name: flexvolsmb-drone-output
|
|
||||||
- name: scratch
|
|
||||||
claim:
|
|
||||||
name: flexvolsmb-drone-scratch
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Debugging information
|
|
||||||
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- ansible --version
|
|
||||||
- ovftool --version
|
|
||||||
- packer --version
|
|
||||||
- yamllint --version
|
|
||||||
|
|
||||||
- name: Linting
|
|
||||||
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- |
|
|
||||||
yamllint -d "{extends: relaxed, rules: {line-length: disable}}" \
|
|
||||||
ansible \
|
|
||||||
packer/preseed/UbuntuServer22.04/user-data \
|
|
||||||
scripts
|
|
||||||
|
|
||||||
- name: Semantic Release (Dry-run)
|
|
||||||
image: bv11-cr01.bessems.eu/proxy/library/node:20-slim
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- |
|
|
||||||
apt-get update
|
|
||||||
- |
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
curl \
|
|
||||||
git-core \
|
|
||||||
jq \
|
|
||||||
ca-certificates
|
|
||||||
- |
|
|
||||||
curl -L https://api.github.com/repos/mikefarah/yq/releases/latest | \
|
|
||||||
jq -r '.assets[] | select(.name | endswith("yq_linux_amd64")) | .browser_download_url' | \
|
|
||||||
xargs -I {} curl -L -o /bin/yq {} && \
|
|
||||||
chmod +x /bin/yq
|
|
||||||
- |
|
|
||||||
npm install \
|
|
||||||
semantic-release \
|
|
||||||
@semantic-release/commit-analyzer \
|
|
||||||
@semantic-release/exec \
|
|
||||||
- |
|
|
||||||
export K8S_VERSION=$(yq '.components.clusterapi.workload.version.k8s' < ./ansible/vars/metacluster.yml)
|
|
||||||
export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY}
|
|
||||||
- |
|
|
||||||
npx semantic-release \
|
|
||||||
--package @semantic-release/exec \
|
|
||||||
--package semantic-release \
|
|
||||||
--branches ${DRONE_BRANCH} \
|
|
||||||
--tag-format "K8s_$${K8S_VERSION}-v\$${version}" \
|
|
||||||
--dry-run \
|
|
||||||
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
|
|
||||||
--analyzeCommits @semantic-release/commit-analyzer \
|
|
||||||
--verifyRelease @semantic-release/exec \
|
|
||||||
--verifyReleaseCmd 'echo "$${nextRelease.version}" > .version'
|
|
||||||
environment:
|
|
||||||
GIT_APIKEY:
|
|
||||||
from_secret: git_apikey
|
|
||||||
GIT_USERNAME: djpbessems
|
|
||||||
|
|
||||||
- name: Install Ansible Galaxy collections
|
|
||||||
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- |
|
|
||||||
ansible-galaxy collection install \
|
|
||||||
-r ansible/requirements.yml \
|
|
||||||
-p ./ansible/collections
|
|
||||||
|
|
||||||
- name: Kubernetes Bootstrap Appliance
|
|
||||||
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- |
|
|
||||||
sed -i -e "s/<<img-password>>/$${SSH_PASSWORD}/g" \
|
|
||||||
packer/preseed/UbuntuServer22.04/user-data
|
|
||||||
- |
|
|
||||||
export K8S_VERSION=$(yq '.components.clusterapi.workload.version.k8s' < ./ansible/vars/metacluster.yml)
|
|
||||||
export APPLIANCE_VERSION=$(cat .version)
|
|
||||||
- |
|
|
||||||
packer init -upgrade \
|
|
||||||
./packer
|
|
||||||
- |
|
|
||||||
packer validate \
|
|
||||||
-only=vsphere-iso.bootstrap \
|
|
||||||
-var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
|
|
||||||
-var docker_username=$${DOCKER_USERNAME} \
|
|
||||||
-var docker_password=$${DOCKER_PASSWORD} \
|
|
||||||
-var repo_username=$${REPO_USERNAME} \
|
|
||||||
-var repo_password=$${REPO_PASSWORD} \
|
|
||||||
-var ssh_password=$${SSH_PASSWORD} \
|
|
||||||
-var vsphere_password=$${VSPHERE_PASSWORD} \
|
|
||||||
-var k8s_version=$K8S_VERSION \
|
|
||||||
-var appliance_version=$APPLIANCE_VERSION \
|
|
||||||
./packer
|
|
||||||
- |
|
|
||||||
packer build \
|
|
||||||
-on-error=cleanup -timestamp-ui \
|
|
||||||
-only=vsphere-iso.bootstrap \
|
|
||||||
-var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
|
|
||||||
-var docker_username=$${DOCKER_USERNAME} \
|
|
||||||
-var docker_password=$${DOCKER_PASSWORD} \
|
|
||||||
-var repo_username=$${REPO_USERNAME} \
|
|
||||||
-var repo_password=$${REPO_PASSWORD} \
|
|
||||||
-var ssh_password=$${SSH_PASSWORD} \
|
|
||||||
-var vsphere_password=$${VSPHERE_PASSWORD} \
|
|
||||||
-var k8s_version=$K8S_VERSION \
|
|
||||||
-var appliance_version=$APPLIANCE_VERSION \
|
|
||||||
./packer
|
|
||||||
environment:
|
|
||||||
DOCKER_USERNAME:
|
|
||||||
from_secret: docker_username
|
|
||||||
DOCKER_PASSWORD:
|
|
||||||
from_secret: docker_password
|
|
||||||
# PACKER_LOG: 1
|
|
||||||
REPO_USERNAME:
|
|
||||||
from_secret: repo_username
|
|
||||||
REPO_PASSWORD:
|
|
||||||
from_secret: repo_password
|
|
||||||
SSH_PASSWORD:
|
|
||||||
from_secret: ssh_password
|
|
||||||
VSPHERE_PASSWORD:
|
|
||||||
from_secret: vsphere_password
|
|
||||||
volumes:
|
|
||||||
- name: output
|
|
||||||
path: /output
|
|
||||||
- name: scratch
|
|
||||||
path: /scratch
|
|
||||||
|
|
||||||
- name: Kubernetes Upgrade Appliance
|
|
||||||
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
||||||
pull: alwaysquery(
|
|
||||||
commands:
|
|
||||||
- |
|
|
||||||
sed -i -e "s/<<img-password>>/$${SSH_PASSWORD}/g" \
|
|
||||||
packer/preseed/UbuntuServer22.04/user-data
|
|
||||||
- |
|
|
||||||
export K8S_VERSION=$(yq '.components.clusterapi.workload.version.k8s' < ./ansible/vars/metacluster.yml)
|
|
||||||
export APPLIANCE_VERSION=$(cat .version)
|
|
||||||
- |
|
|
||||||
packer init -upgrade \
|
|
||||||
./packer
|
|
||||||
- |
|
|
||||||
packer validate \
|
|
||||||
-only=vsphere-iso.upgrade \
|
|
||||||
-var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
|
|
||||||
-var docker_username=$${DOCKER_USERNAME} \
|
|
||||||
-var docker_password=$${DOCKER_PASSWORD} \
|
|
||||||
-var repo_username=$${REPO_USERNAME} \
|
|
||||||
-var repo_password=$${REPO_PASSWORD} \
|
|
||||||
-var ssh_password=$${SSH_PASSWORD} \
|
|
||||||
-var vsphere_password=$${VSPHERE_PASSWORD} \
|
|
||||||
-var k8s_version=$K8S_VERSION \
|
|
||||||
-var appliance_version=$APPLIANCE_VERSION \
|
|
||||||
./packer
|
|
||||||
- |
|
|
||||||
packer build \
|
|
||||||
-on-error=cleanup -timestamp-ui \
|
|
||||||
-only=vsphere-iso.upgrade \
|
|
||||||
-var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
|
|
||||||
-var docker_username=$${DOCKER_USERNAME} \
|
|
||||||
-var docker_password=$${DOCKER_PASSWORD} \
|
|
||||||
-var repo_username=$${REPO_USERNAME} \
|
|
||||||
-var repo_password=$${REPO_PASSWORD} \
|
|
||||||
-var ssh_password=$${SSH_PASSWORD} \
|
|
||||||
-var vsphere_password=$${VSPHERE_PASSWORD} \
|
|
||||||
-var k8s_version=$K8S_VERSION \
|
|
||||||
-var appliance_version=$APPLIANCE_VERSION \
|
|
||||||
./packer
|
|
||||||
environment:
|
|
||||||
DOCKER_USERNAME:
|
|
||||||
from_secret: docker_username
|
|
||||||
DOCKER_PASSWORD:
|
|
||||||
from_secret: docker_password
|
|
||||||
# PACKER_LOG: 1
|
|
||||||
REPO_USERNAME:
|
|
||||||
from_secret: repo_username
|
|
||||||
REPO_PASSWORD:
|
|
||||||
from_secret: repo_password
|
|
||||||
SSH_PASSWORD:
|
|
||||||
from_secret: ssh_password
|
|
||||||
VSPHERE_PASSWORD:
|
|
||||||
from_secret: vsphere_password
|
|
||||||
volumes:
|
|
||||||
- name: output
|
|
||||||
path: /output
|
|
||||||
- name: scratch
|
|
||||||
path: /scratch
|
|
||||||
|
|
||||||
- name: Remove temporary resources
|
|
||||||
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
||||||
commands:
|
|
||||||
- |
|
|
||||||
pwsh -file scripts/Remove-Resources.ps1 \
|
|
||||||
-VMName $DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \
|
|
||||||
-VSphereFQDN 'bv11-vc.bessems.lan' \
|
|
||||||
-VSphereUsername 'administrator@vsphere.local' \
|
|
||||||
-VSpherePassword $${VSPHERE_PASSWORD}
|
|
||||||
environment:
|
|
||||||
VSPHERE_PASSWORD:
|
|
||||||
from_secret: vsphere_password
|
|
||||||
volumes:
|
|
||||||
- name: scratch
|
|
||||||
path: /scratch
|
|
||||||
when:
|
|
||||||
status:
|
|
||||||
- success
|
|
||||||
- failure
|
|
@ -56,7 +56,7 @@ jobs:
|
|||||||
|
|
||||||
build_image:
|
build_image:
|
||||||
name: Kubernetes Bootstrap Appliance
|
name: Kubernetes Bootstrap Appliance
|
||||||
container: code.spamasaurus.com/djpbessems/packer-extended:1.2.0
|
container: code.spamasaurus.com/djpbessems/packer-extended:1.3.0
|
||||||
runs-on: dind-rootless
|
runs-on: dind-rootless
|
||||||
needs: [semrel_dryrun, linting]
|
needs: [semrel_dryrun, linting]
|
||||||
steps:
|
steps:
|
||||||
@ -67,31 +67,25 @@ jobs:
|
|||||||
id: get_k8sversion
|
id: get_k8sversion
|
||||||
with:
|
with:
|
||||||
cmd: yq '.components.clusterapi.workload.version.k8s' ansible/vars/metacluster.yml
|
cmd: yq '.components.clusterapi.workload.version.k8s' ansible/vars/metacluster.yml
|
||||||
- name: Setup `packer`
|
- name: Set up packer
|
||||||
uses: hashicorp/setup-packer@main
|
uses: hashicorp/setup-packer@main
|
||||||
id: setup
|
id: setup
|
||||||
with:
|
with:
|
||||||
version: "latest"
|
version: "latest"
|
||||||
- name: Run `packer init`
|
- name: Prepare build environment
|
||||||
id: init
|
id: init
|
||||||
run: packer init -upgrade ./packer
|
|
||||||
- name: Prepare dependencies and inject configuration
|
|
||||||
run: |
|
run: |
|
||||||
export BUILD_COMMIT=$(echo "${{ gitea.sha }}" | cut -c 1-10)
|
packer init -upgrade ./packer
|
||||||
export BUILD_SUFFIX=$(openssl rand -hex 3)
|
|
||||||
|
|
||||||
sed -i -e "s/<<img-password>>/${{ secrets.SSH_PASSWORD }}/g" \
|
|
||||||
packer/preseed/UbuntuServer22.04/user-data
|
|
||||||
|
|
||||||
ansible-galaxy collection install \
|
ansible-galaxy collection install \
|
||||||
-r ansible/requirements.yml \
|
-r ansible/requirements.yml \
|
||||||
-p ./ansible/collections
|
-p ./ansible/collections
|
||||||
- name: Run `packer validate`
|
|
||||||
|
echo "BUILD_COMMIT=$(echo ${{ gitea.sha }} | cut -c 1-10)" >> $GITHUB_ENV
|
||||||
|
echo "BUILD_SUFFIX=$(openssl rand -hex 3)" >> $GITHUB_ENV
|
||||||
|
- name: Validate packer template files
|
||||||
id: validate
|
id: validate
|
||||||
run: |
|
run: |
|
||||||
# BUILD_COMMIT=$(echo "${{ gitea.sha }}" | cut -c 1-10)
|
|
||||||
# BUILD_SUFFIX=$(openssl rand -hex 3)
|
|
||||||
|
|
||||||
packer validate \
|
packer validate \
|
||||||
-only=vsphere-iso.bootstrap \
|
-only=vsphere-iso.bootstrap \
|
||||||
-var vm_name=${{ gitea.run_number }}-${BUILD_COMMIT}-${BUILD_SUFFIX} \
|
-var vm_name=${{ gitea.run_number }}-${BUILD_COMMIT}-${BUILD_SUFFIX} \
|
||||||
@ -104,12 +98,10 @@ jobs:
|
|||||||
-var k8s_version=${{ steps.get_k8sversion.outputs.result }} \
|
-var k8s_version=${{ steps.get_k8sversion.outputs.result }} \
|
||||||
-var appliance_version=${{ needs.semrel_dryrun.outputs.version }} \
|
-var appliance_version=${{ needs.semrel_dryrun.outputs.version }} \
|
||||||
./packer
|
./packer
|
||||||
- name: Run `packer build`
|
- name: Build packer template
|
||||||
run: |
|
run: |
|
||||||
# BUILD_COMMIT=$(echo "${{ gitea.sha }}" | cut -c 1-10)
|
|
||||||
# BUILD_SUFFIX=$(openssl rand -hex 3)
|
|
||||||
|
|
||||||
packer build \
|
packer build \
|
||||||
|
-on-error=cleanup -timestamp-ui \
|
||||||
-only=vsphere-iso.bootstrap \
|
-only=vsphere-iso.bootstrap \
|
||||||
-var vm_name=${{ gitea.run_number }}-${BUILD_COMMIT}-${BUILD_SUFFIX} \
|
-var vm_name=${{ gitea.run_number }}-${BUILD_COMMIT}-${BUILD_SUFFIX} \
|
||||||
-var docker_username=${{ secrets.DOCKER_USERNAME }} \
|
-var docker_username=${{ secrets.DOCKER_USERNAME }} \
|
||||||
@ -124,7 +116,6 @@ jobs:
|
|||||||
# env:
|
# env:
|
||||||
# PACKER_LOG: 1
|
# PACKER_LOG: 1
|
||||||
|
|
||||||
|
|
||||||
# semrel:
|
# semrel:
|
||||||
# name: Semantic Release
|
# name: Semantic Release
|
||||||
# runs-on: dind-rootless
|
# runs-on: dind-rootless
|
||||||
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
**/hv.vcenter.yaml
|
||||||
|
**/ova.bootstrap.yaml
|
||||||
|
**/pb.secrets.yaml
|
||||||
|
**/pwdfile
|
@ -29,4 +29,3 @@
|
|||||||
- import_tasks: manifests.yml
|
- import_tasks: manifests.yml
|
||||||
- import_tasks: kubeadm.yml
|
- import_tasks: kubeadm.yml
|
||||||
- import_tasks: containerimages.yml
|
- import_tasks: containerimages.yml
|
||||||
- import_tasks: nodetemplates.yml
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
- name: Download node-template image
|
|
||||||
ansible.builtin.uri:
|
|
||||||
url: "{{ components.clusterapi.workload.node_template.url }}"
|
|
||||||
dest: /opt/workloadcluster/node-templates/{{ components.clusterapi.workload.node_template.url | basename}}
|
|
@ -1,10 +1,40 @@
|
|||||||
- block:
|
- block:
|
||||||
|
|
||||||
- name: Inject password into values file
|
- name: Import generated values file into dictionary and combine with custom values
|
||||||
ansible.builtin.copy:
|
ansible.builtin.set_fact:
|
||||||
dest: "{{ stepconfig.path }}"
|
values_initial: |
|
||||||
content: "{{ lookup('ansible.builtin.file', stepconfig.path) | regex_replace('(ca_password|provisioner_password):[ ]?\n', '\\1: ' ~ (vapp['metacluster.password'] | b64encode) ~ '\n') }}"
|
{{
|
||||||
no_log: true
|
lookup('ansible.builtin.file', stepconfig.path) | from_yaml |
|
||||||
|
combine( components['step-certificates'].chart_values | from_yaml, recursive=True, list_merge='append')
|
||||||
|
}}
|
||||||
|
|
||||||
|
- name: Duplicate default provisioner with modified claims
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
values_new: |
|
||||||
|
{{
|
||||||
|
values_initial |
|
||||||
|
combine({'inject':{'config':{'files':{'ca.json':{'authority': {'provisioners': [
|
||||||
|
values_initial.inject.config.files['ca.json'].authority.provisioners[0] | combine({'name':'long-lived', 'claims':{'maxTLSCertDuration':'87660h'}})
|
||||||
|
]}}}}}}, list_merge='append_rp', recursive=true)
|
||||||
|
}}
|
||||||
|
|
||||||
|
# We're facing several bugs or niche cases that result in incorrect output, despite being behaviour by design:
|
||||||
|
# - Ansible's `to_yaml` filter, sees `\n` escape sequences in PEM certificate strings and correctly converts them to actual newlines - without any way to prevent this
|
||||||
|
# So we cannot rely on Ansible to (re)create the helm chart values file
|
||||||
|
# - Python's yaml interpreter sees strings with a value of `y` as short for `yes` or `true`, even when that string is a key name.
|
||||||
|
# So we cannot use a straightforward yaml document as input for the Ansible helm module (which is written in Python)
|
||||||
|
#
|
||||||
|
# Lets explain the following workaround steps:
|
||||||
|
# - First we convert the dictionary to a json-object (through Ansible), so that yq can read it
|
||||||
|
# - Second we convert the json-object in its entirety to yaml (through yq), so that yq can actually manipulate it.
|
||||||
|
# - Finally, we take one specific subkey's contents (list of dictionaries) and iterate over each with the following steps (with `map`):
|
||||||
|
# - Convert the dictionary to json with `tojson`
|
||||||
|
# - Remove newlines (and spaces) with `sub`
|
||||||
|
# - Remove outer quotes (') with `sed`
|
||||||
|
- name: Save updated values file
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: |
|
||||||
|
echo '{{ values_new | to_nice_json }}' | yq -p json -o yaml | yq e '.inject.config.files["ca.json"].authority.provisioners |= map(tojson | sub("[\n ]";""))' | sed -e "s/- '/- /;s/'$//" > {{ stepconfig.path }}
|
||||||
|
|
||||||
- name: Install step-ca chart
|
- name: Install step-ca chart
|
||||||
kubernetes.core.helm:
|
kubernetes.core.helm:
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
force_basic_auth: yes
|
force_basic_auth: yes
|
||||||
body:
|
body:
|
||||||
name: token_init_{{ lookup('password', '/dev/null length=5 chars=ascii_letters,digits') }}
|
name: token_init_{{ lookup('password', '/dev/null length=5 chars=ascii_letters,digits') }}
|
||||||
|
scopes: ["write:user","write:organization"]
|
||||||
register: gitea_api_token
|
register: gitea_api_token
|
||||||
|
|
||||||
- name: Retrieve existing gitea configuration
|
- name: Retrieve existing gitea configuration
|
||||||
|
@ -6,7 +6,11 @@
|
|||||||
initContainers:
|
initContainers:
|
||||||
- name: volume-permissions
|
- name: volume-permissions
|
||||||
image: busybox:1
|
image: busybox:1
|
||||||
command: ["sh", "-c", "touch /data/acme.json && chmod -Rv 600 /data/* && chown 65532:65532 /data/acme.json"]
|
command: ["sh", "-c", "touch /data/acme.json; chown 65532 /data/acme.json; chmod -v 600 /data/acme.json"]
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: false
|
||||||
|
runAsGroup: 0
|
||||||
|
runAsUser: 0
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /data
|
mountPath: /data
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
- import_tasks: init.yml
|
- import_tasks: init.yml
|
||||||
- import_tasks: k3s.yml
|
- import_tasks: k3s.yml
|
||||||
- import_tasks: assets.yml
|
- import_tasks: assets.yml
|
||||||
|
- import_tasks: workflow.yml
|
||||||
- import_tasks: virtualip.yml
|
- import_tasks: virtualip.yml
|
||||||
- import_tasks: metadata.yml
|
- import_tasks: metadata.yml
|
||||||
- import_tasks: storage.yml
|
- import_tasks: storage.yml
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
- block:
|
||||||
|
|
||||||
|
- name: Create target namespace(s)
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
name: "{{ item }}"
|
||||||
|
kind: Namespace
|
||||||
|
state: present
|
||||||
|
kubeconfig: "{{ kubeconfig.path }}"
|
||||||
|
loop:
|
||||||
|
# - argo-workflows
|
||||||
|
- firstboot
|
||||||
|
|
||||||
|
- name: Create ClusterRoleBinding for default serviceaccount
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
state: present
|
||||||
|
kubeconfig: "{{ kubeconfig.path }}"
|
||||||
|
definition: |
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: argo-workflows-firstboot-clusteradmin
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: cluster-admin
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: default
|
||||||
|
namespace: firstboot
|
||||||
|
|
||||||
|
- name: Install argo-workflows chart
|
||||||
|
kubernetes.core.helm:
|
||||||
|
name: argo-workflows
|
||||||
|
chart_ref: /opt/metacluster/helm-charts/argo-workflows
|
||||||
|
release_namespace: argo-workflows
|
||||||
|
create_namespace: true
|
||||||
|
wait: false
|
||||||
|
kubeconfig: "{{ kubeconfig.path }}"
|
||||||
|
values: "{{ components['argo-workflows'].chart_values }}"
|
||||||
|
|
||||||
|
- name: Ensure argo workflows API availability
|
||||||
|
ansible.builtin.uri:
|
||||||
|
url: https://workflow.{{ vapp['metacluster.fqdn'] }}/api/v1/version
|
||||||
|
method: GET
|
||||||
|
register: api_readycheck
|
||||||
|
until:
|
||||||
|
- api_readycheck.json.version is defined
|
||||||
|
retries: "{{ playbook.retries }}"
|
||||||
|
delay: "{{ (storage_benchmark | int) * (playbook.delay.long | int) }}"
|
||||||
|
|
||||||
|
module_defaults:
|
||||||
|
ansible.builtin.uri:
|
||||||
|
validate_certs: no
|
||||||
|
status_code: [200, 201]
|
||||||
|
body_format: json
|
@ -127,8 +127,8 @@
|
|||||||
wait: true
|
wait: true
|
||||||
kubeconfig: "{{ kubeconfig.path }}"
|
kubeconfig: "{{ kubeconfig.path }}"
|
||||||
loop:
|
loop:
|
||||||
- name: caip-in-cluster-controller-manager
|
- name: capi-ipam-in-cluster-controller-manager
|
||||||
namespace: caip-in-cluster-system
|
namespace: capi-ipam-in-cluster-system
|
||||||
- name: capi-controller-manager
|
- name: capi-controller-manager
|
||||||
namespace: capi-system
|
namespace: capi-system
|
||||||
- name: capv-controller-manager
|
- name: capv-controller-manager
|
||||||
@ -172,7 +172,7 @@
|
|||||||
|
|
||||||
- name: Generate nodepool kustomization manifest
|
- name: Generate nodepool kustomization manifest
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: kustomization.nodepool.j2
|
src: kustomization.longhorn-storage.j2
|
||||||
dest: "{{ capi_clustermanifest.path }}/kustomization.yaml"
|
dest: "{{ capi_clustermanifest.path }}/kustomization.yaml"
|
||||||
vars:
|
vars:
|
||||||
_template:
|
_template:
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
- name: Gather hypervisor details
|
|
||||||
ansible.builtin.shell:
|
|
||||||
cmd: govc ls -L {{ item.moref }} | awk -F/ '{print ${{ item.part }}}'
|
|
||||||
environment:
|
|
||||||
GOVC_INSECURE: '1'
|
|
||||||
GOVC_URL: "{{ vapp['hv.fqdn'] }}"
|
|
||||||
GOVC_USERNAME: "{{ vapp['hv.username'] }}"
|
|
||||||
GOVC_PASSWORD: "{{ vapp['hv.password'] }}"
|
|
||||||
register: govc_inventory
|
|
||||||
loop:
|
|
||||||
- attribute: cluster
|
|
||||||
moref: >-
|
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
|
||||||
jq -r '.[] | select(.Name == "runtime").Val.Host | .Type + ":" + .Value')
|
|
||||||
part: (NF-1)
|
|
||||||
- attribute: datacenter
|
|
||||||
moref: VirtualMachine:{{ moref_id }}
|
|
||||||
part: 2
|
|
||||||
- attribute: datastore
|
|
||||||
moref: >-
|
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
|
||||||
jq -r '.[] | select(.Name == "datastore").Val.ManagedObjectReference | .[].Type + ":" + .[].Value')
|
|
||||||
part: NF
|
|
||||||
- attribute: folder
|
|
||||||
moref: >-
|
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
|
||||||
jq -r '.[] | select(.Name == "parent").Val | .Type + ":" + .Value')
|
|
||||||
part: 0
|
|
||||||
# - attribute: host
|
|
||||||
# moref: >-
|
|
||||||
# $(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
|
||||||
# jq -r '.[] | select(.Name == "runtime").Val.Host | .Type + ":" + .Value')
|
|
||||||
# part: NF
|
|
||||||
- attribute: network
|
|
||||||
moref: >-
|
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
|
||||||
jq -r '.[] | select(.Name == "network").Val.ManagedObjectReference | .[].Type + ":" + .[].Value')
|
|
||||||
part: NF
|
|
||||||
- attribute: resourcepool
|
|
||||||
moref: >-
|
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
|
||||||
jq -r '.[] | select(.Name == "resourcePool").Val | .Type + ":" + .Value')
|
|
||||||
part: 0
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item.attribute }}"
|
|
||||||
|
|
||||||
- name: Retrieve hypervisor TLS thumbprint
|
|
||||||
ansible.builtin.shell:
|
|
||||||
cmd: openssl s_client -connect {{ vapp['hv.fqdn'] }}:443 < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout -in /dev/stdin | awk -F'=' '{print $2}'
|
|
||||||
register: tls_thumbprint
|
|
||||||
|
|
||||||
- name: Store hypervisor details in dictionary
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
vcenter_info: "{{ vcenter_info | default({}) | combine({ item.item.attribute : item.stdout }) }}"
|
|
||||||
loop: "{{ govc_inventory.results }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item.item.attribute }}"
|
|
@ -1,73 +0,0 @@
|
|||||||
- block:
|
|
||||||
|
|
||||||
- name: Check for existing template on hypervisor
|
|
||||||
community.vmware.vmware_guest_info:
|
|
||||||
name: "{{ (filename | basename | split('.'))[:-1] | join('.') }}"
|
|
||||||
register: existing_ova
|
|
||||||
ignore_errors: yes
|
|
||||||
|
|
||||||
- name: Store inventory path of existing template
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
nodetemplate_inventorypath: "{{ existing_ova.instance.hw_folder ~ '/' ~ existing_ova.instance.hw_name }}"
|
|
||||||
when: existing_ova is not failed
|
|
||||||
|
|
||||||
- block:
|
|
||||||
|
|
||||||
- name: Parse OVA file for network mappings
|
|
||||||
ansible.builtin.shell:
|
|
||||||
cmd: govc import.spec -json {{ filename }}
|
|
||||||
environment:
|
|
||||||
GOVC_INSECURE: '1'
|
|
||||||
GOVC_URL: "{{ vapp['hv.fqdn'] }}"
|
|
||||||
GOVC_USERNAME: "{{ vapp['hv.username'] }}"
|
|
||||||
GOVC_PASSWORD: "{{ vapp['hv.password'] }}"
|
|
||||||
register: ova_spec
|
|
||||||
|
|
||||||
- name: Deploy OVA template on hypervisor
|
|
||||||
community.vmware.vmware_deploy_ovf:
|
|
||||||
cluster: "{{ vcenter_info.cluster }}"
|
|
||||||
datastore: "{{ vcenter_info.datastore }}"
|
|
||||||
name: "{{ (filename | basename | split('.'))[:-1] | join('.') }}"
|
|
||||||
networks: "{u'{{ ova_spec.stdout | from_json | json_query('NetworkMapping[0].Name') }}':u'{{ vcenter_info.network }}'}"
|
|
||||||
allow_duplicates: no
|
|
||||||
power_on: false
|
|
||||||
ovf: "{{ filename }}"
|
|
||||||
register: ova_deploy
|
|
||||||
|
|
||||||
- name: Add additional placeholder disk
|
|
||||||
community.vmware.vmware_guest_disk:
|
|
||||||
name: "{{ ova_deploy.instance.hw_name }}"
|
|
||||||
disk:
|
|
||||||
- size: 1Mb
|
|
||||||
scsi_controller: 1
|
|
||||||
scsi_type: paravirtual
|
|
||||||
unit_number: 0
|
|
||||||
|
|
||||||
# Disabled to allow disks to be resized; at the cost of cloning speed
|
|
||||||
# - name: Create snapshot on deployed VM
|
|
||||||
# community.vmware.vmware_guest_snapshot:
|
|
||||||
# name: "{{ ova_deploy.instance.hw_name }}"
|
|
||||||
# state: present
|
|
||||||
# snapshot_name: "{{ ansible_date_time.iso8601_basic_short }}-base"
|
|
||||||
|
|
||||||
- name: Mark deployed VM as templates
|
|
||||||
community.vmware.vmware_guest:
|
|
||||||
name: "{{ ova_deploy.instance.hw_name }}"
|
|
||||||
is_template: yes
|
|
||||||
|
|
||||||
- name: Store inventory path of deployed template
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
nodetemplate_inventorypath: "{{ ova_deploy.instance.hw_folder ~ '/' ~ ova_deploy.instance.hw_name }}"
|
|
||||||
|
|
||||||
when: existing_ova is failed
|
|
||||||
|
|
||||||
vars:
|
|
||||||
filename: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | first }}"
|
|
||||||
module_defaults:
|
|
||||||
group/vmware:
|
|
||||||
hostname: "{{ vapp['hv.fqdn'] }}"
|
|
||||||
validate_certs: no
|
|
||||||
username: "{{ vapp['hv.username'] }}"
|
|
||||||
password: "{{ vapp['hv.password'] }}"
|
|
||||||
datacenter: "{{ vcenter_info.datacenter }}"
|
|
||||||
folder: "{{ vcenter_info.folder }}"
|
|
@ -4,34 +4,6 @@ resources:
|
|||||||
- cluster-template.yaml
|
- cluster-template.yaml
|
||||||
|
|
||||||
patches:
|
patches:
|
||||||
- patch: |-
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: csi-vsphere-config
|
|
||||||
namespace: '${NAMESPACE}'
|
|
||||||
stringData:
|
|
||||||
data: |
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: csi-vsphere-config
|
|
||||||
namespace: kube-system
|
|
||||||
stringData:
|
|
||||||
csi-vsphere.conf: |+
|
|
||||||
[Global]
|
|
||||||
insecure-flag = true
|
|
||||||
thumbprint = "${VSPHERE_TLS_THUMBPRINT}"
|
|
||||||
cluster-id = "${NAMESPACE}/${CLUSTER_NAME}"
|
|
||||||
|
|
||||||
[VirtualCenter "${VSPHERE_SERVER}"]
|
|
||||||
user = "${VSPHERE_USERNAME}"
|
|
||||||
password = "${VSPHERE_PASSWORD}"
|
|
||||||
datacenters = "${VSPHERE_DATACENTER}"
|
|
||||||
|
|
||||||
[Network]
|
|
||||||
public-network = "${VSPHERE_NETWORK}"
|
|
||||||
type: Opaque
|
|
||||||
- patch: |-
|
- patch: |-
|
||||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
|
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
|
||||||
kind: KubeadmControlPlane
|
kind: KubeadmControlPlane
|
||||||
@ -95,6 +67,7 @@ patches:
|
|||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
spec:
|
spec:
|
||||||
|
diskGiB: 60
|
||||||
network:
|
network:
|
||||||
devices:
|
devices:
|
||||||
- dhcp4: false
|
- dhcp4: false
|
||||||
@ -114,6 +87,7 @@ patches:
|
|||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
spec:
|
spec:
|
||||||
|
diskGiB: 60
|
||||||
network:
|
network:
|
||||||
devices:
|
devices:
|
||||||
- dhcp4: false
|
- dhcp4: false
|
||||||
@ -125,6 +99,25 @@ patches:
|
|||||||
- {{ _template.network.dnsserver }}
|
- {{ _template.network.dnsserver }}
|
||||||
networkName: '${VSPHERE_NETWORK}'
|
networkName: '${VSPHERE_NETWORK}'
|
||||||
|
|
||||||
|
- target:
|
||||||
|
group: addons.cluster.x-k8s.io
|
||||||
|
version: v1beta1
|
||||||
|
kind: ClusterResourceSet
|
||||||
|
name: \${CLUSTER_NAME}-crs-0
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/resources
|
||||||
|
value:
|
||||||
|
- kind: Secret
|
||||||
|
name: cloud-controller-manager
|
||||||
|
- kind: Secret
|
||||||
|
name: cloud-provider-vsphere-credentials
|
||||||
|
- kind: ConfigMap
|
||||||
|
name: cpi-manifests
|
||||||
|
- op: add
|
||||||
|
path: /spec/strategy
|
||||||
|
value: Reconcile
|
||||||
|
|
||||||
- target:
|
- target:
|
||||||
group: controlplane.cluster.x-k8s.io
|
group: controlplane.cluster.x-k8s.io
|
||||||
version: v1beta1
|
version: v1beta1
|
||||||
@ -198,6 +191,8 @@ patches:
|
|||||||
- op: replace
|
- op: replace
|
||||||
path: /metadata/name
|
path: /metadata/name
|
||||||
value: ${CLUSTER_NAME}-master
|
value: ${CLUSTER_NAME}-master
|
||||||
|
- op: remove
|
||||||
|
path: /spec/template/spec/thumbprint
|
||||||
- target:
|
- target:
|
||||||
group: controlplane.cluster.x-k8s.io
|
group: controlplane.cluster.x-k8s.io
|
||||||
version: v1beta1
|
version: v1beta1
|
||||||
@ -237,6 +232,8 @@ patches:
|
|||||||
- op: replace
|
- op: replace
|
||||||
path: /spec/template/spec/memoryMiB
|
path: /spec/template/spec/memoryMiB
|
||||||
value: {{ _template.nodesize.memory }}
|
value: {{ _template.nodesize.memory }}
|
||||||
|
- op: remove
|
||||||
|
path: /spec/template/spec/thumbprint
|
||||||
- target:
|
- target:
|
||||||
group: cluster.x-k8s.io
|
group: cluster.x-k8s.io
|
||||||
version: v1beta1
|
version: v1beta1
|
||||||
@ -258,3 +255,12 @@ patches:
|
|||||||
- op: replace
|
- op: replace
|
||||||
path: /metadata/name
|
path: /metadata/name
|
||||||
value: ${CLUSTER_NAME}-worker
|
value: ${CLUSTER_NAME}-worker
|
||||||
|
|
||||||
|
- target:
|
||||||
|
group: infrastructure.cluster.x-k8s.io
|
||||||
|
version: v1beta1
|
||||||
|
kind: VSphereCluster
|
||||||
|
name: .*
|
||||||
|
patch: |-
|
||||||
|
- op: remove
|
||||||
|
path: /spec/thumbprint
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
- attribute: cluster
|
- attribute: cluster
|
||||||
moref: >-
|
moref: >-
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
||||||
jq -r '.[] | select(.Name == "runtime").Val.Host | .Type + ":" + .Value')
|
jq -r '.[] | select(.name == "runtime").val.host | .type + ":" + .value')
|
||||||
part: (NF-1)
|
part: (NF-1)
|
||||||
- attribute: datacenter
|
- attribute: datacenter
|
||||||
moref: VirtualMachine:{{ moref_id }}
|
moref: VirtualMachine:{{ moref_id }}
|
||||||
@ -19,27 +19,27 @@
|
|||||||
- attribute: datastore
|
- attribute: datastore
|
||||||
moref: >-
|
moref: >-
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
||||||
jq -r '.[] | select(.Name == "datastore").Val.ManagedObjectReference | .[].Type + ":" + .[].Value')
|
jq -r '.[] | select(.name == "datastore").val._value | .[].type + ":" + .[].value')
|
||||||
part: NF
|
part: NF
|
||||||
- attribute: folder
|
- attribute: folder
|
||||||
moref: >-
|
moref: >-
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
||||||
jq -r '.[] | select(.Name == "parent").Val | .Type + ":" + .Value')
|
jq -r '.[] | select(.name == "parent").val | .type + ":" + .value')
|
||||||
part: 0
|
part: 0
|
||||||
# - attribute: host
|
# - attribute: host
|
||||||
# moref: >-
|
# moref: >-
|
||||||
# $(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
# $(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
||||||
# jq -r '.[] | select(.Name == "runtime").Val.Host | .Type + ":" + .Value')
|
# jq -r '.[] | select(.name == "runtime").val.host | .type + ":" + .value')
|
||||||
# part: NF
|
# part: NF
|
||||||
- attribute: network
|
- attribute: network
|
||||||
moref: >-
|
moref: >-
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
||||||
jq -r '.[] | select(.Name == "network").Val.ManagedObjectReference | .[].Type + ":" + .[].Value')
|
jq -r '.[] | select(.name == "network").val._value | .[].type + ":" + .[].value')
|
||||||
part: NF
|
part: NF
|
||||||
- attribute: resourcepool
|
- attribute: resourcepool
|
||||||
moref: >-
|
moref: >-
|
||||||
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
|
||||||
jq -r '.[] | select(.Name == "resourcePool").Val | .Type + ":" + .Value')
|
jq -r '.[] | select(.name == "resourcePool").val | .type + ":" + .value')
|
||||||
part: 0
|
part: 0
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.attribute }}"
|
label: "{{ item.attribute }}"
|
@ -0,0 +1,33 @@
|
|||||||
|
- block:
|
||||||
|
|
||||||
|
- name: Check for existing template
|
||||||
|
community.vmware.vmware_guest_info:
|
||||||
|
name: "{{ vapp['workloadcluster.nodetemplate'] }}"
|
||||||
|
hostname: "{{ vapp['hv.fqdn'] }}"
|
||||||
|
validate_certs: false
|
||||||
|
username: "{{ vapp['hv.username'] }}"
|
||||||
|
password: "{{ vapp['hv.password'] }}"
|
||||||
|
datacenter: "{{ vcenter_info.datacenter }}"
|
||||||
|
folder: "{{ vcenter_info.folder }}"
|
||||||
|
register: nodetemplate
|
||||||
|
until:
|
||||||
|
- nodetemplate is not failed
|
||||||
|
retries: 600
|
||||||
|
delay: 30
|
||||||
|
#wait for 5 hr.
|
||||||
|
vars:
|
||||||
|
color_reset: "\e[0m"
|
||||||
|
ansible_callback_diy_runner_retry_msg: >-
|
||||||
|
{%- set result = ansible_callback_diy.result.output -%}
|
||||||
|
{%- set retries_left = result.retries - result.attempts -%}
|
||||||
|
TEMPLATE '{{ vapp['workloadcluster.nodetemplate'] }}' NOT FOUND; PLEASE UPLOAD MANUALLY -- ({{ retries_left }} retries left)
|
||||||
|
ansible_callback_diy_runner_retry_msg_color: bright yellow
|
||||||
|
|
||||||
|
- name: Store inventory path of existing template
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
nodetemplate_inventorypath: "{{ nodetemplate.instance.hw_folder ~ '/' ~ nodetemplate.instance.hw_name }}"
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
- name: CRITICAL ERROR
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: Required node-template is not available; cannot continue
|
@ -1,73 +0,0 @@
|
|||||||
- block:
|
|
||||||
|
|
||||||
- name: Check for existing template on hypervisor
|
|
||||||
community.vmware.vmware_guest_info:
|
|
||||||
name: "{{ (filename | basename | split('.'))[:-1] | join('.') }}"
|
|
||||||
register: existing_ova
|
|
||||||
ignore_errors: yes
|
|
||||||
|
|
||||||
- name: Store inventory path of existing template
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
nodetemplate_inventorypath: "{{ existing_ova.instance.hw_folder ~ '/' ~ existing_ova.instance.hw_name }}"
|
|
||||||
when: existing_ova is not failed
|
|
||||||
|
|
||||||
- block:
|
|
||||||
|
|
||||||
- name: Parse OVA file for network mappings
|
|
||||||
ansible.builtin.shell:
|
|
||||||
cmd: govc import.spec -json {{ filename }}
|
|
||||||
environment:
|
|
||||||
GOVC_INSECURE: '1'
|
|
||||||
GOVC_URL: "{{ vapp['hv.fqdn'] }}"
|
|
||||||
GOVC_USERNAME: "{{ vapp['hv.username'] }}"
|
|
||||||
GOVC_PASSWORD: "{{ vapp['hv.password'] }}"
|
|
||||||
register: ova_spec
|
|
||||||
|
|
||||||
- name: Deploy OVA template on hypervisor
|
|
||||||
community.vmware.vmware_deploy_ovf:
|
|
||||||
cluster: "{{ vcenter_info.cluster }}"
|
|
||||||
datastore: "{{ vcenter_info.datastore }}"
|
|
||||||
name: "{{ (filename | basename | split('.'))[:-1] | join('.') }}"
|
|
||||||
networks: "{u'{{ ova_spec.stdout | from_json | json_query('NetworkMapping[0].Name') }}':u'{{ vcenter_info.network }}'}"
|
|
||||||
allow_duplicates: no
|
|
||||||
power_on: false
|
|
||||||
ovf: "{{ filename }}"
|
|
||||||
register: ova_deploy
|
|
||||||
|
|
||||||
- name: Add additional placeholder disk
|
|
||||||
community.vmware.vmware_guest_disk:
|
|
||||||
name: "{{ ova_deploy.instance.hw_name }}"
|
|
||||||
disk:
|
|
||||||
- size: 1Gb
|
|
||||||
scsi_controller: 1
|
|
||||||
scsi_type: paravirtual
|
|
||||||
unit_number: 0
|
|
||||||
|
|
||||||
# Disabled to allow disks to be resized; at the cost of cloning speed
|
|
||||||
# - name: Create snapshot on deployed VM
|
|
||||||
# community.vmware.vmware_guest_snapshot:
|
|
||||||
# name: "{{ ova_deploy.instance.hw_name }}"
|
|
||||||
# state: present
|
|
||||||
# snapshot_name: "{{ ansible_date_time.iso8601_basic_short }}-base"
|
|
||||||
|
|
||||||
- name: Mark deployed VM as templates
|
|
||||||
community.vmware.vmware_guest:
|
|
||||||
name: "{{ ova_deploy.instance.hw_name }}"
|
|
||||||
is_template: yes
|
|
||||||
|
|
||||||
- name: Store inventory path of deployed template
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
nodetemplate_inventorypath: "{{ ova_deploy.instance.hw_folder ~ '/' ~ ova_deploy.instance.hw_name }}"
|
|
||||||
|
|
||||||
when: existing_ova is failed
|
|
||||||
|
|
||||||
vars:
|
|
||||||
filename: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/node-templates/*.ova') | first }}"
|
|
||||||
module_defaults:
|
|
||||||
group/vmware:
|
|
||||||
hostname: "{{ vapp['hv.fqdn'] }}"
|
|
||||||
validate_certs: no
|
|
||||||
username: "{{ vapp['hv.username'] }}"
|
|
||||||
password: "{{ vapp['hv.password'] }}"
|
|
||||||
datacenter: "{{ vcenter_info.datacenter }}"
|
|
||||||
folder: "{{ vcenter_info.folder }}"
|
|
@ -37,9 +37,30 @@
|
|||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Configure Ansible defaults
|
- name: Configure Ansible defaults
|
||||||
ansible.builtin.template:
|
ansible.builtin.copy:
|
||||||
src: ansible.j2
|
|
||||||
dest: /etc/ansible/ansible.cfg
|
dest: /etc/ansible/ansible.cfg
|
||||||
|
content: |
|
||||||
|
[defaults]
|
||||||
|
callbacks_enabled = ansible.posix.profile_tasks
|
||||||
|
force_color = true
|
||||||
|
stdout_callback = community.general.diy
|
||||||
|
|
||||||
|
[callback_diy]
|
||||||
|
|
||||||
|
[callback_profile_tasks]
|
||||||
|
task_output_limit = 0
|
||||||
|
|
||||||
|
- name: Create default shell aliases
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: ~/.bashrc
|
||||||
|
state: present
|
||||||
|
line: "{{ item }}"
|
||||||
|
insertafter: EOF
|
||||||
|
loop:
|
||||||
|
- alias k="kubectl"
|
||||||
|
- alias less="less -rf"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ (item | regex_findall('([^ =\"]+)'))[2] }}"
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
[defaults]
|
|
||||||
callbacks_enabled = ansible.posix.profile_tasks
|
|
||||||
force_color = true
|
|
||||||
|
|
||||||
[callback_profile_tasks]
|
|
||||||
task_output_limit = 5
|
|
@ -1,7 +1,8 @@
|
|||||||
platform:
|
platform:
|
||||||
|
|
||||||
k3s:
|
k3s:
|
||||||
version: v1.27.1+k3s1
|
version: v1.30.0+k3s1
|
||||||
|
# version: v1.27.1+k3s1
|
||||||
|
|
||||||
packaged_components:
|
packaged_components:
|
||||||
- name: traefik
|
- name: traefik
|
||||||
@ -22,7 +23,8 @@ platform:
|
|||||||
port: 8022
|
port: 8022
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
web:
|
web:
|
||||||
redirectTo: websecure
|
redirectTo:
|
||||||
|
port: websecure
|
||||||
websecure:
|
websecure:
|
||||||
tls:
|
tls:
|
||||||
certResolver: stepca
|
certResolver: stepca
|
||||||
@ -56,46 +58,81 @@ components:
|
|||||||
|
|
||||||
argo-cd:
|
argo-cd:
|
||||||
helm:
|
helm:
|
||||||
version: 5.27.4 # (= ArgoCD v2.6.7)
|
# Must match the version referenced at `dependencies.static_binaries[.filename==argo].url`
|
||||||
|
version: 6.7.7 # (=Argo CD v2.10.5)
|
||||||
chart: argo/argo-cd
|
chart: argo/argo-cd
|
||||||
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
||||||
chart_values: !unsafe |
|
chart_values: !unsafe |
|
||||||
configs:
|
configs:
|
||||||
|
cm:
|
||||||
|
resource.compareoptions: |
|
||||||
|
ignoreAggregatedRoles: true
|
||||||
|
resource.customizations.ignoreDifferences.all: |
|
||||||
|
jsonPointers:
|
||||||
|
- /spec/conversion/webhook/clientConfig/caBundle
|
||||||
|
params:
|
||||||
|
server.insecure: true
|
||||||
secret:
|
secret:
|
||||||
argocdServerAdminPassword: "{{ vapp['metacluster.password'] | password_hash('bcrypt') }}"
|
argocdServerAdminPassword: "{{ vapp['metacluster.password'] | password_hash('bcrypt') }}"
|
||||||
|
global:
|
||||||
|
domain: gitops.{{ vapp['metacluster.fqdn'] | lower }}
|
||||||
server:
|
server:
|
||||||
extraArgs:
|
ingress:
|
||||||
- --insecure
|
enabled: true
|
||||||
|
|
||||||
|
argo-workflows:
|
||||||
|
helm:
|
||||||
|
version: 0.41.8 # (=Argo Workflows v3.5.7)
|
||||||
|
chart: argo/argo-workflows
|
||||||
|
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
||||||
|
chart_values: !unsafe |
|
||||||
|
# workflow:
|
||||||
|
# serviceAccount:
|
||||||
|
# create: true
|
||||||
|
# name: "argo-workflows"
|
||||||
|
# rbac:
|
||||||
|
# create: true
|
||||||
|
controller:
|
||||||
|
workflowNamespaces:
|
||||||
|
- default
|
||||||
|
- firstboot
|
||||||
|
server:
|
||||||
|
authModes:
|
||||||
|
- server
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
hosts:
|
hosts:
|
||||||
- gitops.{{ vapp['metacluster.fqdn'] }}
|
- workflow.{{ vapp['metacluster.fqdn']}}
|
||||||
|
paths:
|
||||||
|
- /
|
||||||
|
pathType: Prefix
|
||||||
|
|
||||||
cert-manager:
|
cert-manager:
|
||||||
helm:
|
helm:
|
||||||
version: 1.13.1
|
version: 1.14.4
|
||||||
chart: jetstack/cert-manager
|
chart: jetstack/cert-manager
|
||||||
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
||||||
# chart_values: !unsafe |
|
chart_values: !unsafe |
|
||||||
# installCRDs: true
|
installCRDs: true
|
||||||
|
|
||||||
clusterapi:
|
clusterapi:
|
||||||
management:
|
management:
|
||||||
version:
|
version:
|
||||||
# Must match the version referenced at `dependencies.static_binaries[.filename==clusterctl].url`
|
# Must match the version referenced at `dependencies.static_binaries[.filename==clusterctl].url`
|
||||||
base: v1.5.1
|
base: v1.6.3
|
||||||
# Must match the version referenced at `components.cert-manager.helm.version`
|
# Must match the version referenced at `components.cert-manager.helm.version`
|
||||||
cert_manager: v1.13.1
|
cert_manager: v1.14.4
|
||||||
infrastructure_vsphere: v1.8.1
|
infrastructure_vsphere: v1.9.2
|
||||||
ipam_incluster: v0.1.0-alpha.3
|
ipam_incluster: v0.1.0
|
||||||
# Refer to `https://console.cloud.google.com/gcr/images/cloud-provider-vsphere/GLOBAL/cpi/release/manager` for available tags
|
# Refer to `https://console.cloud.google.com/gcr/images/cloud-provider-vsphere/GLOBAL/cpi/release/manager` for available tags
|
||||||
cpi_vsphere: v1.27.0
|
cpi_vsphere: v1.30.1
|
||||||
workload:
|
workload:
|
||||||
version:
|
version:
|
||||||
calico: v3.26.2
|
calico: v3.27.3
|
||||||
k8s: v1.27.1
|
k8s: v1.30.1
|
||||||
node_template:
|
node_template:
|
||||||
url: https://{{ repo_username }}:{{ repo_password }}@sn.itch.fyi/Repository/rel/ubuntu-2204-kube-v1.27.1.ova
|
# Not used anymore; should be uploaded to hypervisor manually!
|
||||||
|
# https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/download/templates%2Fv1.30.0/
|
||||||
|
|
||||||
dex:
|
dex:
|
||||||
helm:
|
helm:
|
||||||
@ -131,7 +168,7 @@ components:
|
|||||||
|
|
||||||
gitea:
|
gitea:
|
||||||
helm:
|
helm:
|
||||||
version: v7.0.2 # (= Gitea v1.18.3)
|
version: v10.1.3 # (= Gitea v1.21.7)
|
||||||
chart: gitea-charts/gitea
|
chart: gitea-charts/gitea
|
||||||
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | sed '/:/!s/$/:latest/'
|
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | sed '/:/!s/$/:latest/'
|
||||||
chart_values: !unsafe |
|
chart_values: !unsafe |
|
||||||
@ -149,21 +186,33 @@ components:
|
|||||||
admin:
|
admin:
|
||||||
username: administrator
|
username: administrator
|
||||||
password: "{{ vapp['metacluster.password'] }}"
|
password: "{{ vapp['metacluster.password'] }}"
|
||||||
email: admin@{{ vapp['metacluster.fqdn'] }}
|
email: administrator@{{ vapp['metacluster.fqdn'] | lower }}
|
||||||
config:
|
config:
|
||||||
|
cache:
|
||||||
|
ADAPTER: memory
|
||||||
server:
|
server:
|
||||||
OFFLINE_MODE: true
|
OFFLINE_MODE: true
|
||||||
PROTOCOL: http
|
PROTOCOL: http
|
||||||
ROOT_URL: https://git.{{ vapp['metacluster.fqdn'] }}/
|
ROOT_URL: https://git.{{ vapp['metacluster.fqdn'] | lower }}/
|
||||||
|
session:
|
||||||
|
PROVIDER: db
|
||||||
image:
|
image:
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
hosts:
|
hosts:
|
||||||
- host: git.{{ vapp['metacluster.fqdn'] }}
|
- host: git.{{ vapp['metacluster.fqdn'] | lower }}
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
|
postgresql:
|
||||||
|
enabled: true
|
||||||
|
image:
|
||||||
|
tag: 16.1.0-debian-11-r25
|
||||||
|
postgresql-ha:
|
||||||
|
enabled: false
|
||||||
|
redis-cluster:
|
||||||
|
enabled: false
|
||||||
service:
|
service:
|
||||||
ssh:
|
ssh:
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
@ -172,7 +221,7 @@ components:
|
|||||||
|
|
||||||
harbor:
|
harbor:
|
||||||
helm:
|
helm:
|
||||||
version: 1.11.0 # (= Harbor v2.7.0)
|
version: 1.14.1 # (= Harbor v2.10.1)
|
||||||
chart: harbor/harbor
|
chart: harbor/harbor
|
||||||
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
||||||
chart_values: !unsafe |
|
chart_values: !unsafe |
|
||||||
@ -180,11 +229,11 @@ components:
|
|||||||
ingress:
|
ingress:
|
||||||
annotations: {}
|
annotations: {}
|
||||||
hosts:
|
hosts:
|
||||||
core: registry.{{ vapp['metacluster.fqdn'] }}
|
core: registry.{{ vapp['metacluster.fqdn'] | lower }}
|
||||||
tls:
|
tls:
|
||||||
certSource: none
|
certSource: none
|
||||||
enabled: false
|
enabled: false
|
||||||
externalURL: https://registry.{{ vapp['metacluster.fqdn'] }}
|
externalURL: https://registry.{{ vapp['metacluster.fqdn'] | lower }}
|
||||||
harborAdminPassword: "{{ vapp['metacluster.password'] }}"
|
harborAdminPassword: "{{ vapp['metacluster.password'] }}"
|
||||||
notary:
|
notary:
|
||||||
enabled: false
|
enabled: false
|
||||||
@ -195,7 +244,7 @@ components:
|
|||||||
|
|
||||||
json-server:
|
json-server:
|
||||||
helm:
|
helm:
|
||||||
version: v0.8.3
|
version: v0.8.4
|
||||||
chart: spamasaurus/json-server
|
chart: spamasaurus/json-server
|
||||||
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
|
||||||
chart_values: !unsafe |
|
chart_values: !unsafe |
|
||||||
@ -207,10 +256,14 @@ components:
|
|||||||
- path: /
|
- path: /
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
jsonServer:
|
jsonServer:
|
||||||
|
image:
|
||||||
|
repository: code.spamasaurus.com/djpbessems/json-server
|
||||||
seedData:
|
seedData:
|
||||||
configInline: {}
|
configInline: {}
|
||||||
sidecar:
|
sidecar:
|
||||||
targetUrl: version.{{ vapp['metacluster.fqdn'] }}
|
targetUrl: version.{{ vapp['metacluster.fqdn'] }}
|
||||||
|
image:
|
||||||
|
repository: code.spamasaurus.com/djpbessems/json-server
|
||||||
|
|
||||||
kube-prometheus-stack:
|
kube-prometheus-stack:
|
||||||
helm:
|
helm:
|
||||||
@ -225,23 +278,30 @@ components:
|
|||||||
|
|
||||||
kubevip:
|
kubevip:
|
||||||
# Must match the version referenced at `dependencies.container_images`
|
# Must match the version referenced at `dependencies.container_images`
|
||||||
version: v0.5.8
|
version: v0.6.3
|
||||||
|
|
||||||
longhorn:
|
longhorn:
|
||||||
helm:
|
helm:
|
||||||
version: 1.4.1
|
version: 1.5.4
|
||||||
chart: longhorn/longhorn
|
chart: longhorn/longhorn
|
||||||
parse_logic: cat values.yaml | yq eval '.. | select(has("repository")) | .repository + ":" + .tag'
|
parse_logic: cat values.yaml | yq eval '.. | select(has("repository")) | .repository + ":" + .tag'
|
||||||
chart_values: !unsafe |
|
chart_values: !unsafe |
|
||||||
defaultSettings:
|
defaultSettings:
|
||||||
allowNodeDrainWithLastHealthyReplica: true
|
concurrentReplicaRebuildPerNodeLimit: 10
|
||||||
defaultDataPath: /mnt/blockstorage
|
defaultDataPath: /mnt/blockstorage
|
||||||
defaultReplicaCount: 1
|
logLevel: Info
|
||||||
|
nodeDrainPolicy: block-for-eviction-if-contains-last-replica
|
||||||
|
replicaSoftAntiAffinity: true
|
||||||
|
priorityClass: system-node-critical
|
||||||
|
storageOverProvisioningPercentage: 200
|
||||||
|
storageReservedPercentageForDefaultDisk: 0
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
host: storage.{{ vapp['metacluster.fqdn'] }}
|
host: storage.{{ vapp['metacluster.fqdn'] | lower }}
|
||||||
persistence:
|
longhornManager:
|
||||||
defaultClassReplicaCount: 1
|
priorityClass: system-node-critical
|
||||||
|
longhornDriver:
|
||||||
|
priorityClass: system-node-critical
|
||||||
|
|
||||||
pinniped:
|
pinniped:
|
||||||
helm:
|
helm:
|
||||||
@ -266,22 +326,14 @@ components:
|
|||||||
|
|
||||||
step-certificates:
|
step-certificates:
|
||||||
helm:
|
helm:
|
||||||
version: 1.23.0
|
version: 1.25.2 # (= step-ca v0.25.2)
|
||||||
chart: smallstep/step-certificates
|
chart: smallstep/step-certificates
|
||||||
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sed '/:/!s/$/:latest/' | sort -u
|
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sed '/:/!s/$/:latest/' | sort -u
|
||||||
chart_values: !unsafe |
|
chart_values: !unsafe |
|
||||||
ca:
|
|
||||||
dns: ca.{{ vapp['metacluster.fqdn'] }},step-certificates.step-ca.svc.cluster.local,127.0.0.1
|
|
||||||
password: "{{ vapp['metacluster.password'] }}"
|
|
||||||
provisioner:
|
|
||||||
name: admin
|
|
||||||
password: "{{ vapp['metacluster.password'] }}"
|
|
||||||
inject:
|
inject:
|
||||||
secrets:
|
secrets:
|
||||||
ca_password: "{{ vapp['metacluster.password'] | b64encode }}"
|
ca_password: "{{ vapp['metacluster.password'] | b64encode }}"
|
||||||
provisioner_password: "{{ vapp['metacluster.password'] | b64encode }}"
|
provisioner_password: "{{ vapp['metacluster.password'] | b64encode }}"
|
||||||
service:
|
|
||||||
targetPort: 9000
|
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
||||||
@ -297,41 +349,45 @@ dependencies:
|
|||||||
container_images:
|
container_images:
|
||||||
# This should match the image tag referenced at `platform.packaged_components[.name==traefik].config`
|
# This should match the image tag referenced at `platform.packaged_components[.name==traefik].config`
|
||||||
- busybox:1
|
- busybox:1
|
||||||
- ghcr.io/kube-vip/kube-vip:v0.5.8
|
- ghcr.io/kube-vip/kube-vip:v0.6.3
|
||||||
# The following list is generated by running the following commands:
|
# The following list is generated by running the following commands:
|
||||||
# $ clusterctl init -i vsphere:<version> [...]
|
# $ clusterctl init -i vsphere:<version> [...]
|
||||||
# $ clusterctl generate cluster <name> [...] | yq eval '.data.data' | yq --no-doc eval '.. | .image? | select(.)' | sort -u
|
# $ clusterctl generate cluster <name> [...] | yq eval '.data.data' | yq --no-doc eval '.. | .image? | select(.)' | sort -u
|
||||||
- gcr.io/cloud-provider-vsphere/cpi/release/manager:v1.27.0
|
- gcr.io/cloud-provider-vsphere/cpi/release/manager:v1.27.0
|
||||||
- gcr.io/cloud-provider-vsphere/csi/release/driver:v2.1.0
|
- gcr.io/cloud-provider-vsphere/csi/release/driver:v3.1.0
|
||||||
- gcr.io/cloud-provider-vsphere/csi/release/syncer:v2.1.0
|
- gcr.io/cloud-provider-vsphere/csi/release/syncer:v3.1.0
|
||||||
- quay.io/k8scsi/csi-attacher:v3.0.0
|
- registry.k8s.io/sig-storage/csi-attacher:v4.3.0
|
||||||
- quay.io/k8scsi/csi-node-driver-registrar:v2.0.1
|
- registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.8.0
|
||||||
- quay.io/k8scsi/csi-provisioner:v2.0.0
|
- registry.k8s.io/sig-storage/csi-provisioner:v3.5.0
|
||||||
- quay.io/k8scsi/livenessprobe:v2.1.0
|
- registry.k8s.io/sig-storage/csi-resizer:v1.8.0
|
||||||
|
- registry.k8s.io/sig-storage/csi-snapshotter:v6.2.2
|
||||||
|
- registry.k8s.io/sig-storage/livenessprobe:v2.10.0
|
||||||
|
|
||||||
static_binaries:
|
static_binaries:
|
||||||
|
- filename: argo
|
||||||
|
url: https://github.com/argoproj/argo-workflows/releases/download/v3.5.7/argo-linux-amd64.gz
|
||||||
- filename: clusterctl
|
- filename: clusterctl
|
||||||
url: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.1/clusterctl-linux-amd64
|
url: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.3/clusterctl-linux-amd64
|
||||||
- filename: govc
|
- filename: govc
|
||||||
url: https://github.com/vmware/govmomi/releases/download/v0.29.0/govc_Linux_x86_64.tar.gz
|
url: https://github.com/vmware/govmomi/releases/download/v0.36.3/govc_Linux_x86_64.tar.gz
|
||||||
archive: compressed
|
archive: compressed
|
||||||
- filename: helm
|
- filename: helm
|
||||||
url: https://get.helm.sh/helm-v3.10.2-linux-amd64.tar.gz
|
url: https://get.helm.sh/helm-v3.14.3-linux-amd64.tar.gz
|
||||||
archive: compressed
|
archive: compressed
|
||||||
extra_opts: --strip-components=1
|
extra_opts: --strip-components=1
|
||||||
- filename: kubectl-slice
|
- filename: kubectl-slice
|
||||||
url: https://github.com/patrickdappollonio/kubectl-slice/releases/download/v1.2.5/kubectl-slice_linux_x86_64.tar.gz
|
url: https://github.com/patrickdappollonio/kubectl-slice/releases/download/v1.2.9/kubectl-slice_linux_x86_64.tar.gz
|
||||||
archive: compressed
|
archive: compressed
|
||||||
- filename: pinniped
|
- filename: pinniped
|
||||||
url: https://github.com/vmware-tanzu/pinniped/releases/download/v0.25.0/pinniped-cli-linux-amd64
|
url: https://github.com/vmware-tanzu/pinniped/releases/download/v0.25.0/pinniped-cli-linux-amd64
|
||||||
- filename: skopeo
|
- filename: skopeo
|
||||||
url: https://code.spamasaurus.com/api/packages/djpbessems/generic/skopeo/v1.12.0/skopeo_linux_amd64
|
url: https://code.spamasaurus.com/api/packages/djpbessems/generic/skopeo/v1.12.0/skopeo_linux_amd64
|
||||||
- filename: step
|
- filename: step
|
||||||
url: https://dl.step.sm/gh-release/cli/gh-release-header/v0.23.0/step_linux_0.23.0_amd64.tar.gz
|
url: https://dl.step.sm/gh-release/cli/gh-release-header/v0.25.2/step_linux_0.25.2_amd64.tar.gz
|
||||||
archive: compressed
|
archive: compressed
|
||||||
extra_opts: --strip-components=2
|
extra_opts: --strip-components=2
|
||||||
- filename: yq
|
- filename: yq
|
||||||
url: http://github.com/mikefarah/yq/releases/download/v4.30.5/yq_linux_amd64
|
url: https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_amd64
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
apt:
|
apt:
|
||||||
|
@ -11,7 +11,7 @@ downstream:
|
|||||||
helm_charts:
|
helm_charts:
|
||||||
|
|
||||||
longhorn:
|
longhorn:
|
||||||
version: 1.4.1
|
version: 1.5.4
|
||||||
chart: longhorn/longhorn
|
chart: longhorn/longhorn
|
||||||
namespace: longhorn-system
|
namespace: longhorn-system
|
||||||
parse_logic: cat values.yaml | yq eval '.. | select(has("repository")) | .repository + ":" + .tag'
|
parse_logic: cat values.yaml | yq eval '.. | select(has("repository")) | .repository + ":" + .tag'
|
||||||
|
78
deployment/playbook.yml
Normal file
78
deployment/playbook.yml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
- hosts: localhost
|
||||||
|
vars_files:
|
||||||
|
- vars/ova.bootstrap.yaml
|
||||||
|
- vars/hv.vcenter.yaml
|
||||||
|
- vars/pb.secrets.yaml
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Retrieve target folder details
|
||||||
|
community.vmware.vmware_vm_info:
|
||||||
|
hostname: "{{ hv.hostname }}"
|
||||||
|
username: "{{ hv.username }}"
|
||||||
|
password: "{{ secrets.hv.password }}"
|
||||||
|
folder: "{{ hv.folder }}"
|
||||||
|
validate_certs: false
|
||||||
|
register: vm_info
|
||||||
|
|
||||||
|
- name: User prompt
|
||||||
|
ansible.builtin.pause:
|
||||||
|
prompt: Virtual machine '{{ appliance.id }}' already exists. Delete to continue [yes] or abort [no]?"
|
||||||
|
register: prompt
|
||||||
|
until:
|
||||||
|
- prompt.user_input in ['yes', 'no']
|
||||||
|
delay: 0
|
||||||
|
when: (vm_info | selectattr('guest_name', 'equalto', appliance.id) | length) > 0
|
||||||
|
|
||||||
|
- name: Destroy existing VM
|
||||||
|
community.vmware.vmware_guest:
|
||||||
|
hostname: "{{ hv.hostname }}"
|
||||||
|
username: "{{ hv.username }}"
|
||||||
|
password: "{{ secrets.hv.password }}"
|
||||||
|
folder: "{{ hv.folder }}"
|
||||||
|
name: appliance.id
|
||||||
|
state: absent
|
||||||
|
when:
|
||||||
|
- (vm_info | selectattr('guest_name', 'equalto', appliance.id) | length) > 0
|
||||||
|
- (prompt.user_input | bool) == true
|
||||||
|
|
||||||
|
- name: Deploy VM from OVA-template
|
||||||
|
community.vmware.vmware_deploy_ovf:
|
||||||
|
hostname: "{{ hv.hostname }}"
|
||||||
|
username: "{{ hv.username }}"
|
||||||
|
password: "{{ secrets.hv.password }}"
|
||||||
|
validate_certs: false
|
||||||
|
datacenter: "{{ hv.datacenter }}"
|
||||||
|
folder: "{{ hv.folder }}"
|
||||||
|
cluster: "{{ hv.cluster }}"
|
||||||
|
name: airgapped-k8s-meta1
|
||||||
|
datastore: "{{ hv.datastore }}"
|
||||||
|
disk_provisioning: thin
|
||||||
|
networks:
|
||||||
|
"LAN": "{{ hv.network }}"
|
||||||
|
power_on: yes
|
||||||
|
ovf: "{{ appliance.path }}/{{ appliance.filename }}"
|
||||||
|
deployment_option: cp1w1ws0
|
||||||
|
properties:
|
||||||
|
metacluster.fqdn: k8s.lab
|
||||||
|
metacluster.vip: 192.168.154.125
|
||||||
|
metacluster.token: "{{ secrets.appliance.installtoken }}"
|
||||||
|
# guestinfo.hostname: _default
|
||||||
|
metacluster.password: "{{ secrets.appliance.password }}"
|
||||||
|
guestinfo.ipaddress: 192.168.154.126
|
||||||
|
guestinfo.prefixlength: '24'
|
||||||
|
guestinfo.dnsserver: 192.168.154.225
|
||||||
|
guestinfo.gateway: 192.168.154.1
|
||||||
|
# workloadcluster.name: _default
|
||||||
|
workloadcluster.vip: 192.168.154.130
|
||||||
|
ippool.startip: 192.168.154.135
|
||||||
|
ippool.endip: 192.168.154.140
|
||||||
|
workloadcluster.nodetemplate: ubuntu-2204-kube-v1.30.0
|
||||||
|
workloadcluster.nodesize: small
|
||||||
|
# workloadcluster.additionaldisk: '75'
|
||||||
|
guestinfo.rootsshkey: ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAiRc7Og+cRJGFwdUzgpX9YqvVenTk54N4kqM7emEfYHdsJLMjKQyxr8hklHmsam5dzxx3itFzc6SLf/ldJJ2JZuzE5FiCqUXXv4UFwN6HF5xqn7PTLicvWZH93H4m1gOlD5Dfzi4Es34v5zRBwbMScOgekk/LweTgl35jGKDgMP5DjGTqkPf7Ndh9+iuQrz99JEr8egl3bj+jIlKjScfaQbbnu3AJIRwZwTKgw0AOkLliQdEPNLvG5/ZImxJG4oHV9/uNkfdJObLjT1plR1HbVNskV5fuRNE/vnUiWl9jAJ1RT83GOqV0sQ+Q7p214fkgqb3JPvci/s0Bb7RA85hBEQ== bessems.eu
|
||||||
|
hv.fqdn: "{{ hv.hostname }}"
|
||||||
|
hv.username: "{{ hv.username }}"
|
||||||
|
hv.password: "{{ secrets.hv.password }}"
|
||||||
|
ldap.fqdn: _unused
|
||||||
|
ldap.dn: _unused
|
||||||
|
ldap.password: _unused
|
5
deployment/requirements.yaml
Normal file
5
deployment/requirements.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
collections:
|
||||||
|
# - ansible.posix
|
||||||
|
# - ansible.utils
|
||||||
|
# - community.general
|
||||||
|
- community.vmware
|
@ -50,11 +50,11 @@ build {
|
|||||||
inline = [
|
inline = [
|
||||||
"pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\",
|
"pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\",
|
||||||
" -ApplianceType '${source.name}' \\",
|
" -ApplianceType '${source.name}' \\",
|
||||||
" -OVFFile '/scratch/bld_${var.vm_name}_${source.name}.ovf' \"",
|
" -OVFFile '/data/scratch/bld_${var.vm_name}_${source.name}.ovf' \"",
|
||||||
"pwsh -file scripts/Update-Manifest.ps1 \\",
|
"pwsh -file scripts/Update-Manifest.ps1 \\",
|
||||||
" -ManifestFileName '/scratch/bld_${var.vm_name}_${source.name}.mf'",
|
" -ManifestFileName '/data/scratch/bld_${var.vm_name}_${source.name}.mf'",
|
||||||
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
|
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
|
||||||
" '/scratch/bld_${var.vm_name}_${source.name}.ovf' \\",
|
" '/data/scratch/bld_${var.vm_name}_${source.name}.ovf' \\",
|
||||||
" /output/airgapped-k8s-${var.appliance_version}+${var.k8s_version}-${source.name}.ova"
|
" /output/airgapped-k8s-${var.appliance_version}+${var.k8s_version}-${source.name}.ova"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ source "vsphere-iso" "ubuntu" {
|
|||||||
boot_order = "disk,cdrom"
|
boot_order = "disk,cdrom"
|
||||||
boot_command = [
|
boot_command = [
|
||||||
"e<down><down><down><end>",
|
"e<down><down><down><end>",
|
||||||
" autoinstall ds=nocloud;",
|
" autoinstall network-config=disabled ds=nocloud;",
|
||||||
"<F10>"
|
"<F10>"
|
||||||
]
|
]
|
||||||
boot_wait = "2s"
|
boot_wait = "2s"
|
||||||
@ -56,6 +56,8 @@ source "vsphere-iso" "ubuntu" {
|
|||||||
remove_cdrom = true
|
remove_cdrom = true
|
||||||
|
|
||||||
export {
|
export {
|
||||||
output_directory = "/scratch"
|
output_directory = "/data/scratch"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy = true
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,19 @@ PropertyCategories:
|
|||||||
- cp1w1ws1
|
- cp1w1ws1
|
||||||
UserConfigurable: true
|
UserConfigurable: true
|
||||||
|
|
||||||
|
- Key: workloadcluster.nodetemplate
|
||||||
|
Type: string["ubuntu-2204-kube-v1.30.0", "photon-5-kube-v1.30.0.ova"]
|
||||||
|
Label: Workload-cluster node template
|
||||||
|
Description: |
|
||||||
|
All worker and worker-storage nodes for the workload-cluster will be provisioned with this node template.
|
||||||
|
Note:
|
||||||
|
Make sure that this exact template has been uploaded to the vCenter instance before powering on this appliance!
|
||||||
|
DefaultValue: ubuntu-2204-kube-v1.30.0
|
||||||
|
Configurations:
|
||||||
|
- cp1w1ws0
|
||||||
|
- cp1w1ws1
|
||||||
|
UserConfigurable: true
|
||||||
|
|
||||||
- Key: workloadcluster.nodesize
|
- Key: workloadcluster.nodesize
|
||||||
Type: string["small", "medium", "large"]
|
Type: string["small", "medium", "large"]
|
||||||
Label: Workload-cluster node size*
|
Label: Workload-cluster node size*
|
||||||
|
@ -44,7 +44,7 @@ PropertyCategories:
|
|||||||
Configurations: '*'
|
Configurations: '*'
|
||||||
UserConfigurable: true
|
UserConfigurable: true
|
||||||
|
|
||||||
- Name: 2) Add meta-cluster node
|
- Name: 2) Meta-cluster new node
|
||||||
ProductProperties:
|
ProductProperties:
|
||||||
|
|
||||||
- Key: guestinfo.hostname
|
- Key: guestinfo.hostname
|
||||||
@ -95,7 +95,20 @@ PropertyCategories:
|
|||||||
# Configurations: '*'
|
# Configurations: '*'
|
||||||
# UserConfigurable: true
|
# UserConfigurable: true
|
||||||
|
|
||||||
- Name: 3) Common
|
- Name: 3) Workload-cluster
|
||||||
|
ProductProperties:
|
||||||
|
|
||||||
|
- Key: workloadcluster.nodetemplate
|
||||||
|
Type: string["ubuntu-2204-kube-v1.30.0", "photon-5-kube-v1.30.0.ova"]
|
||||||
|
Label: Workload-cluster node template
|
||||||
|
Description: |
|
||||||
|
All worker and worker-storage nodes for the workload-cluster will be provisioned with this node template.
|
||||||
|
Note:
|
||||||
|
Make sure that this exact template has been uploaded to the vCenter instance before powering on this appliance!
|
||||||
|
DefaultValue: ubuntu-2204-kube-v1.30.0
|
||||||
|
UserConfigurable: true
|
||||||
|
|
||||||
|
- Name: 4) Common
|
||||||
ProductProperties:
|
ProductProperties:
|
||||||
|
|
||||||
- Key: guestinfo.rootsshkey
|
- Key: guestinfo.rootsshkey
|
||||||
@ -106,7 +119,7 @@ PropertyCategories:
|
|||||||
Configurations: '*'
|
Configurations: '*'
|
||||||
UserConfigurable: true
|
UserConfigurable: true
|
||||||
|
|
||||||
- Name: 4) Hypervisor
|
- Name: 5) Hypervisor
|
||||||
ProductProperties:
|
ProductProperties:
|
||||||
|
|
||||||
- Key: hv.fqdn
|
- Key: hv.fqdn
|
||||||
|
Reference in New Issue
Block a user