2022-04-18 10:58:57 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
2022-04-19 07:10:44 +00:00
|
|
|
name: 'Provision K3s cluster'
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: scratch
|
|
|
|
claim:
|
|
|
|
name: flexvolsmb-drone-scratch
|
2022-04-18 10:58:57 +00:00
|
|
|
|
|
|
|
steps:
|
2022-04-19 07:10:44 +00:00
|
|
|
- name: Run Ansible playbook
|
2022-04-18 10:58:57 +00:00
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
2022-04-18 12:51:55 +00:00
|
|
|
pull: always
|
2022-04-18 10:58:57 +00:00
|
|
|
commands:
|
2022-04-18 12:28:05 +00:00
|
|
|
# - |
|
|
|
|
# mkdir ~/.ssh && \
|
|
|
|
# echo "$${private_key}" > ~/.ssh/id_rsa && \
|
|
|
|
# chmod 0600 ~/.ssh/id_rsa
|
2022-04-18 10:58:57 +00:00
|
|
|
- ansible-galaxy collection install -r requirements.yml
|
|
|
|
- |
|
|
|
|
ansible-playbook \
|
2022-04-18 21:15:51 +00:00
|
|
|
--extra-vars "repo_username=$${repo_username} repo_password=$${repo_password} hv_password=$${hv_password} root_password=$${root_password}" \
|
2022-04-18 10:58:57 +00:00
|
|
|
playbook.yml
|
|
|
|
environment:
|
2022-04-18 20:49:50 +00:00
|
|
|
repo_username:
|
|
|
|
from_secret: repo_username
|
|
|
|
repo_password:
|
|
|
|
from_secret: repo_password
|
2022-04-18 12:28:05 +00:00
|
|
|
hv_password:
|
|
|
|
from_secret: hv_password
|
2022-04-18 21:15:51 +00:00
|
|
|
root_password:
|
|
|
|
from_secret: root_password
|
2022-04-18 12:28:05 +00:00
|
|
|
# private_key:
|
|
|
|
# from_secret: ssh_privatekey
|
2022-04-19 07:10:44 +00:00
|
|
|
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
|
|
|
|
|