Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

PoC - Telegram Bot that uses AWX (Ansible) to manage a lab environment

License

Notifications You must be signed in to change notification settings

davivcgarcia/awx-telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card Build Status Docker Automated build License

AWX-Telegram-Bot

This is a proof-of-concept of a Telegram Bot, written in Golang, that interacts with Ansible AWX (Tower) through RESTful APIs to run Ansible Playbooks over an Google Cloud lab environment. The bot also controls the lab usage by doing check-in/check-out of users based on their Telegram's usernames, using MongoDB as persistance.

Build

The application can be build and run using Linux containers. To build the container image, use the Dockerfile included on this repository and run the command on any host with Docker 17.05+:

docker build . -t awx-telegram-bot
docker image prune -f

Execute

The bot requires a MongoDB and some environment variables to run. You should run it with:

docker run -v /root/container/mongo:/data/db:z
           -p 27017:27017
           -itd --rm mongo

docker run -e TELEGRAM_API_TOKEN="<Telegram Bot API Token>" \
           -e TELEGRAM_CHAT_ID="<Telegram Chat ID>" \
           -e AWX_URL="<AWX URL>" \
           -e AWX_USER="<AWX Username>" \
           -e AWX_PASS="<AWX Password>" \
           -e AWX_JOB_TEMPLATE_START="<Job Template for the Start Playbook>" \
           -e AWX_JOB_TEMPLATE_STOP="<Job Template for the Stop Playbook>" \
           -e MONGO_URL="<MongoDB IP>" \
           -e MONGO_DB="awx-telegram-bot" \
           -e MONGO_COLLECTION="registries" \
           -p 8080:8080 \
           -itd --rm awx-telegram-bot

About

PoC - Telegram Bot that uses AWX (Ansible) to manage a lab environment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages