This is the first post in a series for creating a Linux host with Ansible to control Windows machines and install SharePoint.
Let me preface this with I have no clue how far I will get. I expect this to take a few weeks if it’s possible. Ansible seems to be growing, and this all might not be fully baked out. We will see! Feel free to comment.
- Part 1- Setup CentOS with Ansible (This post)
- Part 2- Setup Ansible with Windows Machines (Coming soon)
- Part 3- Using Ansible to prepare Windows Machines for SQL Server (Coming soon)
- Part 4- Using Ansible to install SharePoint using AutoSPInstaller (Coming soon)
- Part 5- Using Ansible to Maintain SharePoint Machines (Coming soon)
Introduction
There are various technologies I have attempted to use in the past for Windows Deployment SharePoint automation using AutoSPInstaller, such as:
- Chocolatey– I could not find enterprise worthy packages for SQL Server and SharePoint. I also couldn’t figure out a way to provision Azure VMs from it.
- PowerShell DSC – Way to overkill with push/pull when I just wanted to configure a new SharePoint farm
- Chef– Have not tried it. I personally can’t get over the names of things relating to items in the kitchen. But I believe this is a standard. Check it out
- Azure WebHooks– Runs PowerShell, possibly limited, on Azure VMs. Note each VM needs an endpoint for each runbook. I have 60 dev VMs/farms that I manage, and I wanted a different runbook for different parts of the SharePoint configuration process, this wasn’t going to happen.
- Azure RunBooks– Lots of great tutorials for building a SP Farm, but the farm was not fully configured. I prefer AutoSPInstaller and couldn’t figure out a way to merge them.
Now my above experience is very limited, as when I would hit a wall I would pretty much see how far the technology is and if it’s not supported I would give up. Also, the above experiences are a hybrid of on-premises SharePoint installation needs and Azure IaaS hosting SharePoint needs. So if this does not work, I will be going back to the drawing board or the above list. I have not used Microsoft System Center Orchestrator, as I rarely provision new Hyper-V VMs, and heard it is a ton of work to configure.
My Goal with Automation
I have a very well defined steps I have documented to install SharePoint 2013 farms with one or more servers, for dev/qa or production. These can be in Azure or on-premises in Hyper-V. I want something lightweight that I can provision a new VM, join it to the domain, create a domain if needed, run Windows Update, configure OS rules, install SQL Server (different versions), install SharePoint via AutoSPInstaller, patch SharePoint, and configure services. I would also like to set services and verify those rogue developers did not change any system settings (just kidding team). I know automation does not replace planning, but I hope to turn documentation and PowerShell scripts into a custom deployment tool I can use for provisioning future environments as well as maintaining existing environments. When I read the Phoenix Project, they brought up a good point of “If a family dog gets injured, you nurse it back to health, but if one of your cattle get injured, you will be having beef for dinner”, which basically means why are you spending 100 hours fixing an environment, when you can just recreate or replace it with another? Of course, developers and users change system settings, but the core of the machine can be recreated via a script in less than a day, rather than troubleshooting something and possibly not solving the issue.
Getting Started with Ansible
I picked up a book on Amazon called Ansible for DevOps by Jeff Geerling but shortly into the book realized it was only for Linux based machines. Ansible does support Windows targets, but the commands must be ran from a Linux OS. Dang. I don’t know Linux. So now I am writing this blog post. And it begins. Let’s see what Ansible can do for Windows targets.
Installing Linux – CentOS on a Windows Hyper-V host
-
Download Cent OS7
- https://www.centos.org/download/
- I choose Torrent option, as the mirrors were pretty slow. Torrent went at 6mbps download and finished 4GB in about 10 minutes.
- https://www.centos.org/download/
-
Create new VM
-
Choose a location for the VM file
-
Choose Generation1
-
Choose a fixed amount of ram
-
Choose your Hyper V NIC
-
Choose your VHD path/info for a new blank VHD to be created
-
Choose the CentOS ISO file downloaded from the first step
- Turn on the VM!
- Boot to Cent OS install
Install CentOS on VM (then Python/Ansible)
-
Select Language
-
Choose software selection (Choose Server with GUI unless you know how to use Linux terminal well) I also selected the Development/Security tools, and MariaDB (I saw MariaDB in the Ansible book example and figure this will save me some steps later for Ansible testing)
-
Choose disk
-
Enable Ethernet and choose a hostname for the computer
-
Verify everything looks good:
-
While the OS is installing, configure a root and local user account. Root is like a local server admin password, which we will be using. The user account is a username and password, which you will be logging into each time you start the VM
- Select the blue Reboot option when the install is complete.
Log In to Cent OS
-
Log in to CentOS
-
License Agreement
-
Hit 1 to read it, 2 to accept, c to continue, and c again to continue (I kinda struggled with this part)
-
-
Sign in using the username and password you set up:
-
Accept language, keyboard layout, and skip cloud accounts if desired. Then click Start using Linux!
-
-
-
Run Terminal
Install Python/Ansible on CentOS
-
Install Python
-
Type SU then hit Enter in terminal to enter the root admin window
- Enter root password (different from user password, you entered it in setup)
-
Once in root, install Python.
-
Type: sudo yum install epel-release
- Hit Y to continue (twice)
- Verify complete
-
-
-
-
Install Ansible
-
Type sudo yum install ansible
-
Select Y to continue (twice)
-
-
Test ansible command to verify install is complete:
-
Type: ansible –version
- You should get back a version number.
-
-
RESOURCES
Thanks to this article for the Python install help I was able to figure out how to install it without errors on CentOS7. Here are the same commands over again, just together without screenshots:
http://stackoverflow.com/questions/32048021/yum-what-is-the-message-no-package-ansible-available
$ su
$ sudo yum install epel-release
$ sudo yum install ansible
Great post, I’ll look forward to hearing more from you. I’ve done some Ansible blogging myself, check pro-blog.com. I mainly use it for Linux, but have an interest in using it for Windows work too. Ping me if I can help.
Hi there,
Did you ever to around to installing SharePoint via AutoSPInstaller using ANsible?
I am attempting to do this at the moment, and hitting a lot of snags that seem to relate to the winrm transport used to trigger the various ps1 scripts.
The post after this one has the update. I ran into tons of challenges and didn’t get to far. Seems PowerShell is the way to go, including PowerShell remoting, PowerShell DSC and Azure JSON scripts.
Thanks for your step by step guidance.really great post and thanks for sharing the screen shots which is really easy to understand.