This commit is contained in:
Danny Bessems 2022-04-18 12:58:57 +02:00
commit 01c3e079d8
2 changed files with 45 additions and 0 deletions

25
.drone.yml Normal file
View File

@ -0,0 +1,25 @@
kind: pipeline
type: kubernetes
name: k3s_cluster
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
- ansible-galaxy collection install -r requirements.yml
- |
ansible-playbook \
# --inventory inventory.yml \
--extra-vars "cifs_username=$${cifs_username} cifs_password=$${cifs_password}" \
playbook.yml
environment:
cifs_username:
from_secret: cifs_username
cifs_password:
from_secret: cifs_password
private_key:
from_secret: ssh_privatekey

20
playbook.yml Normal file
View File

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