How to automate deployment from git repository hosted on github / bitbucket to ubuntu server using ansible?

In github repostory settings->webhooks i can add webhook for pull to master, that will call my server webhooks

I have self-made solution, written in node.js, that pulls from git and restarts service, but want to migrate to ansible

I'm new to ansible, but know little about ansible-playbook

There is github webhook module for ansible https://docs.ansible.com/ansible/latest/github_hooks_module.html

But i dont understand, what .yml file i need to write

Also i need to pass secret API keys using enviroment variables. How to store it in keyring?

How to help

Write .yml file for ansible-playbook, that service web server for hook with secret field and git pull plus run git hooks like npm i, that specified in repo(from unprivileged user) and say, how to use it

Say, can i use github webhook module with bitbucket?

  • Hmm. You could send a webhook to Ansible Tower/AWX, i think. – Michael Hampton Feb 7 '18 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.