Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ansible.python.interpreterPath": "/bin/python"
}
4 changes: 2 additions & 2 deletions add_repo.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
- name: Run rhc connect command
hosts: all
hosts: "{{ hostname_repos }}"
gather_facts: false
become: true

tasks:
- name: Execute rhc connect command
ansible.builtin.command: "rhc connect --organization {{ org_id }} --activation-key {{ key }}"
no_log: true
no_log: false
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# defaults file for providers

provider_name: "vmware"
provider_namespace: "openshift-mtv"
vmware_credentials: "vmware-credentials"
provider_name: "vsphere"
provider_namespace: "vm"
vmware_credentials: "vsphere-creds"
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
apiVersion: forklift.konveyor.io/v1beta1
kind: Provider
metadata:
name: "{{ provider_name }}"
namespace: "{{ provider_namespace }}"
name: vsphere
namespace: vm
spec:
secret:
name: "{{ vmware_credentials }}"
namespace: "{{ provider_namespace }}"
name: vsphere-creds
namespace: vm
settings:
vddkInitImage: 'image-registry.openshift-image-registry.svc:5000/openshift/vddk:latest'
sdkEndpoint: vcenter
vddkInitImage: 'quay.io/wmarx/vddk:latest'
type: vsphere
url: 'https://{{ vmware_host }}/sdk'
url: 'https://vcsnsx-vc.infra.demo.redhat.com/sdk'

Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
---
# vars file for providers
vmware_host: vcsnsx-vc.infra.demo.redhat.com
migration_namespace: vm
provider_name: vsphere
provider_namespace: vm
vmware_credentials: vsphere-creds
migration_target_namespace: vm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- name: Get OCP version and check if it's 4.12 or higher
- name: Get OCP version and check if it's 4.17 or higher
kubernetes.core.k8s_info:
api_version: config.openshift.io/v1
kind: ClusterVersion
register: ocp_version
failed_when: ocp_version.resources[0].status.desired.version is version('4.12', '<')
failed_when: ocp_version.resources[0].status.desired.version is version('4.17', '<')

- name: Print OCP version
ansible.builtin.debug:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
---
# vars file for validation
vmware_host: vcsnsx-vc.infra.demo.redhat.com
migration_namespace: vm
provider_name: vsphere
provider_namespace: vm
vmware_credentials: vsphere-creds
migration_target_namespace: vm
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# defaults file for virt-plan
random_suffix_network: "{{ lookup('community.general.random_string', length=5, special=false, upper=false) }}"
random_suffix_storage: "{{ lookup('community.general.random_string', length=5, special=false, upper=false) }}"
migration_namespace: "openshift-mtv"
migration_target_namespace: "openshift-mtv"
migration_namespace: "vm"
migration_target_namespace: "vm"
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
kind: NetworkMap
metadata:
name: "{{ networkmap_name }}"
namespace: "{{ migration_namespace }}" # openshift-mtv
namespace: "{{ migration_namespace }}" # vm
spec:
map:
- destination:
Expand All @@ -62,11 +62,11 @@
id: "{{ portgroup_id }}"
provider:
destination:
name: host
namespace: "{{ migration_namespace }}" # openshift-mtv
name: ocpv-local
namespace: vm
source:
name: vmware
namespace: "{{ migration_namespace }}" #openshift-mtv
name: vsphere
namespace: vm

- name: Build a list of all the datastores
vmware.vmware_rest.vcenter_datastore_info:
Expand All @@ -84,7 +84,7 @@
# kind: StorageMap
# metadata:
# name: "{{ storagemap_name }}"
# namespace: "{{ migration_namespace }}"
# namespace: "{{ }}"
# spec:
# map:
# - destination:
Expand All @@ -93,11 +93,11 @@
# id: "{{ datastore_id }}"
# provider:
# destination:
# name: host
# namespace: "{{ migration_namespace }}"
# name: ocpv-local
# namespace: "{{ }}"
# source:
# name: vmware
# namespace: "{{ migration_namespace }}"
# namespace: "{{ }}"

- name: Get storage class information
kubernetes.core.k8s_info:
Expand All @@ -120,7 +120,7 @@

- name: Create or update a StorageMap
kubernetes.core.k8s:
namespace: "{{ migration_namespace }}"
namespace: vm
definition: "{{ lookup('template', 'datastore.yaml.j2' ) | from_yaml }}"
state: present

