Refactor playbook structure;Update Drone configuration
continuous-integration/drone/push Build encountered an error Details

This commit is contained in:
Danny Bessems 2022-04-18 14:28:05 +02:00
parent 2f3c9fe9da
commit 6aaeee686c
5 changed files with 39 additions and 22 deletions

View File

@ -6,20 +6,18 @@ steps:
- name: Apply playbook
image: bv11-cr01.bessems.eu/library/packer-extended
commands:
- |
mkdir ~/.ssh && \
echo "$${private_key}" > ~/.ssh/id_rsa && \
chmod 0600 ~/.ssh/id_rsa
# - |
# mkdir ~/.ssh && \
# echo "$${private_key}" > ~/.ssh/id_rsa && \
# chmod 0600 ~/.ssh/id_rsa
- ansible-galaxy collection install -r requirements.yml
- |
ansible-playbook \
# --inventory inventory.yml \
--extra-vars "cifs_username=$${cifs_username} cifs_password=$${cifs_password}" \
--extra-vars "hv_password=$${hv_password}" \
playbook.yml
environment:
cifs_username:
from_secret: cifs_username
cifs_password:
from_secret: cifs_password
private_key:
from_secret: ssh_privatekey
hv_password:
from_secret: hv_password
# private_key:
# from_secret: ssh_privatekey

View File

@ -1,20 +1,21 @@
- hosts: localhost
gather_facts: false
vars_files:
multiple_vms.yml
- hypervisor.vcenter.yml
- nodes.yml
tasks:
- name: Clone multiple VMs from template
local_action:
module: vmware_guest
hostname: "{{ vcenter_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
community.vmware.vmware_guest:
hostname: "{{ hv.hostname }}"
username: "{{ hv.username }}"
password: "{{ hv_password }}"
validate_certs: no
folder: "{{ folder }}"
template: "{{ vmtemplate }}"
datacenter: "{{ hv.datacenter }}"
folder: "{{ hv.folder }}"
cluster: "{{ hv.cluster }}"
name: "{{ item.ip }}"
cluster: "{{ vmcluster }}"
datacenter: CloudLocal
template: "{{ item.template }}"
state: poweredon
customization_spec: "{{ customization_spec }}"
# customization_spec: "{{ customization_spec }}"
delegate_to: localhost
with_items: "{{ servers }}"

2
requirements.yml Normal file
View File

@ -0,0 +1,2 @@
collections:
- community.vmware

View File

@ -0,0 +1,8 @@
---
hv:
hostname: bv11-vc.bessems.lan
username: administrator@vsphere.local
datacenter: DeSchakel
folder: Temporary
datastore: NAS01.RAID5
network: LAN

8
vars/nodes.yml Normal file
View File

@ -0,0 +1,8 @@
---
servers:
- ip: 192.168.11.121
template: xyz
- ip: 192.168.11.122
template: abc
- ip: 192.168.11.123
template: pqr