Skip to content

Latest commit

 

History

History
117 lines (66 loc) · 4.61 KB

24.md

File metadata and controls

117 lines (66 loc) · 4.61 KB
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 alt text

Lab Duration: 20 minutes

Lab Objective

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/

1. Fix Nova VNC Service

  1. SSH to your controller as root

    No need to reperform this step if you're already have an SSH session with your controller.

  2. De-elevate your privileges to the normal user centos

    [root@controller ~]# su centos

    [centos@controller ~]# cd

  3. 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

    ansible help

  4. 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

  5. Confirm that you did NOT forget to make [openstack] the fist entry in your hosts file!

    cat hosts

  6. Clone the ansible-novnc repository

    [centos@controller ~]$ git clone https://github.com/bryfry/ansible-novnc.git

    [centos@controller ~]$ cd ansible-novnc

  7. 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

  8. 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

  9. Run the novnc.yml playbook

    [centos@controller ansible-novnc]$ ansible-playbook -i hosts novnc.yml

  10. Match up each PLAY and TASK with the corresponding portion of the playbook below

    novnc playbook

    playbook output

  11. Let's go use the vnc service! Open the OpenStack Horizon interface (log in as admin / alta3)

  12. Launch an instance or navigate to a launched instance

  13. Click the console tab

  14. Open the console in a separate window

    console link

  15. Accept the privacy exception, we're using a self signed certificate

  16. View and interact with the console

    console view

  17. Refresh the page the console tab page, it should also work now

    instance view

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!