I wanted to share some of the example Ansible playbooks used during last Wednesday’s US #vBrownBag. During the show I went over examples of how you can use Ansible to create, clone, and update virtual machines in vCenter without the need for other provisioning tools. Based on my testing (and I’m still learning as well), the items noted in the comments are the bare minimum needed to run the playbook, even though the official documentation may currently state otherwise. If you are already using Ansible for configuration management, this is a handy option to have as you can perform the provisioning tasks without leaving Ansible.
All playbooks have been uploaded to my GitHub Ansible-Test-Playbooks repository (https://github.com/jfrappier/ansible-test-playbooks/).
Posted in Tech Tagged with: #vbrownbag, ansible, ansible with vcenter, automation, clone, Cloud, devops, GitHub, Home, Linux, podcast, professionalvmware.com, provision, Shared, Technology, vcenter, Virtualization, VMware, vSphere
Yesterday Tim Tabut forked my Ansible test repo on GitHub to help me get markdown working and I merged that back into my repository. Today it is time to learn how to fork a repository on GitHub myself. If you take a look at a repository on GitHub, you’ll see a Fork button on the upper right corner of the page:
Click the Fork button, after a few moments the page will return – notice the difference?
Yup, I now have a copy of this repository in my account. Switch over to your console and clone the repository locally. For example
git clone [email protected]:jfrappier/12-days-of-commitmas.git
I can now work on these files locally, for example here is the 12 Days of Commitmas (2014) opened in Markpad (choco install markpad)
With a few changes made, I commit my file back to my repository. Do you remember what commands we need to do that?
git add . git commit git push
And here we are, files are in *my* repository. Next we will look at issuing a pull request so the owner of the repository can merge my changes into their repository.
Today I was chatting with Tim Jabaut in a Slack room Matthew Brender created for Commitmas (ping him or Josh Cohen to get in) and he shared a nice markdown cheat sheet (I seem to be all about cheat sheets during Commitmas). If you have looked at the Commitmas GitHub page you see that Matt and others have made his page pretty; it has been done using markdown. I tried adding some simple markdown to my README file on my Ansible Test Playbooks page but they were just coming over as ##, not as headings.
So, troubleshooting in this new era – it is certainly not done by emailing someone a file! Tim forked my repository to have a look; my README file needed a .MD extension to properly interpret the markdown syntax. With the change complete, Tim issued a pull request which you can see below
First, I need to merge the changes:
git pull https://github.com/tjabaut/ansible-test-playbooks master
Once that is done, you can see I have the changes from Tim in my local repository – my README file is now named README.md
I can now inspect changes to the file that Tim made; for example it may not be something as trivial as a file name. If this were a change say to an Ansible playbook I might want to review what those changes before putting them into the repository. With the file(s) local to me now, I can:
git add . git push
to merge this change back into the repository. Here you can see the changes before and after my git push.
Yesterday was the first day of Commitmas, a community event thought up by Matt Brender to help us all get used to sharing code and working with GitHub. The challenges vary based on your level of comfort – I am starting in the beginner track and hoping to work my comfort level up to being a “beginner intermediate” by the end. Now I am no developer but I see the train coming, and for all the vCommunity out there I hope you see it coming at well. The future is code and scripts; Commitmas is a great way to prepare.
Last month I published a few posts on Ansible, as part of that I created a repository on GitHub to put my playbooks in. To get back into the swing of GitHub I decided to install Git on Windows, clone my Ansible repository and create a simple README file.
What little knowledge and hands on with GitHub I have has all been from a Linux based system. On Windows you lack some of the common tools you have with Linux such as the ability to create SSH keys or an SSH client. The Git install for Windows provides these for you. Installing Git for Windows is easy, thanks for course to Chocolatey.org; if you have not used Chocolatey before installing it is also quite simple. Open a cmd prompt as admimistrator and run
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin
Now packages are as easy to install as running
choco install git
Once installed, we need to verify a few system settings:
After the reboot you should be able to open a cmd prompt and run ssh and not get a “ssh is not a recognized command” message
We are now ready to setup GitHub on Windows. If you haven’t done so already, create a user account on GitHub. There are a few commands we need to run to get everything ready.
CD to %userprofile%.ssh; you should see two files – id_rsa and id_rsa.pub.
Now switch back to your cmd prompt window
You are now authenticated with GitHub, you can now enjoy the 12 days of Commitmas!
Posted in Tech Tagged with: automation, chocolatey, Cloud, Commitmas, devops, git, git for windows, GitHub, Home, lab, Microsoft, PowerShell, Shared, ssh, ssh-keygen, Technology, Training, Vendors, Windows
Day two of commitmas, I have my Windows computer setup and SSH keys added to my GitHub account. Time to clone my existing repository to make a few edits. First, I created a directory on my computer called ‘git’ where I’ll save all my work; cd to that directory and run git init
Now, log into GitHub and find the repository you wish to clone, in the lower right corner of the screen you will see the Git clone URL for the repository. In my case I want the SSH URL so click on SSH.
Now in your console type git clone [email protected]:jfrappier/ansible-test-playbooks.git or your repository; when prompted enter the passphrase for your SSH key. You should now have your files on your local machine.
Edit a file, for example the README file. Once the file has been edited and saved, we want to get the file back into the repository. To see what files have been changed, run git status. As you can see here my README file was modified.
As you can also see in the screen show we need to run git add, for example git add README or git add . – with the file added you now commit your changes by running git commit (this launches vi so press i to go to insert mode, enter a note then press esc :wq enter). Finally, git push to put the file back into GitHub. As you can see here I just updated my README file.