This commit is contained in:
parent
2d99511360
commit
c27712bc20
@ -7,5 +7,4 @@
|
||||
roles:
|
||||
- os
|
||||
- firstboot
|
||||
- appliance
|
||||
- metacluster
|
||||
- assets
|
||||
|
@ -1,2 +0,0 @@
|
||||
- name: Install & configure dependencies
|
||||
import_tasks: dependencies.yml
|
@ -1,36 +1,3 @@
|
||||
- name: Create folder structure(s)
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- /opt/metacluster/helm-charts
|
||||
- /opt/metacluster/manifests/bootstrap-kubeadm/{{ components.clusterapi.management.version.base }}
|
||||
- /opt/metacluster/manifests/cert-manager/{{ components.clusterapi.management.version.cert_manager }}
|
||||
- /opt/metacluster/manifests/cluster-api/{{ components.clusterapi.management.version.base }}
|
||||
- /opt/metacluster/manifests/control-plane-kubeadm/{{ components.clusterapi.management.version.base }}
|
||||
- /opt/metacluster/manifests/infrastructure-vsphere/{{ components.clusterapi.management.version.infrastructure_vsphere }}
|
||||
- /opt/metacluster/container-images
|
||||
|
||||
- name: Add helm repositories
|
||||
kubernetes.core.helm_repository:
|
||||
name: "{{ item.name }}"
|
||||
repo_url: "{{ item.url }}"
|
||||
state: present
|
||||
loop: "{{ platform.helm_repositories }}"
|
||||
|
||||
- name: Fetch helm charts
|
||||
ansible.builtin.command:
|
||||
cmd: helm fetch {{ item.value.helm.chart }} --untar --version {{ item.value.helm.version }}
|
||||
chdir: /opt/metacluster/helm-charts
|
||||
when: item.value.helm is defined
|
||||
register: helmcharts
|
||||
loop: "{{ lookup('ansible.builtin.dict', components) }}"
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
retries: 5
|
||||
delay: 5
|
||||
until: helmcharts is not failed
|
||||
|
||||
- block:
|
||||
|
||||
- name: Aggregate chart_values into dict
|
||||
@ -51,7 +18,7 @@
|
||||
- name: Download ClusterAPI manifests
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ item.url }}"
|
||||
dest: /opt/metacluster/manifests/{{ item.dest }}
|
||||
dest: /opt/metacluster/cluster-api/{{ item.dest }}
|
||||
register: clusterapi_manifests
|
||||
loop:
|
||||
# This list is based on `clusterctl config repositories`
|
@ -1,10 +1,3 @@
|
||||
# - name: Create folder structure(s)
|
||||
# ansible.builtin.file:
|
||||
# path: "{{ item }}"
|
||||
# state: directory
|
||||
# loop:
|
||||
# - /foo
|
||||
|
||||
- name: Download & install static binaries
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ item.url }}"
|
5
ansible/roles/assets/tasks/git.yml
Normal file
5
ansible/roles/assets/tasks/git.yml
Normal file
@ -0,0 +1,5 @@
|
||||
- name: Clone git repository
|
||||
ansible.builtin.git:
|
||||
repo: "{{ platform.gitops.repository.uri }}"
|
||||
version: "{{ platform.gitops.repository.revision }}"
|
||||
dest: /opt/metacluster/git-repositories/gitops
|
19
ansible/roles/assets/tasks/helm.yml
Normal file
19
ansible/roles/assets/tasks/helm.yml
Normal file
@ -0,0 +1,19 @@
|
||||
- name: Add helm repositories
|
||||
kubernetes.core.helm_repository:
|
||||
name: "{{ item.name }}"
|
||||
repo_url: "{{ item.url }}"
|
||||
state: present
|
||||
loop: "{{ platform.helm_repositories }}"
|
||||
|
||||
- name: Fetch helm charts
|
||||
ansible.builtin.command:
|
||||
cmd: helm fetch {{ item.value.helm.chart }} --untar --version {{ item.value.helm.version }}
|
||||
chdir: /opt/metacluster/helm-charts
|
||||
when: item.value.helm is defined
|
||||
register: helmcharts
|
||||
loop: "{{ lookup('ansible.builtin.dict', components) }}"
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
retries: 5
|
||||
delay: 5
|
||||
until: helmcharts is not failed
|
@ -1,11 +1,3 @@
|
||||
- name: Create folder structure(s)
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- /var/lib/rancher/k3s/agent/images
|
||||
- /var/lib/rancher/k3s/server/manifests
|
||||
- /opt/metacluster/k3s
|
||||
|
||||
- name: Download & install K3s binary
|
||||
ansible.builtin.get_url:
|
24
ansible/roles/assets/tasks/main.yml
Normal file
24
ansible/roles/assets/tasks/main.yml
Normal file
@ -0,0 +1,24 @@
|
||||
- name: Create folder structure(s)
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- /opt/metacluster/cluster-api/bootstrap-kubeadm/{{ components.clusterapi.management.version.base }}
|
||||
- /opt/metacluster/cluster-api/cert-manager/{{ components.clusterapi.management.version.cert_manager }}
|
||||
- /opt/metacluster/cluster-api/cluster-api/{{ components.clusterapi.management.version.base }}
|
||||
- /opt/metacluster/cluster-api/control-plane-kubeadm/{{ components.clusterapi.management.version.base }}
|
||||
- /opt/metacluster/cluster-api/infrastructure-vsphere/{{ components.clusterapi.management.version.infrastructure_vsphere }}
|
||||
- /opt/metacluster/container-images
|
||||
- /opt/metacluster/git-repositories/gitops
|
||||
- /opt/metacluster/helm-charts
|
||||
- /opt/metacluster/k3s
|
||||
- /opt/workloadcluster/node-templates
|
||||
- /var/lib/rancher/k3s/agent/images
|
||||
- /var/lib/rancher/k3s/server/manifests
|
||||
|
||||
- import_tasks: dependencies.yml
|
||||
- import_tasks: k3s.yml
|
||||
- import_tasks: helm.yml
|
||||
- import_tasks: git
|
||||
- import_tasks: containerimages.yml
|
||||
- import_tasks: nodetemplates.yml
|
4
ansible/roles/assets/tasks/nodetemplates.yml
Normal file
4
ansible/roles/assets/tasks/nodetemplates.yml
Normal file
@ -0,0 +1,4 @@
|
||||
- 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.name }}
|
@ -1,7 +1,7 @@
|
||||
- name: Configure clusterctl
|
||||
ansible.builtin.template:
|
||||
src: clusterctl.j2
|
||||
dest: /opt/metacluster/manifests/clusterctl.yaml
|
||||
dest: /opt/metacluster/cluster-api/clusterctl.yaml
|
||||
vars:
|
||||
_template:
|
||||
version:
|
||||
@ -27,4 +27,4 @@
|
||||
- name: Initialize Cluster API management cluster
|
||||
ansible.builtin.shell:
|
||||
cmd: clusterctl init -v5 -i vsphere:{{ components.clusterapi.management.version.infrastructure_vsphere }} --config ./clusterctl.yaml --kubeconfig {{ kubeconfig.path }}
|
||||
chdir: /opt/metacluster/manifests
|
||||
chdir: /opt/metacluster/cluster-api
|
||||
|
@ -1,8 +0,0 @@
|
||||
- name: Pre-stage K3s components
|
||||
import_tasks: k3s.yml
|
||||
|
||||
- name: Pre-stage meta-cluster components
|
||||
import_tasks: components.yml
|
||||
|
||||
- name: Pre-stage meta-cluster configuration and workload-cluster components
|
||||
import_tasks: staging.yml
|
@ -1,18 +0,0 @@
|
||||
- name: Create folder structure(s)
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- /opt/metacluster/git-repositories/gitops
|
||||
- /opt/workloadcluster/node-templates
|
||||
|
||||
- name: Clone git repository
|
||||
ansible.builtin.git:
|
||||
repo: "{{ platform.gitops.repository.uri }}"
|
||||
version: "{{ platform.gitops.repository.revision }}"
|
||||
dest: /opt/metacluster/git-repositories/gitops
|
||||
|
||||
- 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.name }}
|
Loading…
Reference in New Issue
Block a user