Maintaining Your Deployments in GitHub Updated on June 11, 2021 by InMotion Hosting Contributor 2 Minutes, 39 Seconds to Read In this article, we will outline the process of using Git to handle versioning a repository and keeping a copy on a GitWeb provider as a backup, or for sharing. This article assumes that you have already received a copy of the WordPress UltraStack playbook, and want to retain custom changes to the playbook by using Git. You may use any GitWeb provider you prefer, though we will use GitHub to provide an overview of this process. NOTE: Do not push sensitive information contained in your Ansible Playbook inventory to a public repo! Be sure to remove sensitive information from files you commit! Sign up for a GitHub account if you don’t already have one. Backup Ansible Add your Ansible Control Agent SSH public key to GitHub. The following steps are an abridged outline of the official steps available at Github.com or you can follow belowVisit https://github.com/settings/keysClick New SSH keyAdd the public key to the input field:Click the Add SSH key buttonVisit our WordPress-UltraStack-Ansible Github pageClick the Fork buttonOn your fork, click the Clone or download buttonChoose Clone with SSH if not already selectedAdd this repo to your playbook:git remote add my-fork <url you copied>Feel free to replace ‘my-fork’ with any keyword, though infuture sections we will reference the repo keyword specifiedhere.Review your changes to the PlaybookNOTE: Do not push sensitive information contained in your Ansible Playbook inventory to a public repo!!! Be sure to remove sensitive information from files you commit!Check the status of your playbook:git statusOn branch masterYour branch is up to date with ‘origin/master’.Changes not staged for commit:(use “git add <file>…” to update what will be committed)(use “git checkout — <file>…” to discard changes in working directory) modified: ansible.cfgno changes added to commit (use “git add” and/or “git commit -a”)Double-check what was changed in the listed file(s):git diffdiff --git a/ansible.cfg b/ansible.cfgindex 27b30c3..e9902ee 100644— a/ansible.cfg+++ b/ansible.cfg@@ -12,7 +12,7 @@ callback_whitelist = profile_tasks, timerforks = 25host_key_checking = Falseinternal_poll_interval = 0.01-nocows = 1+nocows = 0stdout_callback = yamlvar_compression_level = 9@@ -23,4 +23,4 @@ timeout = 300[ssh_connection]pipelining = True-retries = 1+retries = 3Looks good? Let’s commit!Add and push your changes in a new commitAdd the file(s) to a staged commit:git add ansible.cfgAdd a helpful commit message of what you changed:git commit -m "ansible.cfg: enable cowsay; retry ssh 3 times"[master 2b80016] ansible.cfg: enable cowsay; retry ssh 3 times1 file changed, 2 insertions(+), 2 deletions(-)Push your changes:git push my-fork masterCounting objects: 3, done.Delta compression using up to 8 threads.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 420 bytes | 420.00 KiB/s, done.Total 3 (delta 1), reused 0 (delta 0)remote: Resolving deltas: 100% (1/1), completed with 1 local object.To github.com:<your GitHub user>/wordpress-ultrastack-ansible.giteb1bf94..eafd54c master -> master Discover more about IT automation in our Ansible Education Channel. For further reading, learn How to Deploy Files With GitHub Actions for FTP and SCP. Get our Ansible Control Node to automate deployments now with our Cloud Server Hosting. Share this Article IC InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles Ansible and Docker What is Ansible? Ansible vs Terraform Getting Started with Ansible How to Install Ansible on a Linux Server WordPress UltraStack Ansible Playbook Tutorial Using Git to Manage your Workflow Ansible Galaxy and Prebuilt Playbooks Accessing your Ansible Control Node How to Backup Ansible