From 4a09b34c2607676c944aae0e93e2a5019273caba Mon Sep 17 00:00:00 2001 From: djpbessems Date: Mon, 18 Apr 2022 22:49:50 +0200 Subject: [PATCH] Add extra parameters;Refactor to different module --- .drone.yml | 6 +++++- playbook.yml | 45 ++++++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.drone.yml b/.drone.yml index e0b4567..d01bab0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,9 +14,13 @@ steps: - ansible-galaxy collection install -r requirements.yml - | ansible-playbook \ - --extra-vars "hv_password=$${hv_password}" \ + --extra-vars "repo_username=$${repo_username} repo_password=$${repo_password} hv_password=$${hv_password}" \ playbook.yml environment: + repo_username: + from_secret: repo_username + repo_password: + from_secret: repo_password hv_password: from_secret: hv_password # private_key: diff --git a/playbook.yml b/playbook.yml index b77abe1..01fd867 100644 --- a/playbook.yml +++ b/playbook.yml @@ -4,8 +4,9 @@ - hypervisor.vcenter.yml - cluster.k3s.yml tasks: - - name: Clone multiple VMs from template - community.vmware.vmware_guest: + - name: Deploy VMs from OVF-template +# community.vmware.vmware_guest: + community.vmware.vmware_deploy_ovf: hostname: "{{ hv.hostname }}" username: "{{ hv.username }}" password: "{{ hv_password }}" @@ -13,25 +14,27 @@ datacenter: "{{ hv.datacenter }}" folder: "{{ hv.folder }}" cluster: "{{ hv.cluster }}" - name: "{{ kubernetes.clustername | upper }}_{{ (item.ip | checksum | regex_replace('[0-9]', ''))[-5:] | upper }}" - guest_id: "{{ item.guest_id }}" - hardware: - memory_mb: 8192 - num_cpus: 4 - disk: - - size_gb: 50 - type: thin - datastore: "{{ hv.datastore }}" - networks: - - name: "{{ hv.network }}" - ip: "{{ item.ip | ansible.utils.ipaddr('address') }}" - netmask: "{{ item.ip | ansible.utils.ipaddr('netmask') }}" - cdrom: - - type: iso - iso_path: "[{{ hv.isodatastore }}] {{ item.iso_path }}" - controller_number: 0 - unit_number: 0 - state: poweredon + ovf: "https://{{ repo_username }}:{{ repo_password }}@sn.itch.fyi/Repository/rel/Ubuntu-Server-20.04.ova" + name: "{{ kubernetes.clustername | upper }}_{{ (item.ip | checksum)[-5:] | upper }}" +# guest_id: "{{ item.guest_id }}" +# hardware: +# memory_mb: 8192 +# num_cpus: 4 +# disk: +# - size_gb: 50 +# type: thin + datastore: "{{ hv.datastore }}" +# networks: +# - name: "{{ hv.network }}" +# ip: "{{ item.ip | ansible.utils.ipaddr('address') }}" +# netmask: "{{ item.ip | ansible.utils.ipaddr('netmask') }}" +# cdrom: +# - type: iso +# iso_path: "[{{ hv.isodatastore }}] {{ item.iso_path }}" +# controller_number: 0 +# unit_number: 0 +# state: poweredon + power_on: yes # customization_spec: "{{ customization_spec }}" delegate_to: localhost with_items: "{{ servers }}"