Skip to content

vatit-devops/ansibot

Repository files navigation

Ansibot - Provision your Dev Machines

Author: Harry Lee [email protected]

Introduction

Front end for provisioning machines using Ansible through a web app. The purpose of this project is to allow end users to provision their own machines/other hosts through a frontend without worrying about changing the hosts file. This abstracts the end users from the underlying implementations of playbooks. This example front-end allows users to enter their own credentials and will stream console logs from Ansible to the web front-end.

This project is based on react-starter-kit and uses Docker to deploy Ansible. Websockets (using Socket.io) are used to stream logs to the web front-end. Material-UI is used for the front-end.

Background

At VAT IT, it takes a very long time for new developers to get their machine set up with the correct configurations. This is a hideous and manual process. We have decided to automate this process by using Ansible to configure these developers' machines. This allows the developers to get started with the more important tasks instead of doing mundane set ups. The developers do not have to be clued up with Ansible either, they just have to enter their credentials.

Pre-requisites

This example project assumes that you have the following setup:

Directory Structure

  • ansible: This directory has the example Docker image for Ansible usage.
  • src: Source code for front-end.
  • docs: Docs for react starter kit.
  • tools: Webpack configs.

Usage

This example is biased to the specific dev machine setup for use in VAT IT.

  1. The host with this app installed (control machine) must be on the same network as the dev machine (ensure that they can discover each other).
  2. Run the web app on the control machine (the web app is default to serve on port 3000).
  3. Ensure that the dev machine is Ansible ready.
  4. Access the web app from the dev machine (ip address:3000) and enter dev machine credentials.
  5. Click "Submit" and view the logs.

To Run:

NODE_ENDPOINT_IP='http://localhost:3000' NODE_ENV_IMAGE='halosan/ansible-auto:demo' node build/server.js

Conclusion

This is a very simple implementation of viewing the remote docker output (process.stdout). There are many other applications for this implementation.