Bowe Strickland
2020-03-09 cb0b2619b9e8271f5a9b2f9b1a6b8d66ced3af9a
commit | author | age
b1c0bd 1
SB 2 == Setting up for OpenStack deployments
3
4 In this document we will explain how one could setup their laptop for AgnosticD deployment with OpenStack.
5
6 If you are a Red Hatter, you can use link::labs.opentlc.com to request access to our OpenStack cluster.
7 . Log in to link:https://labs.opentlc.com[https://labs.opentlc.com] using your opentlc user.
8 . Go to *Services* -> *Catalogs* -> *OPENTLC OpenShift 4 Labs* -> *OpenShift 4 Install VM - OpenStack*.
9 . Click *Order* -> *Submit*
10
11 NOTE: You will receive three emails indicating the status of the environment and instructions for accessing the environment.
12 In the third email you receive all information you need to login to the client machine that would have the rest of required information.
13
14 NOTE: You can use the VM as your ansible host or copy the files over to your laptop and work locally.
15
16 === Configure your environment for running OpenStack Ansible
17
18 . Install `virtualenv` and `pip3` (On your laptop or on the clientVM):
19 +
20 [source, shell]
21 ----
22 # on Linux
23 $ sudo yum install python3-pip python-virtualenv -y
24 # on Mac
25 $ brew install python pyenv-virtualenv
26 ----
27
28 . Create virtualenv environment and download python requirements:
29 +
30 [source, shell]
31 ----
32 $ virtualenv AgnosticD-OSP
33 $ source AgnosticD-OSP/bin/activate
34
35 # on Mac
36 $ pip3 install -r https://raw.githubusercontent.com/redhat-cop/agnosticd/development/ansible/configs/ocp4-disconnected-osp-lab/files/macos_requirements.txt
37
38 # on Linux
39 $ pip3 install -r https://raw.githubusercontent.com/redhat-cop/agnosticd/development/ansible/configs/ocp4-disconnected-osp-lab/files/openstack_requirements.txt
40 ----
41
42 === Getting your OpenStack Credentials
43
44 . Copy the `~/.config/openstack/clouds.yaml` file from the remote VM to your laptop (Use your user name and GUID in the commands below)
45 +
46 [source,bash]
47 ----
48 $ mkdir -p ~/.config/openstack
49 $ scp shacharb-redhat.com@bastion.GUID.blue.osp.opentlc.com:~/.config/openstack/clouds.yaml ~/.config/openstack/clouds.yaml
50 # Enter password for your linux user specified in the email.
51 ----
52
53 . Review your `~/.config/openstack/clouds.yaml`:
54 +
55 [source,bash]
56 ----
57 cat ~/.config/openstack/clouds.yaml
58 clouds:
59   35eb-project:
60     auth:
61       auth_url: "http://169.47.17.15:5000/v3"
62       username: "35eb-user"
63       project_name: "35eb-project"
64       project_id: "1a79cf800ff94754bb495e2c1fd9d433"
65       user_domain_name: "Default"
66       password: "YOUR_TEMP_PASSWORD"
67     region_name: "regionOne"
68     interface: "public"
69     identity_api_version: 3
70 ----
71
72 . Check that your credentials are working:
73 +
74 [source,bash]
75 ----
685922 76 $ openstack --os-cloud=GUID-project server list
b1c0bd 77 +--------------------------------------+-----------+--------+------------------------------------------------+-------+---------+
SB 78 | ID                                   | Name      | Status | Networks                                       | Image | Flavor  |
79 +--------------------------------------+-----------+--------+------------------------------------------------+-------+---------+
80 | 653fb842-6ce8-4eb0-a51a-dc0f3d5fb103 | bastion   | ACTIVE | 35eb-ocp-network=192.168.47.33, 169.47.183.214 |       | 2c2g30d |
81 | 689f4d44-df61-4088-a934-c1cca971f077 | utilityvm | ACTIVE | 35eb-ocp-network=192.168.47.35                 |       | 2c2g30d |
82 +--------------------------------------+-----------+--------+------------------------------------------------+-------+---------+
83 ----
84
987b85 85 . Try to login to OpenStack UI: link:http://api.blue.osp.opentlc.com/dashboard/auth/login/[]. You must use the credentials from `.config/openstack/clouds.yaml` to login to the UI. 
b1c0bd 86
SB 87 === Setting up AgnosticD and your development environment
88
89 . Clone the AgnosticD repository:
90 +
91 [source,bash]
92 ----
93 git clone https://github.com/redhat-cop/agnosticd
94 ----
95
96 . Create your `secret.yml` file *oustide the repository*, and edit it using the correct credentials based on your `clouds.yml` file:
97 +
98 [source,bash]
99 ----
100 cat << EOF >> ~/secret.yml
101 # Authenication for OpenStack in order to create the things
102 # BLUE
103 osp_auth_username: CHANGEME
104 osp_auth_password: CHANGEME
105 osp_project_name: CHANGEME
106 osp_project_id: "CHANGEME"
107
108
109 osp_auth_url: http://169.47.17.15:5000/v3
110 osp_auth_project_domain: default
111 osp_auth_user_domain: default
112
113 ddns_key_name: opentlc_osp_host
114 ddns_key_secret: PROVIDED_BY_ADMIN
115
116 # for three-tier-app only
117 own_repo_path: PROVIDED_BY_ADMIN
118
119 # Do not create PROJECT
120 osp_project_create: false
121 EOF
122 ----
123
124 . Copy the `sample_vars.yml` file and call it `my_vars.yml`
125 +
126 [source,bash]
127 ----
128 cp agnosticd/ansible/configs/ocp-clientvm/sample_vars_osp.yml agnosticd/ansible/configs/ocp-clientvm/my_vars.yml
129 ----
130
131 . Edit the `my_vars.yml` and change the `guid` value to something short and unique.
132
133 . Run the ansible-playbook command to deploy ocp-clientvm
134 +
135 [source,bash]
136 ----
137 cd agnosticd/
138 ansible-playbook ansible/main.yml -e @./ansible/configs/ocp-clientvm/my_vars.yml -e@~/secret.yml
139 ----
140 +
141 NOTE: If you are having python2 Vs. Python3 issues, Add `/usr/bin/python3.6` before the ansible-playbook command. For example: `/usr/bin/python3.6 ansible-playbook ansible/main.yml -e @./ansible/configs/ocp-clientvm/my_vars.yml -e@../secret.yml`
142
143
144 . Check that the VM was installed and ssh into the box using the created key
145 +
146 [source,bash]
147 ----
148 openstack --os-cloud=35eb-project server list
149 ssh -i /tmp/output_dir/${GUID}key cloud-user@169.47.183.41
150 ----
151
152 === Clean up
153
154 . Destroy the deployment:
155 +
156 [source,bash]
157 ----
158
0d9b36 159 ansible-playbook configs/ocp-clientvm/destroy_env.yml -e @configs/ocp-clientvm/sample_vars_osp.yml -e @my_secret.yml
b1c0bd 160
SB 161 ----