Microsoft NO-tepad

This may be old hat news to some people, but I’ve been out of the Micro$oft camp for some time now.  I did mention I was a Penguinista!

One of the roles I’m working on is to automate the installation of MSSQL server through the use of an unattended configuration file.  While working on this I came upon a very interesting problem.  There are some options that will be different in production environments from localised development environments so I’ve placed the configuration in the role’s templates folder.  The various dynamic values I want to ensure match environment types were replaced with {{ variables }}.  Sounds easy right? What could go wrong?

As I found out, plenty.  When I edited the files in Atom locally on my Development environment (Windows 7) the configuration file looks ok. It even looked fine on my personal development environment (Linux Mint 17) but when the role is ran against the virtualized environment (a Vagrant Virutalbox machine) it failed.  Opening the file on the guest there were some extra odd symbols at the start of the file that weren’t on the host.  And all the values I’d entered had changed to what looked like a mix of Russian Crylic and Chinese.

The configuration file I’m using had already been written by the Ops team to help them define standard settings for their SQL servers.  Except that they had edited those settings in Microsoft Notepad.  Which I recently found out places a binary byte marker at the start of the file thus corrupting it when attempting to parse it through Ansible’s Templates module that uses the Jinja 2 templating language.

When I recreated the file, keeping it as far away from Notepad as I digitally could, the role parsed the new template perfectly.

So moral of the story is don’t use Notepad!  Use a proper text editor like Notepad++ or Atom.

Author: Aidan

An experienced Developer who transitioned into implementing Continuous Integration, Delivery and Improvement through the use of Agile and Lean, or to put it simply, The DevOps Specialist.

Leave a Reply

Your email address will not be published. Required fields are marked *