Expand All @@ -132,24 +132,24 @@
kind: Plan
metadata:
name: "{{ plan_name }}"
namespace: "{{ migration_namespace }}"
namespace: vm
spec:
archived: false
description: ''
map:
network:
name: "{{ networkmap_name }}"
namespace: "{{ migration_namespace }}"
namespace: vm
storage:
name: "{{ storagemap_name }}"
namespace: "{{ migration_namespace }}"
namespace: vm
provider:
destination:
name: host
namespace: "{{ migration_namespace }}"
name: ocpv-local
namespace: vm
source:
name: vmware
namespace: "{{ migration_namespace }}"
name: vsphere
namespace: vm
targetNamespace: "{{ migration_target_namespace }}"
vms: "{{ vms_for_plan_spec }}"
warm: false
Expand All @@ -158,12 +158,12 @@
kubernetes.core.k8s:
api_version: forklift.konveyor.io/v1beta1
kind: Migration
namespace: "{{ migration_namespace }}"
namespace: vm
name: "{{ plan_name }}"
definition:
metadata:
name: "{{ plan_name }}"
namespace: "{{ migration_namespace }}"
namespace: vm
spec:
plan:
name: "{{ plan_name }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ spec:

provider:
destination:
name: host
name: ocpv-local
namespace: "{{ migration_namespace }}"
source:
name: vmware
name: vsphere
namespace: "{{ migration_namespace }}"
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
---
# vars file for virt-plan
vmware_host: vcsnsx-vc.infra.demo.redhat.com
migration_namespace: vm
provider_name: vsphere
provider_namespace: vm
vmware_credentials: vsphere-creds
migration_target_namespace: vm
3 changes: 1 addition & 2 deletions inventory.kubevirt.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
plugin: kubevirt.core.kubevirt
connections:
- use_service: False
use_service: False
2 changes: 1 addition & 1 deletion lamp_stack.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Install LAMP Stack on RHEL 9
hosts: all
hosts: "{{ install_lamp_stack }}"
become: true

tasks:
Expand Down
30 changes: 15 additions & 15 deletions provision_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,31 @@
hosts: localhost
tasks:

- name: Create the 'linuxvm' namespace
kubernetes.core.k8s:
name: linuxvm
kind: Namespace
api_version: v1
state: present
- name: Create VM
kubernetes.core.k8s:
definition:
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: "{{ item.role }}-{{ item.env }}-{{ '%02d' | format(item.id) }}"
namespace: linuxvm
#name: "rhel-9-aap-01"
namespace: vm
labels:
app: "{{ item.role }}-{{ item.env }}-{{ '%02d' | format(item.id) }}"
#app: "rhel-9-aap-01"
kubevirt.io/dynamic-credentials-support: 'true'
vm.kubevirt.io/template: rhel9-server-small
vm.kubevirt.io/template.namespace: openshift
vm.kubevirt.io/template.namespace: openshift-virtualization-os-images
vm.kubevirt.io/template.revision: '1'
vm.kubevirt.io/template.version: v0.26.0
vm.kubevirt.io/template.version: v0.34.1
spec:
running: true
dataVolumeTemplates:
- apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: "{{ item.role }}-{{ item.env }}-{{ '%02d' | format(item.id) }}"
#name: "rhel-9-aap-01"
spec:
sourceRef:
kind: DataSource
Expand All @@ -44,6 +41,7 @@
metadata:
labels:
kubevirt.io/domain: "{{ item.role }}-{{ item.env }}-{{ '%02d' | format(item.id) }}"
#kubevirt.io/domain: "rhel-9-aap-01"
kubevirt.io/size: small
spec:
architecture: amd64
Expand All @@ -62,6 +60,7 @@
name: cloudinitdisk
interfaces:
- macAddress: "02:f3:be:00:00:{{ '%02x' | format(item.id) }}"
#- macAddress: "02:f3:be:00:00:95"
masquerade: {}
model: virtio
name: default
Expand All @@ -85,12 +84,13 @@
volumes:
- dataVolume:
name: "{{ item.role }}-{{ item.env }}-{{ '%02d' | format(item.id) }}"
#name: "rhel-9-aap-01"
name: rootdisk
- cloudInitConfigDrive:
userData: |
#cloud-config
users:
- name: cloud-user
- name: wmarx
sudo: ['ALL=(ALL) NOPASSWD: ALL']
groups: wheel
shell: /bin/bash
Expand All @@ -100,13 +100,13 @@
lock_passwd: false
chpasswd:
list: |
cloud-user:{{ vm_password }}
wmarx: {{ vm_password }}
expire: False
name: cloudinitdisk
loop:
- { role: "web", env: "prod", id: 1 }
- { role: "app", env: "prod", id: 2 }
- { role: "db", env: "prod", id: 3 }
- { role: "web", env: "dev", id: 4 }
- { role: "app", env: "dev", id: 5 }
- { role: "db", env: "dev", id: 6 }
#- { role: "db", env: "prod", id: 3 }
#- { role: "web", env: "dev", id: 4 }
#- { role: "app", env: "dev", id: 5 }
#- { role: "db", env: "dev", id: 6 }