forked from openshift/openshift-ansible
-
Notifications
You must be signed in to change notification settings - Fork 8
How to Integrate Contrail Playbooks to an existing openshift ansible deployer
vinarao edited this page Sep 25, 2018
·
6 revisions
Disclaimer1 : This document is validated for OSE3.9 and will not work for other OSE version. Please contact the author incase you need support for other OSE versions
Disclaimer2: > This is document enlist steps for fresh deployments of OSE3.9 with contrail.
1> Clone the Openshift 3.9 Deployer from the Juniper git repo to a new directory (say foo)
2> Now copy contrail_master and contrail_nodes folder from the foo/openshift-ansible/roles directory to the roles directory of your openshift-ansible deployer
cp -r foo/openshift-ansible/roles/contrail_master my_openshift-ansible/roles/.
cp -r foo/openshift-ansible/roles/contrail_node my_openshift-ansible/roles/.
3> Now add the following Patch to openshift_master playbook to ensure the contrail_master role gets executed
file openshift-ansible/playbooks/openshift-master/private/config.yml
>>> Snippet of Code to be added >>>
>>>- role: calico_master
>>> when: openshift_use_calico | default(false) | bool
- role: contrail_master
when: openshift_use_contrail | default(false) | bool
```
4> Similarly add the contrail_nodes role to the openshift_nodes playbook
```
file openshift-ansible/playbooks/openshift-node/private/additional_config.yml
>>Snippet pf code to be added >>>>
>>> # Create group for kuryr nodes
>>> - group_by:
>>> key: oo_nodes_use_{{ (openshift_use_kuryr | default(False)) | ternary('kuryr','nothing') }}
>>> changed_when: False
# Create group for contrail nodes
- group_by:
key: oo_nodes_use_{{ (openshift_use_contrail | default(False)) | ternary('contrail','nothing') }}
changed_when: False
>>> name: kuryr
>>> tasks_from: node
>>> when: openshift_use_kuryr | default(false) | bool
- name: Additional node config
hosts: oo_nodes_use_contrail
roles:
- role: contrail_node
contrail_master: "{{ groups.masters.0 }}"
when: openshift_use_contrail | default(false) | bool
```
5> Now update the ose-intall (Openshift Inventory to include contrail Parameters for installation)
```
openshift_use_contrail=true
contrail_version=5.0
contrail_container_tag=ocata-5.0-156
contrail_registry_insecure=true
contrail_registry=ci-repo.englab.juniper.net:5000
# Username /Password for private Docker regiteries
#contrail_registry_username=test
#contrail_registry_password=test
# Below option presides over contrail masters if set
#vrouter_physical_interface=ens160
contrail_vip=10.87.65.48
vrouter_gateway=10.87.65.126
#docker_version=1.13.1
# Contrail_vars
#kubernetes_api_server=10.87.65.48
#kubernetes_api_port=8080
#kubernetes_api_secure_port=8443
#cluster_name=k8s
#cluster_project={}
#cluster_network={}
#pod_subnets=10.32.0.0/12
#ip_fabric_subnets=10.64.0.0/12
#service_subnets=10.96.0.0/12
#ip_fabric_forwarding=false
#ip_fabric_snat=false
#public_fip_pool={}
#vnc_endpoint_ip=20.1.1.1
#vnc_endpoint_port=8082
# contrail physical interface will be chosen based on reachability to these controllers
# if vrouter_physical_interface is not set.
#contrail_controllers=20.1.1.1,30.1.1.1
#Nested mode vars
#nested_mode_contrail=true
#auth_mode=keystone
#keystone_auth_host=192.168.24.12
#keystone_auth_admin_tenant=admin
#keystone_auth_admin_user=admin
#keystone_auth_admin_password=MAYffWrX7ZpPrV2AMAa9zAUvG
#keystone_auth_admin_port=35357
#keystone_auth_url_version=/v3
#k8s_nested_vrouter_vip=1.1.1.1
#k8s_vip=192.168.1.3
#cluster_network="{'domain': 'default-domain', 'project': 'admin', 'name': 'net1'}"
[masters]
10.87.65.48 openshift_hostname=openshift-master
[etcd]
10.87.65.48 openshift_hostname=openshift-master
[nodes]
10.87.65.48 openshift_hostname=openshift-master
10.87.65.49 openshift_hostname=openshift-slave
[openshift_ca]
10.87.65.48 openshift_hostname=openshift-master
```
6> Update the ose-pre-requisite file (Add all the contrail pre-req to the ose-prerequisite file)
```
---
- hosts: localhost
tasks:
- name: check ansible version for ansible == 2.5.2
assert:
that:
- ansible_version.major == 2
- ansible_version.minor == 5
- ansible_version.revision == 2
msg: "You must install Ansible 2.5.2 to continue"
- hosts: OSEv3
tasks:
- name: Install base packages
yum: name="{{ item }}" state=present
with_items:
- wget
- net-tools
- bind-utils
- iptables-services
- bridge-utils
- bash-completion
- git
- python-pip
- kexec-tools
- sos
- psacct
- ntp
- name: Install Openshift Enterprise package
yum: name="{{ item }}" state=present
with_items:
- atomic-openshift-docker-excluder
when:
- deployment_type == "openshift-enterprise"
- name: Install docker-py
command: pip install docker-py
when:
- deployment_type == "openshift-enterprise"
- fail:
msg: "Need a higher version of docker"
when:
- docker_version is defined
- "{{ docker_version is version('1.13.1', '<') }}"
- name: install docker
yum:
name: "docker-{{ docker_version | default('1.13.1')}}"
state: installed
- name: Enable Docker Service
service: name=docker enabled=yes
- name: Start Docker Service
service: name=docker state=started
- name: Start Ntp Service
service: name=ntpd state=started
```
Copyright (c) 2018 Juniper Networks, Inc. All rights reserved