February 23rd, 2015 by JFrappier

Jonathan Frappier Virtxpert

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/).

#vBrownBag Using Ansible with vCenter Examples

Posted in Tech Tagged with: , , , , , , , , , , , , , , , , , ,

December 25th, 2014 by JFrappier

Jonathan Frappier Virtxpert

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:

git-fork

Click the Fork button, after a few moments the page will return – notice the difference?

git-forked

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)

markpad-commitmas

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.

git-forked-commit

On the fourth day of Commitmas – Forking repositories on GitHub

Posted in Tech Tagged with: , , , , , , , , , , , , , ,

December 23rd, 2014 by JFrappier

Jonathan Frappier Virtxpert

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

git-pull-requestThe question now becomes, how do I merge that change? GitHub was nice enough to drop me an email with some tips.

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

git-pull-local

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.

git-repo-merged

 

On the third day of Commitmas, my slack friends gave to me – Merging Pull Requests w Git

Posted in Tech Tagged with: , , , , , , , , , , ,

December 22nd, 2014 by JFrappier

Jonathan Frappier Virtxpert

SamSnowmanI don’t know what I would have done without Commitmas to pull us through. Anyway – uh, Commitmas? Huh, could it be that some of you are not acquainted with the story of Commitmas?

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:

  • Go to Advanced system settings (Start >> Control Panel >> System >> Advanced system settings)
  • Click on Environment Variables
  • In the System variables section locate ‘Path’ and verify C:Program Files (x86)Gitcmd; is there
  • Add C:Program Files (x86)Gitbin; directly after C:Program Files (x86)Gitcmd; with no spaces after the ; (make sure you also end with a ;)
  • For SSH commands to work later, you need to add a variable.  In the User variables for user section, click the New… button
  • Create a variable named HOME with a value of %USERPROFILE%
  • Click OK three times and reboot the computer. After the reboot you

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

ssh-windows

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.

  • git config –global user.name username [where username is your actual username, for example jfrappier]
  • git config –global user.email [email protected] [where [email protected] is your actual email that you signed up for GitHub with]
  • ssh-keygen -t rsa -C [email protected]
  • Select the location to save the key, I accepted the default
  • Enter a passprhase

CD to %userprofile%.ssh; you should see two files – id_rsa and id_rsa.pub.

  • Open id_rsa.pub in note pad and copy the contents
  • Log into GitHub and click on Settings (the gear icon in the upper right corner) >> ssh keys
  • Click Add SSH key
  • Provide a name, paste the contents from id_rsa.pub into the key textbox, and click Add key

Now switch back to your cmd prompt window

  • Type ssh -T [email protected]
  • Type yes to accept the certificate
  • Type the passphrase you set for your key previously

You are now authenticated with GitHub, you can now enjoy the 12 days of Commitmas!

ssh-github-windows

 

On the first day of Commitmas – Windows Git, SSH, and Keys

Posted in Tech Tagged with: , , , , , , , , , , , , , , , , , ,

December 22nd, 2014 by JFrappier

Jonathan Frappier Virtxpert

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.

git-cloneNow 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.

git-clone-local

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.

git-status

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.

git-pushTomorrow we will get into forking!

On the second day of Commitmas – git clone, git add, git commit, git push

Posted in Tech Tagged with: , , , , , , , , , , , , ,