mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-09 11:47:47 +03:00
PHASE 1 - Add Packet-CI playbook and configuration (#4537)
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
78f6f6b889
commit
b834a28891
58
tests/cloud_playbooks/roles/packet-ci/tasks/create-vms.yml
Normal file
58
tests/cloud_playbooks/roles/packet-ci/tasks/create-vms.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
|
||||
- name: "Create CI namespace {{ test_name }} for test vms"
|
||||
k8s:
|
||||
name: "{{ test_name }}"
|
||||
kind: Namespace
|
||||
state: present
|
||||
register: create_ci_ns
|
||||
failed_when: create_ci_ns.changed == false
|
||||
|
||||
- name: "Create temp dir /tmp/{{ test_name }} for CI files"
|
||||
file:
|
||||
path: "/tmp/{{ test_name }}"
|
||||
state: directory
|
||||
|
||||
- name: Template vm files for CI job
|
||||
template:
|
||||
src: "vm.yml.j2"
|
||||
dest: "/tmp/{{ test_name }}/instance-{{ vm_id }}.yml"
|
||||
loop: "{{ range(0, vm_count|int, 1) | list }}"
|
||||
loop_control:
|
||||
index_var: vm_id
|
||||
|
||||
- name: Start vms for CI job
|
||||
k8s:
|
||||
state: present
|
||||
src: "/tmp/{{ test_name }}/instance-{{ vm_id }}.yml"
|
||||
loop: "{{ range(0, vm_count|int, 1) | list }}"
|
||||
loop_control:
|
||||
index_var: vm_id
|
||||
|
||||
- name: Wait for vms to have ipaddress assigned
|
||||
shell: "kubectl get vmis -n {{ test_name }} instance-{{ vm_id }} -o json | jq '.status.interfaces[].ipAddress' | tr -d '\"'"
|
||||
register: vm_ips
|
||||
loop: "{{ range(0, vm_count|int, 1) | list }}"
|
||||
loop_control:
|
||||
index_var: vm_id
|
||||
retries: 10
|
||||
delay: 15
|
||||
until:
|
||||
- vm_ips.stdout | ipaddr
|
||||
|
||||
- name: Wait for SSH to become available on vms
|
||||
wait_for:
|
||||
host: "{{ item.stdout }}"
|
||||
port: 22
|
||||
delay: 30
|
||||
timeout: 240
|
||||
state: started
|
||||
with_items:
|
||||
- "{{ vm_ips.results }}"
|
||||
|
||||
- name: "Create inventory for CI test in file /tmp/{{ test_name }}/inventory"
|
||||
template:
|
||||
src: "inventory.j2"
|
||||
dest: "{{ inventory_path }}"
|
||||
vars:
|
||||
vms: "{{ vm_ips }}"
|
||||
Reference in New Issue
Block a user