{"id":321,"date":"2020-06-13T15:39:38","date_gmt":"2020-06-13T19:39:38","guid":{"rendered":"https:\/\/chasberndt.com\/?p=321"},"modified":"2020-06-13T21:35:53","modified_gmt":"2020-06-14T01:35:53","slug":"ansible-and-text-encoding-and-line-endings-and-git-and-windows-and-frustration","status":"publish","type":"post","link":"https:\/\/chasberndt.com\/?p=321","title":{"rendered":"Ansible and Text Encoding and Line Endings and Git and Windows and Frustration"},"content":{"rendered":"\n<p>I ran into an issue the other day with Ansible while provisoning a Windows machine. After installing InstallShield 2015 SAB, Ansible copies a small license file configuration file into the installation directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;FlexNet Publisher Server]\nServer=Port@ServerName<\/code><\/pre>\n\n\n\n<p>That&#8217;s the configuration. Should be easy right? <\/p>\n\n\n\n<p>Not in this case. I was confounded by errors in while testing the installation. If I opened up the file using Notepad and saved it, InstallShield would start working.<\/p>\n\n\n\n<p>I had tried all of the usual suspects once I realized there was something wrong with the file. Change the text encoding from UTF8 to Windows ANSI. No change. Change the line endings from LF to CRLF. No change.<\/p>\n\n\n\n<p>So what was going on?<\/p>\n\n\n\n<p>As it turns out, my text editor (Atom) was adding an extra LF to end of the file. Why would it do that? Well, this part of the POSIX standard.<\/p>\n\n\n\n<p>See: <a href=\"https:\/\/gcc.gnu.org\/legacy-ml\/gcc\/2003-11\/msg01568.html\">https:\/\/gcc.gnu.org\/legacy-ml\/gcc\/2003-11\/msg01568.html<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"530\" height=\"314\" src=\"https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/before.png\" alt=\"\" class=\"wp-image-326\" srcset=\"https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/before.png 530w, https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/before-300x178.png 300w\" sizes=\"auto, (max-width: 530px) 100vw, 530px\" \/><figcaption>Before saving.<br><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"540\" height=\"324\" src=\"https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/after.png\" alt=\"\" class=\"wp-image-327\" srcset=\"https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/after.png 540w, https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/after-300x180.png 300w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><figcaption>After saving.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-style-rounded\"><img loading=\"lazy\" decoding=\"async\" width=\"577\" height=\"433\" src=\"https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/jackie_chan.png\" alt=\"\" class=\"wp-image-328\" srcset=\"https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/jackie_chan.png 577w, https:\/\/chasberndt.com\/wp-content\/uploads\/2020\/06\/jackie_chan-300x225.png 300w\" sizes=\"auto, (max-width: 577px) 100vw, 577px\" \/><\/figure>\n\n\n\n<p>To get around this issue, I uploaded this file to Artifactory and I treat the configuration file as an artifact, like the InstallShield installer, and just download and copy it to the installation directory.<\/p>\n\n\n\n<p>This is a reminder to be conscious of how Git and your editor treat files when you&#8217;re provisioning Windows machines. Occasionally, you will still run into maddening little issues like this. I don&#8217;t want to admit how much time this thing left me stumped.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I ran into an issue the other day with Ansible while provisoning a Windows machine. After installing InstallShield 2015 SAB, Ansible copies a small license file configuration file into the installation directory. That&#8217;s the configuration. Should be easy right? Not in this case. I was confounded by errors in while testing the installation. If I <a class=\"read-more\" href=\"https:\/\/chasberndt.com\/?p=321\">&hellip;&nbsp;<span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20,13,21],"tags":[],"class_list":["post-321","post","type-post","status-publish","format-standard","hentry","category-ansible","category-automation","category-windows"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/chasberndt.com\/index.php?rest_route=\/wp\/v2\/posts\/321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chasberndt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chasberndt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chasberndt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chasberndt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=321"}],"version-history":[{"count":3,"href":"https:\/\/chasberndt.com\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions"}],"predecessor-version":[{"id":330,"href":"https:\/\/chasberndt.com\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions\/330"}],"wp:attachment":[{"href":"https:\/\/chasberndt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chasberndt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chasberndt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}