From 01c3e079d86bd102b218214b26e97a8c38f1208a Mon Sep 17 00:00:00 2001 From: djpbessems Date: Mon, 18 Apr 2022 12:58:57 +0200 Subject: [PATCH] WIP #1 --- .drone.yml | 25 +++++++++++++++++++++++++ playbook.yml | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .drone.yml create mode 100644 playbook.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..8d84cef --- /dev/null +++ b/.drone.yml @@ -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 diff --git a/playbook.yml b/playbook.yml new file mode 100644 index 0000000..bfa7d7c --- /dev/null +++ b/playbook.yml @@ -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 }}"