54 lines
1.2 KiB
YAML
54 lines
1.2 KiB
YAML
kind: pipeline
|
|
type: kubernetes
|
|
name: 'Provision K3s cluster'
|
|
|
|
volumes:
|
|
- name: scratch
|
|
claim:
|
|
name: flexvolsmb-drone-scratch
|
|
|
|
steps:
|
|
- name: Run Ansible playbook
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
pull: always
|
|
commands:
|
|
- |
|
|
mkdir ~/.ssh && \
|
|
echo "$${private_key}" > ~/.ssh/id_rsa && \
|
|
chmod 0600 ~/.ssh/id_rsa
|
|
- ansible-galaxy collection install -r requirements.yml
|
|
- |
|
|
ansible-playbook \
|
|
--extra-vars "repo_username=$${repo_username} repo_password=$${repo_password} hv_password=$${hv_password} root_password=$${root_password} public_key='$${public_key}'" \
|
|
playbook.yml
|
|
environment:
|
|
repo_username:
|
|
from_secret: repo_username
|
|
repo_password:
|
|
from_secret: repo_password
|
|
hv_password:
|
|
from_secret: hv_password
|
|
root_password:
|
|
from_secret: root_password
|
|
private_key:
|
|
from_secret: ssh_privatekey
|
|
public_key:
|
|
from_secret: ssh_publickey
|
|
volumes:
|
|
- name: scratch
|
|
path: /scratch
|
|
- name: Remove temporary resources
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
pull: always
|
|
commands:
|
|
- |
|
|
rm /scratch/* -Rf
|
|
volumes:
|
|
- name: scratch
|
|
path: /scratch
|
|
when:
|
|
status:
|
|
- success
|
|
- failure
|
|
|