Nate Stephany
2020-03-14 2158c5d1da2cb16179e12d813cf827a7e14e1191
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
= OCP Client VM (ocp-clientvm)
 
This config will deploy a simple RHEL VM to multiple cloud providers.
You can choose the cloud provider by passing in the `cloud_provider` var.
You can choose the version of RHEL by specifying the `clientvm_instance_image` var.
Other things and tools will be installed as well, which may make your life easier.
 
== Running Ansible Playbook
 
* You can run the playbook with the following arguments to overwrite the default variable values:
+
[source,bash]
----
# Generic Vars
 
GUID=sborenstest5
REGION=ap-southeast-2
KEYNAME=ocpkey
ENVTYPE="ocp-clientvm"
CLOUDPROVIDER=ec2
HOSTZONEID='Z3IHLWJZOU9SRT'
BASESUFFIX='.example.opentlc.com'
 
 
# OCP Vars
 
REPO_VERSION=3.11
OSRELEASE=3.11.16
 
ansible-playbook main.yml \
  -e "guid=${GUID}" \
  -e "env_type=${ENVTYPE}" \
  -e "osrelease=${OSRELEASE}" \
  -e "repo_version=${REPO_VERSION}" \
  -e "docker_version=1.13.1" \
  -e "cloud_provider=${CLOUDPROVIDER}" \
  -e "aws_region=${REGION}" \
  -e "HostedZoneId=${HOSTZONEID}" \
  -e "key_name=${KEYNAME}" \
  -e "subdomain_base_suffix=${BASESUFFIX}" \
  -e "clientvm_instance_type=t2.large" \
  -e "requirements_path=ansible/configs/ocp-clientvm/requirements_ruby.yml" \
  -e "email=name@example.com"  \
  -e "output_dir=/tmp/output" \
  -e "install_ruby=true"    -e "install_3scale=true" -vvvv
----
 
=== Satellite version
----
GUID=testclientvm1
REGION=us-east-1
KEYNAME=ocpkey
ENVTYPE="ocp-clientvm"
CLOUDPROVIDER=ec2
HOSTZONEID='Z186MFNM7DX4NF'
BASESUFFIX='.example.opentlc.com'
REPO_VERSION=3.9
DEPLOYER_REPO_PATH=`pwd`
 
LOG_FILE=/tmp/${ENVTYPE}-${GUID}.log
IPAPASS=$5
 
if [ "$1" = "provision" ] ; then
 
echo "Provisioning: ${STACK_NAME}"  1>> $LOG_FILE 2>> $LOG_FILE
 
ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml  \
  -e "guid=${GUID}" \
  -e "env_type=${ENVTYPE}" \
  -e "key_name=${KEYNAME}" \
  -e "cloud_provider=${CLOUDPROVIDER}" \
  -e "aws_region=${REGION}" \
  -e "HostedZoneId=${HOSTZONEID}" \
  -e "subdomain_base_suffix=${BASESUFFIX}" \
  -e "clientvm_instance_type=t2.large" \
  -e "ipa_host_password=${IPAPASS}"
  -e "repo_method=satellite" \
  -e "repo_version=${REPO_VERSION}" \
  -e "email=name@example.com" \
  -e "software_to_deploy=none" \
  -e "osrelease=3.9.14" \
  -e "docker_version=1.13.1" \
  -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE
----
 
=== To Delete an environment
----
REGION=us-east-1
KEYNAME=ocpkey
GUID=testclientvm1
ENVTYPE="ocp-clientvm"
CLOUDPROVIDER=ec2
HOSTZONEID='Z186MFNM7DX4NF'
 
ansible-playbook ./configs/${ENVTYPE}/destroy_env.yml \
 -e "guid=${GUID}" \
 -e "env_type=${ENVTYPE}"  \
 -e "cloud_provider=${CLOUDPROVIDER}" \
 -e "aws_region=${REGION}" \
 -e "HostedZoneId=${HOSTZONEID}" \
 -e "key_name=${KEYNAME}" \
 -e "subdomain_base_suffix=${BASESUFFIX}"
----
 
 
== Example RC file
 
Use a RC file like this one to create a ClientVM with the wrapper.sh script:
 
----
GUID=myclient
REGION=us-east-1
KEYNAME=ocpkey
ENVTYPE=ocp-clientvm
HOSTZONEID='Z3IHLWJZOU9SRT'
ENVTYPE_ARGS=(
-e repo_version=3.9
-e osrelease=3.9.14
-e own_repo_path=http://admin.example.com/repos/ocp/3.9.14
-e docker_version=1.13.1
-e "clientvm_instance_type=t2.large"
-e "subdomain_base_suffix=.example.opentlc.com"
)
----