Setup Git

Document Control

TODO:

  • Overall structure.
  • Initial draft complete
  • Testing
  • Ready

User Story: Setup git for version control of ansible roles

As a: Automation Engineer / Ansible developer

I want to: manage my Ansible roles and playbooks under Git version control

So that: I can keep track of changes and integrate with CI/CD systems.

Setup Git and Manage Ansible Roles

Git workflow example
git config --global user.email "mihai@example.com"
git config --global user.name "Mihai Criveti"
git config --global push.default simple
git config --list
ansible-galaxy init myrole
git init
git add .
git commit -m "Ansible myrole role"
# Step 1: Create a new repo on github

# Step 2: Add the remote url
git remote add origin https://github.com/GITHUB_USER/myrole.git

# Step 3: Push
git push
# Checkout and create a new branch
git checkout -b feature01

# Perform some changes
touch newfile

# Add and commit a new feature
git add .
git commit -m "New feature"

# Merge your commit
git checkout master
git merge feature01
git push

# Delete the branch
git checkout -d feature01

Last update: 2020-01-26