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

Latest commit

 

History

History
65 lines (50 loc) · 1.45 KB

README.md

File metadata and controls

65 lines (50 loc) · 1.45 KB

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)