From 73daee6e7bd5a98a8e518bb3147ea68c602b2ce8 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Tue, 19 Apr 2022 09:10:44 +0200 Subject: [PATCH] Download OVA;Add scratch volume;Reference url as variable --- .drone.yml | 26 ++++++++++++++++++++++++-- playbook.yml | 7 +++++-- vars/cluster.k3s.yml | 1 + 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 315c091..bdd999e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,9 +1,14 @@ kind: pipeline type: kubernetes -name: k3s_cluster +name: 'Provision K3s cluster' + +volumes: +- name: scratch + claim: + name: flexvolsmb-drone-scratch steps: -- name: Apply playbook +- name: Run Ansible playbook image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: @@ -27,3 +32,20 @@ steps: from_secret: root_password # private_key: # from_secret: ssh_privatekey + volumes: + - name: scratch + path: /scratch +- name: Remove temporary resources + image: bv11-cr01.bessems.eu/library/packer-extended + pull: always + commands: + - | + rm /scratch/* -Rf + volumes: + - name: scratch + path: /scratch + when: + status: + - success + - failure + diff --git a/playbook.yml b/playbook.yml index 256078b..e469511 100644 --- a/playbook.yml +++ b/playbook.yml @@ -4,8 +4,11 @@ - hypervisor.vcenter.yml - cluster.k3s.yml tasks: + - name: Download OVF-template + ansible.builtin.get_url: + url: "https://{{ repo_username }}:{{ repo_password }}@{{ image.ova_url }}" + dest: /scratch/image.ova - name: Deploy VMs from OVF-template -# community.vmware.vmware_guest: community.vmware.vmware_deploy_ovf: hostname: "{{ hv.hostname }}" username: "{{ hv.username }}" @@ -20,7 +23,7 @@ networks: "LAN": "{{ hv.network }}" power_on: yes - ovf: "https://{{ repo_username }}:{{ repo_password }}@sn.itch.fyi/Repository/rel/Ubuntu-Server-20.04.ova" + ovf: /scratch/image.ova deployment_option: "{{ image.deployment_option }}" properties: guestinfo.hostname: "{{ kubernetes.clustername | upper }}_{{ (item.ip | checksum)[-5:] | upper }}" diff --git a/vars/cluster.k3s.yml b/vars/cluster.k3s.yml index 16e1d11..444d1b1 100644 --- a/vars/cluster.k3s.yml +++ b/vars/cluster.k3s.yml @@ -3,6 +3,7 @@ kubernetes: clustername: k3s-dev image: deployment_option: large + ova_url: sn.itch.fyi/Repository/rel/Ubuntu-Server-20.04.ova servers: - ip: 192.168.11.121/24 guest_id: ubuntu64Guest