Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Add RHV as a provider #347

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Building masters and master disks
jeffcpullen committed Dec 6, 2018
commit 66232d84fa86529d6a9b0b89ded7a031e0f500dd
Original file line number Diff line number Diff line change
@@ -38,6 +38,8 @@ cloud_infrastructure:
root_volume_size: <REPLACE WITH THE SIZE (Gi) FOR ROOT POOL DEVICE>
rhv_storage_domain: <REPLACE WITH THE STORAGE DOMAIN TO USE FOR DOCKER STORAGE>
docker_volume_size: <REPLACE WITH THE SIZE (Gi) FOR DOCKER POOL DEVICE>
etcd_storage_domain: <REPLACE WITH THE STORAGE DOMAIN TO USE FOR ETCD STORAGE>
etcd_volume_size: <REPLACE WITH THE SIZE (Gi) FOR ETCD POOL DEVICE>
etcdnodes:
count: <REPLACE WITH NUMBER OF INSTANCES TO CREATE>
flavor: <REPLACE WITH DESIRED FLAVOR FOR THE INSTANCE>
Empty file modified inventory/scripts/ovirt4.py
100644 → 100755
Empty file.
22 changes: 22 additions & 0 deletions playbooks/openshift/rhv/provision.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
- hosts: localhost
roles:
- { role: manage-rhv-infra, action: 'present' }

- name: Refresh Server inventory
hosts: localhost
connection: local
gather_facts: False
tasks:
- meta: refresh_inventory

- name: Wait for systems to become reachable
hosts: cluster_hosts
gather_facts: False
tasks:
- name: Debug hostvar
debug:
msg: "{{ hostvars[inventory_hostname] }}"
verbosity: 2
- wait_for_connection:
timeout: 300
1 change: 1 addition & 0 deletions playbooks/openshift/rhv/roles
28 changes: 21 additions & 7 deletions roles/manage-rhv-infra/tasks/create-vms.yml
Original file line number Diff line number Diff line change
@@ -16,31 +16,44 @@
with_sequence: count={{ cloud_infrastructure.masters.count }}
when: cloud_infrastructure.masters.count > 0
register: masters_ip
failed_when: masters_ip.stdout == "" or masters_ip.rc == 1

- name: Debug masters_ip
debug:
var: masters_ip

#- name: Print masters_ip test
# debug:
# msg: "{{ masters_ip['results'][1]['stdout'] }}"


- name: Validate and store OpenShift Etcd IPs
command: "dig +short {{ cloud_infrastructure.etcdnodes.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"
with_sequence: count={{ cloud_infrastructure.etcdnodes.count }}
when: cloud_infrastructure.etcdnodes.count > 0
register: etcdnodes_ip
failed_when: etcdnodes_ip.stdout == "" or etcdnodes_ip.rc == 1

- name: Validate and store OpenShift Infra IPs
command: "dig +short {{ cloud_infrastructure.infranodes.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"
with_sequence: count={{ cloud_infrastructure.infranodes.count }}
when: cloud_infrastructure.infranodes.count > 0
register: infranodes_ip
failed_when: infranodes_ip.stdout == "" or infranodes_ip.rc == 1

- name: Validate and store OpenShift App Nodes IPs
command: "dig +short {{ cloud_infrastructure.appnodes.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"
with_sequence: count={{ cloud_infrastructure.appnodes.count }}
when: cloud_infrastructure.appnodes.count > 0
register: appnodes_ip
failed_when: appnodes_ip.stdout == "" or appnodes_ip.rc == 1

- name: Validate and store OpenShift CNS Nodes IPs
command: "dig +short {{ cloud_infrastructure.cnsnodes.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"
with_sequence: count={{ cloud_infrastructure.cnsnodes.count }}
when: cloud_infrastructure.cnsnodes.count > 0
register: cnsnodes_ip
failed_when: cnsnodes_ip.stdout == "" or cnsnodes_ip.rc == 1

## Create the VMs
- name: Obtain SSO token
@@ -54,25 +67,26 @@
### Creates the Masters
- name: Create OCP Master Virtual Machines from template
ovirt_vms:
state: running
name: "{{ cloud_infrastructure.masters.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"
template: "{{ cloud_infrastructure.masters.flavor }}"
template: "{{ cloud_infrastructure.masters.template_name }}"
state: running
cluster: "{{ cloud_infrastructure.masters.rhv_cluster }}"
cpu_cores: "2"
memory: "2048Mib"
wait: True
storage_domain: "{{ cloud_infrastructure.masters.docker_storage_domain }}"
cloud_init:
host_name: "{{ cloud_infrastructure.masters.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"
dns_search: "{{ dns_domain }}"
nic_boot_protocol: static
nic_ip_address: "{{ masters_ip[item].stdout }}"
nic_ip_address: "{{ masters_ip['results'][item|int -1]['stdout'] }}"
nic_netmask: "{{ cloud_infrastructure.masters.network_netmask }}"
nic_gateway: "{{ cloud_infrastructure.masters.network_gateway }}"
nic_name: "{{ cloud_infrastructure.masters.network_nic_name }}"
nic_on_boot: true
with_sequence: count={{ cloud_infrastructure.masters.count }}

- name: Create OCP Master Docker disk
ovirt_disks:
ovirt_disk:
name: "{{ cloud_infrastructure.masters.name_prefix }}-{{ item }}-{{ env_id }}-docker-disk"
vm_name: "{{ cloud_infrastructure.masters.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"
storage_domain: "{{ cloud_infrastructure.masters.docker_storage_domain }}"
@@ -82,10 +96,10 @@
with_sequence: count={{ cloud_infrastructure.masters.count }}

- name: Create OCP Master Etcd disk
ovirt_disks:
ovirt_disk:
name: "{{ cloud_infrastructure.masters.name_prefix }}-{{ item }}-{{ env_id }}-etcd-disk"
vm_name: "{{ cloud_infrastructure.masters.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"
storage_domain: "{{ storage_domain }}"
storage_domain: "{{ cloud_infrastructure.masters.etcd_storage_domain }}"
size: "{{ cloud_infrastructure.masters.etcd_volume_size }}"
format: cow
interface: virtio
4 changes: 4 additions & 0 deletions roles/manage-rhv-infra/tasks/display-expected-dns.yml
Original file line number Diff line number Diff line change
@@ -9,6 +9,10 @@
debug:
msg: "{{ openshift_master_cluster_public_hostname }}"

- name: Display expected OpenShift Internal Cluster LB that must exist in DNS
debug:
msg: "{{ openshift_master_cluster_hostname }}"

- name: Display expected Master DNS entries that must exist prior to execution
debug:
msg: "{{ cloud_infrastructure.masters.name_prefix }}-{{ item }}.{{ env_id }}.{{ dns_domain }}"