Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
/ towerbot Public archive

Connects Hubot, Ansible Tower and Slack to make ChatOps

License

Notifications You must be signed in to change notification settings

Aplyca/towerbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Towerbot

Build Status Circle CI

Conects Hubot, Tower-CLI, Ansible Tower and Slack to make ChatOps. Execute Ansible Tower tasks and send message to Slack

USAGE

Config file

# config/towerbot.yml

tower:
  name: My Tower
  hostname: tower.example.com

commands:
  task:
    # The deploy template job ID in Tower is 42
    deploy: 42
    # The rollback template job ID in Tower is 24
    rollback: 24
TowerBot = require('towerbot');
towerbot = new TowerBot(['config/towerbot.yml', 'config/custom.yml']);

module.exports = (robot) ->
  robot.respond /.*\s(task\s+.*)/i, (msg) ->
    towerbot.msg = msg
    try
      data = towerbot.getCommand()
      task = if data.keywords[1] then data.keywords[1] else throw ({"message": "Task not provided or valid"})

      towerbot.launchTowerJob(
        data.result,
        "",
        "Executing task #{task}"
      )
    catch error
      towerbot.sendErrorToSlack(error)

TODOs

  • Improve docs
  • Add support for users of Ansible Tower
  • Add Mocha or Jasmine testing libraries
  • Add Travis and CircleCI CI setup
  • Add suppor for multiple commands in a sentence

License

MIT / BSD

Author Information

Mauricio Sánchez from Aplyca SAS (http://www.aplyca.com)