Skip to content

Instantly share code, notes, and snippets.

@rgolangh
Last active May 3, 2020 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rgolangh/adccf6d6b5eaecaebe0b0aeba9d3331b to your computer and use it in GitHub Desktop.
Save rgolangh/adccf6d6b5eaecaebe0b0aeba9d3331b to your computer and use it in GitHub Desktop.
upload rhcos image template from installer
- hosts: localhost
gather_facts: no
connection: local
vars:
# customization begin
installer: bin/openshift-installer
engine_url: https://engine-fqdn/ovirt-engine/api
engine_user: admin@internal
engine_password: 123
# download the ca pem using
# curl -k -o /tmp/ca.pem https://engine-fqdn/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA
engine_cafile: /tmp/ca.pem
engine_insecure: false
template_cluster: Default
template_name: rhcos-master
template_memory: 12GiB
template_cpu: 4
template_disk_size: 10GiB
template_disk_storage: nfs
template_seal: false
template_timeout: 600
image_download_timeout: 600
qcow_path: /tmp/rhcos.qcow2
qcow_url: file:///tmp/rhcos.qcow2
pre_tasks:
# the tasks here are for extractig the openstack qcow image
# which is pinned to the installer binary and is
# equivalent to invoking this:
# curl -s https://raw.githubusercontent.com/openshift/installer/$(openshift-install version | grep -oP '(?<=commit ).*')/data/data/rhcos.json | jq -r '.baseURI + .images.openstack.path'
- name: validate openshift-installer binary is accesible
stat:
path: "{{ installer }}"
register: result
- name: extract the intaller pinned commit
shell: "{{ installer }} version | grep -oP '(?<=commit ).*'"
register: commit
# till we have ci building images for us, using the master commit
# and not {{ commit.stdout }}
- name: extrat the rhcos url
uri:
url: "https://raw.githubusercontent.com/openshift/installer/master/data/data/rhcos.json"
register: result
- name: extract the openstack image
set_fact:
qcow_url_compressed: "{{ result.json.baseURI + result.json.images.openstack.path }}"
- name: download and uncompress
command: "curl --compressed -J -L -o {{ qcow_path }} {{ qcow_url_compressed }}"
register: download
roles:
- oVirt.image-template
@johnsimcall
Copy link

I think bin/openshift-installer is a typo and should be the default bin/openshift-install instead.

  vars:
    installer: bin/openshift-install

@rgolangh
Copy link
Author

You are right. I made this mistake early in the process when I was building the installer, and gave it the wrong name.

Anyhow these days the installer will upload the RHCOS image to your RHV cluster, so this ansible is not needed anymore.

Did you get here from some documentation?

@johnsimcall
Copy link

Yes, I got here from the step #2 of the documentation at https://github.com/openshift/installer/blob/master/docs/user/ovirt/install_ipi.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment