-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
937102f
commit 769ae8d
Showing
1 changed file
with
110 additions
and
0 deletions.
There are no files selected for viewing
110 changes: 110 additions & 0 deletions
110
ci/run_airgap_rancher_and_airgap_harvester_install_test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
--- | ||
- name: Run Airgap Rancher and Airgap Harvester Installation Test | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
|
||
vars: | ||
REPO: "{{ harvester_installer_repo_name | default('irishgordo/harvester-installer') }}" | ||
|
||
tasks: | ||
- name: Make sure WORKSPACE is defined | ||
fail: | ||
msg: "Variable WORKSPACE is not defined." | ||
when: WORKSPACE is not defined | ||
|
||
- name: Check for harvester-installer | ||
stat: | ||
path: "{{ WORKSPACE }}/harvester-installer" | ||
register: harvester_installer_dir_check_result | ||
|
||
- name: Make sure harvester-installer directory exist | ||
fail: | ||
msg: "{{ WORKSPACE }}/harvester-installer not found" | ||
when: not harvester_installer_dir_check_result.stat.exists | ||
|
||
- name: Build harvester-installer artifacts | ||
shell: > | ||
make | ||
args: | ||
chdir: "{{ WORKSPACE }}/harvester-installer" | ||
retries: 5 | ||
delay: 20 | ||
register: shell_result | ||
until: shell_result.rc == 0 | ||
|
||
- name: Check for existing environment | ||
stat: | ||
path: "{{ WORKSPACE }}/ipxe-examples" | ||
register: check_ipxe_examples_result | ||
|
||
- name: Cleanup vagrants | ||
shell: > | ||
vagrant destroy -f | ||
args: | ||
chdir: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester" | ||
when: check_ipxe_examples_result.stat.exists | ||
|
||
- name: Cleanup ipxe-examples dir | ||
file: | ||
path: "{{ WORKSPACE }}/ipxe-examples" | ||
state: absent | ||
|
||
- name: Clone ipxe-examples repo | ||
git: | ||
repo: https://github.com/harvester/ipxe-examples.git | ||
version: main | ||
dest: "{{ WORKSPACE }}/ipxe-examples" | ||
|
||
- name: Check to see if "/usr/share/qemu/OVMF.fd" exist | ||
stat: | ||
path: /usr/share/qemu/OVMF.fd | ||
register: file_ovmf_fd_check_result | ||
|
||
- name: Remove OVMF.fd line if needed | ||
lineinfile: | ||
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/Vagrantfile" | ||
regexp: '.*\/OVMF\.fd.*' | ||
state: absent | ||
when: not file_ovmf_fd_check_result.stat.exists | ||
|
||
- name: Set harvester_iso_url | ||
replace: | ||
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/settings.yml" | ||
regexp: "^harvester_iso_url:.*" | ||
replace: "harvester_iso_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-amd64.iso" | ||
|
||
- name: Set harvester_kernel_url | ||
replace: | ||
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/settings.yml" | ||
regexp: "^harvester_kernel_url:.*" | ||
replace: "harvester_kernel_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-vmlinuz-amd64" | ||
|
||
- name: Set harvester_ramdisk_url | ||
replace: | ||
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/settings.yml" | ||
regexp: "^harvester_ramdisk_url:.*" | ||
replace: "harvester_ramdisk_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-initrd-amd64" | ||
|
||
- name: Set harvester_rootfs_url | ||
replace: | ||
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/settings.yml" | ||
regexp: "^harvester_rootfs_url:.*" | ||
replace: "harvester_rootfs_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-rootfs-amd64.squashfs" | ||
|
||
- name: Run setup Harvester | ||
shell: > | ||
./setup_harvester.sh -c -s /var/lib/jenkins/.ssh/known_hosts | ||
register: setup_harvester_result | ||
args: | ||
chdir: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester" | ||
ignore_errors: yes | ||
|
||
- name: Print Harvester installation output | ||
debug: | ||
msg: "{{ setup_harvester_result.stdout_lines }}" | ||
|
||
- name: Check result | ||
fail: | ||
msg: "ERROR: {{ setup_harvester_result.stderr }}" | ||
when: setup_harvester_result.failed |