CI: Generate ssh key pair on the fly

There is litte reason to share an ssh key common to all CI jobs, so
generate one for each on the fly.

Also use plain-text cloud-init config instead of base64 for readability
This commit is contained in:
Max Gautier
2025-03-10 22:05:34 +01:00
parent e4905f1d1d
commit 611f645907
6 changed files with 19 additions and 35 deletions

View File

@@ -3,6 +3,13 @@
include_vars: "../files/{{ ci_job_name }}.yml"
when: molecule_yml is not defined
- name: Generate SSH keypair
community.crypto.openssh_keypair:
size: 2048
path: "{{ lookup('env', 'ANSIBLE_PRIVATE_KEY_FILE') }}"
mode: '400'
register: ssh_key
- name: Start vms for CI job
kubernetes.core.k8s:
definition: "{{ lookup('template', 'vm.yml.j2', template_vars=item) }}"