date | draft | weight | title |
---|---|---|---|
2016-07-17 |
false |
24 |
Lab 24 - Ansible Use Case |
Mon | Mon | Mon | Mon | Tue | Tue | Tue | Tue | Wed | Wed | Wed | Thur | Thur | Thur | Thur |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 |
The objective of this lab is to introduce you to a use case scenario for Ansible. First we will see what is broken. There is a configuration issue with Nova VNC Proxy service. This service allows a user to view and interact with an instance console from the web browser, a super useful feature! In order to configure this service correctly the controller and the compute nodes need to know the external ip address of the controller in order to correctly direct the browser to the vnc proxy resource. Because your lab environment was stood up just for you, your external ip address is not predictable. As a result this service is incorrectly configured and pointing to an incorrect public ip address.
In this section we will read and run a playbook that fixes this issue.
Ansible documentation is found here: http://devdocs.io/ansible/
-
SSH to your controller as root
No need to reperform this step if you're already have an SSH session with your controller.
-
De-elevate your privileges to the normal user
centos
[root@controller ~]#
su centos
[centos@controller ~]#
cd
-
Ansible should already be installed, but just as a reminder, the installation command is as follows
[centos@controller ~]$
sudo yum install ansible
If the above hangs: control-c will advance you to the next mirror and let it run!
When the install is complete, enter the lower case "y" to say yes to the install -
make sure hosts file is set:
[centos@controller ~]$
vim hosts
Enter:
i
lower case i to enter INSERT mode.Enter this content:
[openstack] controller ansible_ssh_host=192.168.0.10 neutron ansible_ssh_host=192.168.0.11 compute1 ansible_ssh_host=192.168.0.12 compute2 ansible_ssh_host=192.168.0.13
Enter:
Escape
:
wq
-
Confirm that you did NOT forget to make [openstack] the fist entry in your hosts file!
cat hosts
-
Clone the
ansible-novnc
repository[centos@controller ~]$
git clone https://github.com/bryfry/ansible-novnc.git
[centos@controller ~]$
cd ansible-novnc
-
Read the
novnc.yml
and confguration template file[centos@controller ansible-novnc]$
less novnc.yml
[centos@controller ansible-novnc]$
less files/nova-controller.conf.j2
[centos@controller ansible-novnc]$
less files/nova-compute.conf.j2
-
We actually care about the
vnc
related parameters, let's filter on that[centos@controller ansible-novnc]$
grep vnc files/nova-controller.conf.j2
[centos@controller ansible-novnc]$
grep vnc files/nova-compute.conf.j2
-
Run the
novnc.yml
playbook[centos@controller ansible-novnc]$
ansible-playbook -i hosts novnc.yml
-
Match up each
PLAY
andTASK
with the corresponding portion of the playbook below -
Let's go use the vnc service! Open the OpenStack Horizon interface (log in as admin / alta3)
-
Launch an instance or navigate to a launched instance
-
Click the console tab
-
Open the console in a separate window
-
Accept the privacy exception, we're using a self signed certificate
-
View and interact with the console
-
Refresh the page the console tab page, it should also work now
This is only a very small subset of the use cases for ansible. Like any tool you can customize and utilize it to fit your environments needs. Especially reccomended is to use ansible in combination with a revision control system (like git
). This allows for a succinct and manageable orchestration of your environments throughout time. The sky is definitely the limit!