Refactor playbook structure;Update Drone configuration
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
2f3c9fe9da
commit
6aaeee686c
20
.drone.yml
20
.drone.yml
@ -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
|
||||
|
23
playbook.yml
23
playbook.yml
@ -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
2
requirements.yml
Normal file
@ -0,0 +1,2 @@
|
||||
collections:
|
||||
- community.vmware
|
8
vars/hypervisor.vcenter.yml
Normal file
8
vars/hypervisor.vcenter.yml
Normal 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
8
vars/nodes.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user