vspiewak / hubot-ansible

A hubot script for launching ansible commands
MIT License
14 stars 3 forks source link

feature request: ansible-playbook #1

Open wojtas911 opened 8 years ago

wojtas911 commented 8 years ago

Hi, Is there any possibility to make an hubot command like ansible-playbook, to run ansible playbooks?

vspiewak commented 8 years ago

It can be a nice feature, I already throught about it. But how to plug it ? Run playbooks in a specific directory on the Hubot host ?

wojtas911 commented 8 years ago

Hi vspiewak Yes, that is quite good idea, since 'The Best Ansible Practise' is to get ale ansible playbooks in one directory and just add a roles from role directory, for more You can add playbooks that hubot will run in one place. But from the other hand the is possibility to use a playbook as script adding

!/usr/bin/env ansible-playbook

and use a shell hubot plugin?

Or maybe: https://serversforhackers.com/running-ansible-programmatically

Sorry but I'm not developer ;/

I'm my head is just simple idea like: hubot run playbook add_system2_backup (or smt like that). hubot could add an additional vars like user from hipchat,slack to record who run this task and change var ansible_managed (http://docs.ansible.com/ansible/intro_configuration.html#ansible-managed). like /etc/ssh/sshd_confing #

managed by wojtas911 via hubot $DATE

That could be the best, because in hubot.auth plug-in You can get a list of users-names. When some one will mess up, it's easy to blame :P

And in some cases (example: adding smt to subversion,git) ask for some comment or other thing. wojtas911: @hubot run palybook push_2_git hubot: @wojtas911 add a comment (<- here it will wait 30s) wojtas911: @hubot comment "adding new servers/files"

wojtas911: @hubot run palybook stop_ec2_instance i-123456 hubot: @wojtas911 powering off i-123456 ; Are You sure? (Yes/No) wojtas911: @hubot yes

Sorry for long message ;( Cheers

jedi132000 commented 8 years ago

Hi Vincent. How about a demo on configuring the script and taking it for a spin. Like what wojtas911 suggested

vspiewak commented 8 years ago

Dear @wojtas911 & @jedi132000, sorry for the laaate reply...

This hubot script has been design firstly to use dynamic inventory on EC2. It was not design to run playbooks but bash commands with Ansible.

I updated the README.md to help you setup this script.

I'm writing a fully automated demo here (among with other things...) : https://github.com/vspiewak/devoxxfr-2016-gocd

Best Regards