-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3924 from gekorob/ovirt_upi_basic_installation
Ovirt upi basic installation
- Loading branch information
Showing
10 changed files
with
312 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,17 @@ | ||
# oVirt/RHV User Provided Infrastructure | ||
|
||
This folder contains the Ansible scripts to help automate as possible the UPI installation process. | ||
This folder contains the Ansible scripts to help automate as possible the oVirt/RHV UPI | ||
in a step by step installation process documented [here](../../docs/users/ovirt/install_upi.md). | ||
|
||
## Getting started | ||
|
||
Inspect and customize the [inventory.yml](./inventory.yml) variables. | ||
|
||
Execute every step of the installation like below: | ||
|
||
```sh | ||
$ ansible-playbook -i inventory.yml bootstrap.yml | ||
``` | ||
|
||
Please refer to the [oVirt/RHV documentation](../../docs/users/ovirt/install_upi.md) | ||
for the full step-by-step process. |
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,20 @@ | ||
--- | ||
- hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
|
||
tasks: | ||
- import_tasks: common-auth.yml | ||
|
||
- name: Start bootstrap VM | ||
ovirt_vm: | ||
auth: "{{ ovirt_auth }}" | ||
cluster: "{{ item.profile.cluster }}" | ||
name: "{{ item.name }}" | ||
state: running | ||
cloud_init_persist: True | ||
cloud_init: | ||
custom_script: "{{ lookup('file', ocp.assets_dir+'/'+item.ocp_type+'.ign') | string }}" | ||
with_items: | ||
- "{{ vms }}" | ||
when: item.ocp_type == 'bootstrap' |
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,32 @@ | ||
--- | ||
- name: include metadata.json vars | ||
include_vars: | ||
file: "{{ ocp.assets_dir }}/metadata.json" | ||
name: metadata | ||
|
||
- name: Include ocp ovirt conf variables | ||
include_vars: | ||
file: "{{ ocp.ovirt_config_path }}" | ||
name: ocp_ovirt | ||
|
||
# check the CA stuff from the installer | ||
- name: Set ovirt CA file path | ||
set_fact: | ||
ovirt_ca_file: "/tmp/ca_file" | ||
when: (ocp_ovirt.ovirt_ca_bundle is defined) | ||
|
||
- name: Write cafile | ||
copy: | ||
content: "{{ ocp_ovirt.ovirt_ca_bundle }}" | ||
dest: "{{ ovirt_ca_file }}" | ||
force: no | ||
when: ovirt_ca_file is defined | ||
|
||
- name: Login to oVirt engine | ||
ovirt_auth: | ||
url: "{{ ocp_ovirt.ovirt_url}}" | ||
username: "{{ ocp_ovirt.ovirt_username }}" | ||
password: "{{ ocp_ovirt.ovirt_password }}" | ||
ca_file: "{{ ovirt_ca_file | default(omit) }}" | ||
insecure: "{{ ocp_ovirt.insecure | default(False) }}" | ||
register: ovirt_loggedin |
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,71 @@ | ||
--- | ||
- hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
|
||
tasks: | ||
- import_tasks: common-auth.yml | ||
|
||
- name: Check local image existance | ||
stat: | ||
get_mime: no | ||
get_checksum: no | ||
get_attributes: no | ||
path: "{{ rhcos.local_image_path }}" | ||
register: image_stats | ||
|
||
- name: Download RHCOS image | ||
get_url: | ||
url: "{{ rhcos.image_url }}" | ||
dest: "{{ rhcos.local_cmp_image_path}}" | ||
force: no | ||
|
||
- name: Extract RHCOS image | ||
shell: "gunzip -c {{ rhcos.local_cmp_image_path }} > {{ rhcos.local_image_path }}" | ||
when: not image_stats.stat.exists | ||
|
||
- name: Get templates info | ||
ovirt_template_info: | ||
auth: "{{ ovirt_auth }}" | ||
pattern: name={{ item.template }} and cluster={{ item.cluster }} | ||
register: templates_info | ||
loop: | ||
- "{{ control_plane }}" | ||
- "{{ compute }}" | ||
|
||
- name: Templates list | ||
set_fact: | ||
templates_list: >- | ||
{{ | ||
templates_list | default([]) + | ||
[ | ||
item.ovirt_templates | map(attribute='name') | list | ||
] | ||
}} | ||
with_items: "{{ templates_info.results }}" | ||
|
||
- name: Create templates | ||
include_role: | ||
name: ovirt.image-template | ||
vars: | ||
qcow_url: "file://{{ rhcos.local_image_path }}" | ||
image_path: "{{ rhcos.local_image_path }}" | ||
template_cluster: "{{ item.cluster }}" | ||
template_name: "{{ item.template }}" | ||
template_cpu: "{{ item.cores }}" | ||
template_memory: "{{ item.memory }}" | ||
template_memory_guaranteed: "{{ item.memory_guaranteed | default(omit) }}" | ||
template_disk_size: "{{ item.disks.0.size}}" | ||
template_disk_interface: "{{ item.disks.0.interface }}" | ||
template_disk_storage: "{{ item.disks.0.storage_domain }}" | ||
template_operating_system: "{{ item.operating_system }}" | ||
template_type: "{{ item.type }}" | ||
template_seal: no | ||
loop: | ||
- "{{ control_plane }}" | ||
- "{{ compute }}" | ||
when: item.template not in templates_list | ||
|
||
- name: Create VMs infra | ||
include_role: | ||
name: ovirt.vm-infra |
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,83 @@ | ||
--- | ||
all: | ||
vars: | ||
ovirt_cluster: "Default" | ||
|
||
ocp: | ||
assets_dir: "./wrk" | ||
ovirt_config_path: "{{ lookup('env', 'HOME') }}/.ovirt/ovirt-config.yaml" | ||
|
||
rhcos: | ||
image_url: "https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/pre-release/latest-4.6/rhcos-4.6.0-0.nightly-2020-07-16-122837-x86_64-openstack.x86_64.qcow2.gz" | ||
local_cmp_image_path: "/tmp/rhcos.qcow2.gz" | ||
local_image_path: "/tmp/rhcos.qcow2" | ||
|
||
control_plane: | ||
cluster: "{{ ovirt_cluster }}" | ||
memory: 16GiB | ||
sockets: 4 | ||
cores: 1 | ||
template: rhcos_tpl | ||
operating_system: "rhcos_x64" | ||
type: high_performance | ||
graphical_console: | ||
headless_mode: false | ||
protocol: | ||
- spice | ||
- vnc | ||
disks: | ||
- size: 120GiB | ||
name: os | ||
interface: virtio_scsi | ||
storage_domain: depot_nvme | ||
nics: | ||
- name: nic1 | ||
network: lab | ||
profile: lab | ||
|
||
compute: | ||
cluster: "{{ ovirt_cluster }}" | ||
memory: 16GiB | ||
sockets: 4 | ||
cores: 1 | ||
template: worker_rhcos_tpl | ||
operating_system: "rhcos_x64" | ||
type: high_performance | ||
graphical_console: | ||
headless_mode: false | ||
protocol: | ||
- spice | ||
- vnc | ||
disks: | ||
- size: 120GiB | ||
name: os | ||
interface: virtio_scsi | ||
storage_domain: depot_nvme | ||
nics: | ||
- name: nic1 | ||
network: lab | ||
profile: lab | ||
|
||
vms: | ||
- name: "{{ metadata.infraID }}-bootstrap" | ||
ocp_type: bootstrap | ||
profile: "{{ control_plane }}" | ||
type: server | ||
- name: "{{ metadata.infraID }}-master0" | ||
ocp_type: master | ||
profile: "{{ control_plane }}" | ||
- name: "{{ metadata.infraID }}-master1" | ||
ocp_type: master | ||
profile: "{{ control_plane }}" | ||
- name: "{{ metadata.infraID }}-master2" | ||
ocp_type: master | ||
profile: "{{ control_plane }}" | ||
- name: "{{ metadata.infraID }}-worker0" | ||
ocp_type: worker | ||
profile: "{{ compute }}" | ||
- name: "{{ metadata.infraID }}-worker1" | ||
ocp_type: worker | ||
profile: "{{ compute }}" | ||
- name: "{{ metadata.infraID }}-worker2" | ||
ocp_type: worker | ||
profile: "{{ compute }}" |
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,20 @@ | ||
--- | ||
- hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
|
||
tasks: | ||
- import_tasks: common-auth.yml | ||
|
||
- name: Start masters VM | ||
ovirt_vm: | ||
auth: "{{ ovirt_auth }}" | ||
cluster: "{{ item.profile.cluster }}" | ||
name: "{{ item.name }}" | ||
state: running | ||
cloud_init_persist: True | ||
cloud_init: | ||
custom_script: "{{ lookup('file', ocp.assets_dir+'/'+item.ocp_type+'.ign') | string }}" | ||
with_items: | ||
- "{{ vms }}" | ||
when: item.ocp_type == 'master' |
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,17 @@ | ||
--- | ||
- hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
|
||
tasks: | ||
- import_tasks: common-auth.yml | ||
|
||
- name: Remove bootstrap VM | ||
ovirt_vm: | ||
auth: "{{ ovirt_auth }}" | ||
cluster: "{{ item.profile.cluster }}" | ||
name: "{{ item.name }}" | ||
state: absent | ||
with_items: | ||
- "{{ vms }}" | ||
when: item.ocp_type == 'bootstrap' |
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,17 @@ | ||
--- | ||
- hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
|
||
tasks: | ||
- import_tasks: common-auth.yml | ||
|
||
- name: Remove master VMs | ||
ovirt_vm: | ||
auth: "{{ ovirt_auth }}" | ||
cluster: "{{ item.profile.cluster }}" | ||
name: "{{ item.name }}" | ||
state: absent | ||
with_items: | ||
- "{{ vms }}" | ||
when: item.ocp_type == 'master' |
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,17 @@ | ||
--- | ||
- hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
|
||
tasks: | ||
- import_tasks: common-auth.yml | ||
|
||
- name: Remove workers VMs | ||
ovirt_vm: | ||
auth: "{{ ovirt_auth }}" | ||
cluster: "{{ item.profile.cluster }}" | ||
name: "{{ item.name }}" | ||
state: absent | ||
with_items: | ||
- "{{ vms }}" | ||
when: item.ocp_type == 'worker' |
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,20 @@ | ||
--- | ||
- hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
|
||
tasks: | ||
- import_tasks: common-auth.yml | ||
|
||
- name: Start workers VM | ||
ovirt_vm: | ||
auth: "{{ ovirt_auth }}" | ||
cluster: "{{ item.profile.cluster }}" | ||
name: "{{ item.name }}" | ||
state: running | ||
cloud_init_persist: True | ||
cloud_init: | ||
custom_script: "{{ lookup('file', ocp.assets_dir+'/'+item.ocp_type+'.ign') | string }}" | ||
with_items: | ||
- "{{ vms }}" | ||
when: item.ocp_type == 'worker' |