Add extra parameters;Refactor to different module
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Danny Bessems 2022-04-18 22:49:50 +02:00
parent 0ce6f8f876
commit 4a09b34c26
2 changed files with 29 additions and 22 deletions

View File

@ -14,9 +14,13 @@ steps:
- ansible-galaxy collection install -r requirements.yml - ansible-galaxy collection install -r requirements.yml
- | - |
ansible-playbook \ ansible-playbook \
--extra-vars "hv_password=$${hv_password}" \ --extra-vars "repo_username=$${repo_username} repo_password=$${repo_password} hv_password=$${hv_password}" \
playbook.yml playbook.yml
environment: environment:
repo_username:
from_secret: repo_username
repo_password:
from_secret: repo_password
hv_password: hv_password:
from_secret: hv_password from_secret: hv_password
# private_key: # private_key:

View File

@ -4,8 +4,9 @@
- hypervisor.vcenter.yml - hypervisor.vcenter.yml
- cluster.k3s.yml - cluster.k3s.yml
tasks: tasks:
- name: Clone multiple VMs from template - name: Deploy VMs from OVF-template
community.vmware.vmware_guest: # community.vmware.vmware_guest:
community.vmware.vmware_deploy_ovf:
hostname: "{{ hv.hostname }}" hostname: "{{ hv.hostname }}"
username: "{{ hv.username }}" username: "{{ hv.username }}"
password: "{{ hv_password }}" password: "{{ hv_password }}"
@ -13,25 +14,27 @@
datacenter: "{{ hv.datacenter }}" datacenter: "{{ hv.datacenter }}"
folder: "{{ hv.folder }}" folder: "{{ hv.folder }}"
cluster: "{{ hv.cluster }}" cluster: "{{ hv.cluster }}"
name: "{{ kubernetes.clustername | upper }}_{{ (item.ip | checksum | regex_replace('[0-9]', ''))[-5:] | upper }}" ovf: "https://{{ repo_username }}:{{ repo_password }}@sn.itch.fyi/Repository/rel/Ubuntu-Server-20.04.ova"
guest_id: "{{ item.guest_id }}" name: "{{ kubernetes.clustername | upper }}_{{ (item.ip | checksum)[-5:] | upper }}"
hardware: # guest_id: "{{ item.guest_id }}"
memory_mb: 8192 # hardware:
num_cpus: 4 # memory_mb: 8192
disk: # num_cpus: 4
- size_gb: 50 # disk:
type: thin # - size_gb: 50
datastore: "{{ hv.datastore }}" # type: thin
networks: datastore: "{{ hv.datastore }}"
- name: "{{ hv.network }}" # networks:
ip: "{{ item.ip | ansible.utils.ipaddr('address') }}" # - name: "{{ hv.network }}"
netmask: "{{ item.ip | ansible.utils.ipaddr('netmask') }}" # ip: "{{ item.ip | ansible.utils.ipaddr('address') }}"
cdrom: # netmask: "{{ item.ip | ansible.utils.ipaddr('netmask') }}"
- type: iso # cdrom:
iso_path: "[{{ hv.isodatastore }}] {{ item.iso_path }}" # - type: iso
controller_number: 0 # iso_path: "[{{ hv.isodatastore }}] {{ item.iso_path }}"
unit_number: 0 # controller_number: 0
state: poweredon # unit_number: 0
# state: poweredon
power_on: yes
# customization_spec: "{{ customization_spec }}" # customization_spec: "{{ customization_spec }}"
delegate_to: localhost delegate_to: localhost
with_items: "{{ servers }}" with_items: "{{ servers }}"