{"id":1139,"date":"2020-12-19T20:46:42","date_gmt":"2020-12-19T20:46:42","guid":{"rendered":"https:\/\/www.nicktailor.com\/?p=1139"},"modified":"2024-04-30T05:49:01","modified_gmt":"2024-04-30T05:49:01","slug":"how-to-deploy-vmware-vm-using-ansible-from-a-clone-templates","status":"publish","type":"post","link":"https:\/\/nicktailor.com\/tech-blog\/how-to-deploy-vmware-vm-using-ansible-from-a-clone-templates\/","title":{"rendered":"How to deploy Vmware VM&#8217;s using Ansible from Cloned Templates"},"content":{"rendered":"<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong>QUICK OVERVIEW OF WHAT ANSIBLE IS.<span style=\"text-decoration: underline;\">.<\/span><\/strong><\/p>\n<p>Ansible is a radically simple IT automation engine that automates&nbsp;cloud provisioning,&nbsp;configuration management,&nbsp;application deployment,&nbsp;intra-service orchestration, and many other IT needs.<\/p>\n<p>Designed for multi-tier deployments since day one, Ansible models your IT infrastructure by describing how all of your systems inter-relate, rather than just managing one system at a time.<\/p>\n<p>It uses no agents and no additional custom security infrastructure, so it&#8217;s easy to deploy &#8211; and most importantly, it uses a very simple language (YAML, in the form of Ansible Playbooks) that allow you to describe your automation jobs in a way that approaches plain English.<\/p>\n<p>On this page, we&#8217;ll give you a really quick overview so you can see things in context. For more detail, hop over to&nbsp;docs.ansible.com.<\/p>\n<p style=\"margin-top: 15pt; padding-top: 0; margin-bottom: 15pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #333333;\">EFFICIENT ARCHITECTURE<\/span><\/strong><\/p>\n<p style=\"margin-top: 12pt; padding-top: 0; margin-bottom: 12pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #333333;\">Ansible works by connecting to your nodes and pushing out small programs, called &#8220;Ansible modules&#8221; to them. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules (over SSH by default<\/span><span style=\"color: #333333;\">), and<\/span><span style=\"color: #333333;\"> removes them when finished.<\/span><\/p>\n<p style=\"margin-top: 12pt; padding-top: 0; margin-bottom: 12pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #333333;\">Your library of modules can reside on any machine, and there are no servers, daemons, or databases required. <\/span><span style=\"color: #333333;\">Typically<\/span><span style=\"color: #333333;\"> you&#8217;ll work with your <\/span><span style=\"color: #333333;\">favorite<\/span><span style=\"color: #333333;\"> terminal program, a text editor, and probably a version control system to keep track of changes to your content.<\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 12pt; padding-top: 0; margin-bottom: 12pt; padding-bottom: 0; line-height: 1.2; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; text-decoration: underline; color: #333333; font-size: 13.5pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #333333;\">Okay so what that actually is saying is. Ansible has a whole library of python modules that come out of the box coupled with a <\/span><span style=\"color: #333333;\">huge community of <\/span><span style=\"color: #333333;\">open source<\/span><span style=\"color: #333333;\"> python modules to do all sorts of tasks to automate infrastructure.<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 12pt; padding-top: 0; margin-bottom: 12pt; padding-bottom: 0; line-height: 1.2; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; text-decoration: underline; color: #333333; font-size: 13.5pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #333333;\">You can call these modules by writing <\/span><span style=\"color: #333333;\">yaml<\/span><span style=\"color: #333333;\"> code, inside your <\/span><span style=\"color: #333333;\">yaml<\/span><span style=\"color: #333333;\"> code when you call a specific module, you can the pass specific variables to that module to do specific things defined by the python module.<br \/>\nExample power on and off a vm, or connect or disconnect network, etc.<\/span><\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; font-size: 10pt;\"><span style=\"color: #333333;\">For the purposes of this <\/span><span style=\"color: #333333;\">post<\/span><span style=\"color: #333333;\"> we are <\/span><span style=\"color: #333333;\">are<\/span><span style=\"color: #333333;\"> going to dive into <\/span><span style=\"color: #333333;\">using <\/span><strong><span style=\"color: #333333;\">\u201c<\/span><span style=\"color: #333333;\">vmware_guest<\/span><span style=\"color: #333333;\">\u201d module<\/span><span style=\"color: #333333;\"> by way of using http <\/span><span style=\"color: #333333;\">api authentication<\/span><span style=\"color: #333333;\"> session &amp; cookies<\/span><span style=\"color: #333333;\">.<\/span><\/strong><span style=\"color: #333333;\"> There are many other python modules which you can search <\/span><span style=\"color: #333333;\">in the<\/span><span style=\"color: #333333;\"> ansible <\/span><span style=\"color: #333333;\">documentation and or ansible-galaxy<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; font-size: 10pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; font-size: 10pt;\"><a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/collections\/community\/vmware\/index.html\">https:\/\/docs.ansible.com\/ansible\/latest\/collections\/community\/vmware\/index.html<\/a><\/p>\n<p><span style=\"color: #333333;\">Now it <\/span><span style=\"color: #333333;\">definitely helps<\/span><span style=\"color: #333333;\"> to be able to code in python<\/span><span style=\"color: #333333;\"> or at least be able to read python code<\/span><span style=\"color: #333333;\">, however completely not necessary. Anyone with basic understanding of bash scripting can learn ansible. I could teach a newbie ansible in a couple days. <\/span><span style=\"color: #333333;\"> Sharing is caring.<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; font-size: 10pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; font-size: 10pt;\"><span style=\"color: #333333;\">Anyone who says otherwise\u2026\u2026<\/span><span style=\"color: #333333;\">don\u2019t<\/span><span style=\"color: #333333;\"> hire them. <\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; font-size: 10pt; margin-left: 36pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; font-size: 10pt; margin-left: 36pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; font-size: 10pt;\"><strong>Ansible Setup:&nbsp;<\/strong><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span>Now this post assumes you already have ansible setup and are running a newer version. If not you will need to review post on how to setup ansible before you can proceed with this.<\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong>Pre-Module install Steps:&nbsp;<\/strong><\/p>\n<h2 style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\"><a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/collections\/community\/vmware\/vmware_guest_module.html#id2\"><span style=\"color: #404040;\">Requirements<\/span><\/a><\/h2>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 18pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #404040;\">The below requirements are needed on the host that executes this module.<\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040; font-size: 10pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #404040;\">python &gt;= 2.6<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040; font-size: 10pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #404040;\">PyVmomi<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040; font-size: 10pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #404040;\">PIP<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040; font-size: 10pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #404040;\">Community.vmware<\/span><span style=\"color: #404040;\"> library of python modules<\/span><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040;\">1.<\/span><span style=\"color: #404040;\">Okay so you if <\/span><span style=\"color: #404040;\">your<\/span><span style=\"color: #404040;\"> on our ansible machine as root<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #404040;\">Run the<\/span><span style=\"color: #404040;\"> following this should install the modules you need<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #404040;\">\uf0fc<\/span><span style=\"color: #e74c3c;\">ansible-galaxy<\/span><span style=\"color: #e74c3c; background-color: #ffffff;\">&nbsp;<\/span><span style=\"color: #e74c3c;\">collection<\/span><span style=\"color: #e74c3c; background-color: #ffffff;\">&nbsp;<\/span><span style=\"color: #e74c3c;\">install<\/span><span style=\"color: #e74c3c; background-color: #ffffff;\">&nbsp;<\/span><span style=\"color: #e74c3c;\">community.vmware<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 144pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #00b050;\">Note: Depending on where you ran this from. If you ran this from \/home\/root. You can find all your python modules in \u2018root<\/span><span style=\"color: #00b050;\">\/.ansible<\/span><span style=\"color: #00b050;\">\/collections\/ansible_collections\/community\/vmware\/plugins\/modules\u2019<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span>You will probably need to install python 2.6 or greater<\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #404040;\">\uf0fc<\/span>Redhat : <span style=\"color: #e74c3c;\">Yum install python<\/span> (should get you the latest version)<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #404040;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #404040;\">Okay you may also <\/span><span style=\"color: #404040;\">neeed<\/span><span style=\"color: #404040;\"> to install pip<\/span><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><strong><span style=\"color: #404040;\"><em>Note: Now on centos <\/em><\/span><span style=\"color: #404040;\"><em>its<\/em><\/span><span style=\"color: #404040;\"><em> not available out of the box<\/em><\/span><\/strong><\/p>\n<\/div>\n<\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><strong><span style=\"color: #404040;\">Centos 7 PIP install<\/span><span style=\"color: #404040;\">:<\/span><\/strong><\/p>\n<\/div>\n<\/div>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #ff0000;\">1.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">sudo<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> yum install <\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">epel<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">-release<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #ff0000;\">2.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">sudo<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> yum install python-pip<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #404040;\">3.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">pip \u2013version<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> (verify its installed)<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #404040; font-size: 10pt;\">4.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">sudo<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> yum install python-<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">devel<\/span> <span style=\"color: #1f2937; background-color: #f3f4f6;\">(these are for building python modules<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">)<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #404040; font-size: 10pt;\">5.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">sudo<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> yum <\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">groupinstall<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> &#8216;development tools&#8217; <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">(these are for building python <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">modules(<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><strong><span style=\"color: #404040;\">Install <\/span><span style=\"color: #404040;\">PyVmomi:&nbsp;<\/span><\/strong><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; font-size: 10pt;\">1.<\/span><strong><span style=\"color: #ff0000;\">pip install <\/span><span style=\"color: #ff0000;\">\u2013upgrade <\/span><span style=\"color: #ff0000;\">pyvmomi<\/span><\/strong><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #404040;\">It will look like<\/span><span style=\"color: #404040;\">\u2026..<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #404040;\">[<\/span><span style=\"color: #404040;\">root@nick<\/span> <span style=\"color: #404040;\">roles]#<\/span><span style=\"color: #404040;\"> pip install &#8211;upgrade <\/span><span style=\"color: #404040;\">pyvmomi<\/span><\/strong><\/p>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Collecting pyvmomi<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Downloading https:\/\/files.pythonhosted.org\/packages\/ba\/69\/4e8bfd6b0aae49382e1ab9e3ce7de9ea6318eac007b3076e6006dbe5a7cd\/pyvmomi-7.0.1.tar.gz (584kB)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 593kB 861kB\/s<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Cache entry deserialization failed, entry ignored<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Collecting requests&gt;=2.3.0 (from pyvmomi)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Downloading https:\/\/files.pythonhosted.org\/packages\/29\/c1\/24814557f1d22c56d50280771a17307e6bf87b70727d975fd6b2ce6b014a\/requests-2.25.1-py2.py3-none-any.whl (61kB)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 61kB 3.5MB\/s<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Collecting six&gt;=1.7.3 (from pyvmomi)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Downloading https:\/\/files.pythonhosted.org\/packages\/ee\/ff\/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a\/six-1.15.0-py2.py3-none-any.whl<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Cache entry deserialization failed, entry ignored<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Collecting certifi&gt;=2017.4.17 (from requests&gt;=2.3.0-&gt;pyvmomi)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Downloading https:\/\/files.pythonhosted.org\/packages\/5e\/a0\/5f06e1e1d463903cf0c0eebeb751791119ed7a4b3737fdc9a77f1cdfb51f\/certifi-2020.12.5-py2.py3-none-any.whl (147kB)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 153kB 6.5MB\/s<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Cache entry deserialization failed, entry ignored<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Collecting urllib3&lt;1.27,&gt;=1.21.1 (from requests&gt;=2.3.0-&gt;pyvmomi)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Downloading https:\/\/files.pythonhosted.org\/packages\/f5\/71\/45d36a8df68f3ebb098d6861b2c017f3d094538c0fb98fa61d4dc43e69b9\/urllib3-1.26.2-py2.py3-none-any.whl (136kB)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 143kB 6.9MB\/s<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Cache entry deserialization failed, entry ignored<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Collecting idna&lt;3,&gt;=2.5 (from requests&gt;=2.3.0-&gt;pyvmomi)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Downloading https:\/\/files.pythonhosted.org\/packages\/a2\/38\/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8\/idna-2.10-py2.py3-none-any.whl (58kB)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 61kB 4.4MB\/s<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Cache entry deserialization failed, entry ignored<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Collecting chardet&lt;5,&gt;=3.0.2 (from requests&gt;=2.3.0-&gt;pyvmomi)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Downloading https:\/\/files.pythonhosted.org\/packages\/19\/c7\/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68\/chardet-4.0.0-py2.py3-none-any.whl (178kB)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 184kB 3.5MB\/s<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Installing collected packages: certifi, urllib3, idna, chardet, requests, six, pyvmomi<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Found existing installation: certifi 2018.4.16<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Uninstalling certifi-2018.4.16:<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully uninstalled certifi-2018.4.16<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Found existing installation: urllib3 1.22<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Uninstalling urllib3-1.22:<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully uninstalled urllib3-1.22<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Found existing installation: idna 2.6<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Uninstalling idna-2.6:<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully uninstalled idna-2.6<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Found existing installation: chardet 3.0.4<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Uninstalling chardet-3.0.4:<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully uninstalled chardet-3.0.4<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Found existing installation: requests 2.18.4<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Uninstalling requests-2.18.4:<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully uninstalled requests-2.18.4<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Found existing installation: six 1.9.0<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Uninstalling six-1.9.0:<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully uninstalled six-1.9.0<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Running setup.py install for pyvmomi &#8230; done<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully installed certifi-2020.12.5 chardet-4.0.0 idna-2.10 pyvmomi-7.0.1 requests-2.25.1 six-1.15.0 urllib3-1.26.2<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">You are using pip version 10.0.1, however version 20.3.3 is available.<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong>You should consider upgrading via the &#8216;pip install &#8211;upgrade pip&#8217; command. <\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong>(You noticed this at the bottom)<\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">A lot of the time you need to upgrade pip for the modules to install as python is always evolving at a fast pace<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">So run<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\">2.<\/span><span style=\"color: #ff0000;\">pip install \u2013upgrade pip<\/span><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">[root@nick roles]# pip install &#8211;upgrade pip<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Collecting pip<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Downloading https:\/\/files.pythonhosted.org\/packages\/54\/eb\/4a3642e971f404d69d4f6fa3885559d67562801b99d7592487f1ecc4e017\/pip-20.3.3-py2.py3-none-any.whl (1.5MB)<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 1.5MB 799kB\/s<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Installing collected packages: pip<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Found existing installation: pip 8.1.2<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Uninstalling pip-8.1.2:<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully uninstalled pip-8.1.2<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Successfully installed pip-10.0.1<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #1f2937; background-color: #f3f4f6;\">You get the idea<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">\u2026\u2026<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><strong><span style=\"color: #000000; background-color: #f3f4f6;\">Vpshere<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">Pre-<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">requistes<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> for this to work<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">You will need a <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vmware<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> user who has <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">api<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> access permission for the following items. If the <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">user<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> you have setup in <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> is unable to see these items. This module will fail. You do&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">not need<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> a user with full admin privileges, which is what a lot of documentation says online cryptically. I have tested this and confirmed that is not the case. <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">Obivously<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">, its way better to just give admin privileges to the user and trust the people you hire and use ansible vault to hide the credentials. Which we will get into later\u2026.<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">You can also check these parameters in your code by validating using assertions to see if they are all working with your user prior to moving on the next task.<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\">&#8211; vSphere API configuration<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\">&#8211; VM details<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vcenter_host<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; cluster<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">datacenter<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; folder<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vm_disk_size<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vm_cpu_count<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vm_memory<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vm_vlan<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vm_vlan_name<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vm_dvswitch<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vm_datatstore<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #7030a0; background-color: #f3f4f6;\"> &#8211;<\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">vmware<\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\"> tools and or <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">open_vm_tools<\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\"> must <\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\">installed<\/span><span style=\"color: #7030a0; background-color: #f3f4f6;\"> the clone template (super important)<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #1f2937; background-color: #f3f4f6;\">Okay so now were on setting up the <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">vmware_guest<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> module using <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">yaml<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> code.<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #1f2937; background-color: #f3f4f6;\">Setting <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">vmware_guest<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> module on ansible: <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #1f2937; background-color: #f3f4f6;\">Now what I like to do is set everything up as a role<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> in ansible<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> to call in your playbooks, it keeps things cleaner and <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">its<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> much easier to find spacing mistakes in your code when writin<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">g in <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">yaml<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">. Lots of <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">NB<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">To<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> aid in checking for mistakes. But ultimately its experience. <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">I\u2019m<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> a bit of both but I tend just pop a vi open and just write and much in there <\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: initial; color: #000000; background-color: #f3f4f6;\">1.<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">Inside your \/etc\/ansible<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #1f2937; background-color: #f3f4f6;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">Create a directory called roles<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #ff0000; background-color: #f3f4f6;\">\uf0fc<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">mkdir<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> roles<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; background-color: #f3f4f6;\">3.<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">Next you want to move inside the that directo<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">ry and create a name directory for this role and then go inside that directory <\/span><\/div>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #ff0000; background-color: #f3f4f6;\">i.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">cd roles<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #ff0000; background-color: #f3f4f6;\">ii.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">mkdir<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> ansible-<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">vmware<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">-deploy<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #ff0000; background-color: #f3f4f6;\">iii.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">cd ansible-<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">vmware<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">-deploy<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; background-color: #f3f4f6;\">4.<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">Next <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">create the following <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">direcorties<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\"> inside \u2018ansible-<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">vmware<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">-deploy\u2019<\/span><\/div>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #ff0000; background-color: #f3f4f6;\">iv.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">mkdir<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> defaults<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #ff0000; background-color: #f3f4f6;\">v.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">mkdir<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> tasks<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; font-weight: bold; color: #2e74b5; background-color: #f3f4f6;\">vi.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">mkdir<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> meta<\/span> <strong><span style=\"color: #2e74b5; background-color: #f3f4f6;\">(this is <\/span><span style=\"color: #2e74b5; background-color: #f3f4f6;\">really only<\/span><span style=\"color: #2e74b5; background-color: #f3f4f6;\"> needed for when you\u2019re setting repositories in <\/span><span style=\"color: #2e74b5; background-color: #f3f4f6;\">bickbucket<\/span><span style=\"color: #2e74b5; background-color: #f3f4f6;\">, git, etc)<\/span><\/strong><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; background-color: #f3f4f6;\">5.<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">move into the <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">tasks<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> directory <\/span><\/div>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #ff0000; background-color: #f3f4f6;\">vii.<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">cd tasks<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 54pt;\"><span style=\"color: #00b050; background-color: #f3f4f6;\">Note: Now we do most of our work in this directory. Your primary <\/span><span style=\"color: #00b050; background-color: #f3f4f6;\">yaml<\/span><span style=\"color: #00b050; background-color: #f3f4f6;\"> file is always called \u201c<\/span><span style=\"color: #00b050; background-color: #f3f4f6;\">main.yml<\/span><span style=\"color: #00b050; background-color: #f3f4f6;\">\u201d Your playbooks always look for this file when trying to call python modules.<\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; background-color: #f3f4f6;\">6.<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">Open your <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">favorite<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> editor vi, nano, joe, visual studio (whatever)<\/span><\/div>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; background-color: #f3f4f6;\">a.<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">Call the file \u201c<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">main.yml<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">\u201d<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; background-color: #f3f4f6;\">b.<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">Inside the file\u2026<\/span><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #000000; background-color: #f3f4f6;\">Setting up the <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">yaml<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: <\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">1. First stage of the <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">yaml<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> is use the http login to the <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> host and successfully authenticate and then grab those session cookies to carry out the next set of tasks which utilise the <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vmware_guest<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> module.<\/span><\/p>\n<\/div>\n<\/div>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&#8211; name: Login into vCenter and get cookies<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">delegate_<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">to<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">:<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> localhost<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">uri<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> url: https:\/<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">\/{<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter_host<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}\/rest\/com\/<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vmware<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">\/cis\/session<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">force_basic_auth<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: yes<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">validate_certs<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: no<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> method: POST<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> user: &#8216;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_username<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8217;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> password: &#8216;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_password<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8217;<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 18pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> register: login<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">2. Okay so this where we are now actually calling the <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vmware_guest<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> module in <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">yaml<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">. You can see that the code has a lot of areas that are <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">variablelised<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">. <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">These variable<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> are passed in a couple of ways. <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">You need to pass the defaults through the defaults directory we created earlier, and the second is host specific variables which will be under your <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">host_vars<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> directory under your inventory structure, which we will get into later.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><strong><span style=\"color: #000000; background-color: #f3f4f6;\"><em>Note: Now remember this is code to deploy from an existing cloned template you have sitting on datastore somewhere in your environment. The process to deploy a <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> using kickstart using DHCP that\u2019s bit different to setup <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> I wrote this to help out those people who <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>cant<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> see the wisdom and efficiency of having <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>DHCP\u2019d<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> deployments <\/em><\/span><\/strong><\/p>\n<p><strong><span style=\"color: #000000; background-color: #f3f4f6;\">You will be passing these variables<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&#8211; name: Create a VM<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vmware_guest<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> hostname: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_host<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> username: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_username<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> password: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_password<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">validate_certs<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: False<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> cluster: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_cluster<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">datacenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vcenter<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_dc<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #000000; background-color: #f3f4f6;\"><em>Note: name: This will be the name of the new <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> created. Keep in mind the <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> host will also be setup with a <\/em><\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"><em>shortname<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> for the hostname of the server<\/em><\/span> <span style=\"color: #ff0000; background-color: #f3f4f6;\"><em>not the FQDN<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>. You can probably fix this using <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vmshell<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> or I used <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>a completely separate<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> role to setup the network for physical machines which uses jinja templates and inside the role I passed the new name as a variable. But <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>that\u2019s<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> for another post <\/em><\/span><\/strong><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> name: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">inventory<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_hostname<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> folder: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_folder<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> template: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">VMTemplate<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> state: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_state<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">Note: <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">guest_id<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: this is what kind of OS will the VM Run<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">, almost every hypervisor asks that prior to creating a <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">. You can find the list online.<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">guest_id<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_guest_id<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #000000; background-color: #f3f4f6;\"><em>Note: d<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>isk: <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>this section you could technically pass it through as a variable in your <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>host_vars<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> on the specific hosts, but since were using a template. I kept these parameters static here inside the role.<\/em><\/span><\/strong><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> disk:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">size_gb<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: 80<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> type: thin<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> datastore: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_datastore<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> &#8211; <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">size_gb<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: 100<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> type: thin<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> datastore: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_datastore<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> hardware:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">memory_mb<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_memory<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">num_cpus<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_cpu_count<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">scsi<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: paravirtual<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #000000; background-color: #f3f4f6;\"><em>Note: Customization: This section is very important because without it your<\/em><\/span> <span style=\"color: #000000; background-color: #f3f4f6;\"><em>dns<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> in \/etc\/<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>resolv.conf<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> will not be configured correctly. A lot of people have a hell of time with this on the net, as the parsing of this in <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>yaml<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> is bit tricky, and people resort to using <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm_guest_file<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> to update the \/etc\/<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>resolv.conf<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>, which sucks because now you need the root\/pass via <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>ssh<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>. <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>My way will work <\/em><\/span><\/strong><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"><br \/>\ncustomization:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">dns_servers<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_dns_servers<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">dns_suffix<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_dns_suffix<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #000000; background-color: #f3f4f6;\"><em><br \/>\nNote: networks: This section is the section which will use <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vmware<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>-tools or <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>open_vm_tools<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> to update the network config on host after powering on the <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm, but before the OS is booted,<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>&nbsp;provided you said to power it on in your <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>host_var<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> file. This section helps people get around the issue of having no DHCP and having to deploy each server using the same static address on a dedicated <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vlan<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>. This section will go and update the <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> network parameters and the template <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> will deploy on a&nbsp; whatever&nbsp;<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vlan<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>, with different <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>ip<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>, gateway, netmask. <\/em><\/span> <span style=\"color: #000000; background-color: #f3f4f6;\"><em>It will also register a new <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>mac address to the <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>, so you <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>don\u2019t<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> end up with <\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em>vm\u2019s<\/em><\/span><span style=\"color: #000000; background-color: #f3f4f6;\"><em> with duplicate mac-addresses. Lastly, it will update \/etc\/hosts with the new ip and shortname of the server<\/em><\/span><\/strong><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"><br \/>\nnetworks:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> &#8211; name: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_vlan_name<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> type: static<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">dvswitch_name<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_dvswitch<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">ip<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_ip<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> netmask: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_netmask<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> gateway: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_gateway<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">start_connected<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: &#8220;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">{{ <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">_connected<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> }}&#8221;<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"># <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">wait_for_ip_address<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">: yes<\/span> <strong><span style=\"color: #000000; background-color: #f3f4f6;\">(this is if you are using DHCP)<\/span><\/strong><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\">&nbsp;&nbsp;<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">delegate_<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">to<\/span><span style=\"color: #000000; background-color: #f3f4f6;\">:<\/span><span style=\"color: #000000; background-color: #f3f4f6;\"> localhost<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"color: #000000; background-color: #f3f4f6;\"> register: <\/span><span style=\"color: #000000; background-color: #f3f4f6;\">vm_deploy<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"background-color: #f3f4f6;\"><em>Note<\/em><\/span><span style=\"background-color: #f3f4f6;\"><em>: This section is just <\/em><\/span><span style=\"background-color: #f3f4f6;\"><em>spits<\/em><\/span><span style=\"background-color: #f3f4f6;\"><em> out verbose information on the how the build went and the mac-address of the <\/em><\/span><span style=\"background-color: #f3f4f6;\"><em>vm<\/em><\/span><span style=\"background-color: #f3f4f6;\"><em>. This hand to pay attention to so you can ensure your template mac and your new <\/em><\/span><span style=\"background-color: #f3f4f6;\"><em>vm<\/em><\/span> <span style=\"background-color: #f3f4f6;\"><em>don\u2019t<\/em><\/span><span style=\"background-color: #f3f4f6;\"><em> have duplicate macs. If you do. You will need to go into <\/em><\/span><span style=\"background-color: #f3f4f6;\"><em>vshere<\/em><\/span><span style=\"background-color: #f3f4f6;\"><em> find the VM. Remove the network and readd it manually, to register a new mac<\/em><\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"background-color: #f3f4f6;\">&#8211; debug: <\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"background-color: #f3f4f6;\"> var: vm_<\/span><span style=\"background-color: #f3f4f6;\">deploy.instance<\/span><span style=\"background-color: #f3f4f6;\">.hw_eth0.macaddress<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"background-color: #f3f4f6;\">&#8211; debug:<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"background-color: #f3f4f6;\"> var: <\/span><span style=\"background-color: #f3f4f6;\">deploy_vm<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"background-color: #f3f4f6;\">&#8211; debug:<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"background-color: #f3f4f6;\"> var: mac<\/span><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000;\">7.<\/span><span style=\"color: #404040;\">Okay <\/span><span style=\"color: #404040;\">so now we need to setup our defaults to pass the to role we just created.<\/span><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #404040;\">So<\/span><span style=\"color: #404040;\"> go into your defaults directory for the role<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #ff0000; font-size: 10pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">cd \/etc\/ansible\/roles\/<\/span><span style=\"color: #ff0000;\">ansible-<\/span><span style=\"color: #ff0000;\">vmware<\/span><span style=\"color: #ff0000;\">-deploy\/defaults<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #000000;\">Create another file called \u2018<\/span><span style=\"color: #000000;\">main.yml<\/span><span style=\"color: #000000;\">\u2019 <\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #ff0000; font-size: 10pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Vi <\/span><span style=\"color: #ff0000;\">main.yml<\/span><span style=\"color: #ff0000;\"> and copy the contents below.<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"background-color: #f3f4f6;\"><em>Not<\/em><\/span><span style=\"background-color: #f3f4f6;\"><em>: Its easier to put all your defaults here and then comment out the ones you want to pass through your <\/em><\/span><span style=\"background-color: #f3f4f6;\"><em>host_vars<\/em><\/span><span style=\"background-color: #f3f4f6;\"><em> specific files after you got it working the way you want.<\/em><\/span><\/strong><\/p>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">&#8212;<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vm_disks: 100<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vm_cpu_count: 2<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vm_state: present<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vm_memory: 2048<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">#vm_datastore: vmfs-datastore1234<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vcenter_username: BruceWayne<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vcenter_password: <span style=\"color: #00b0f0;\">( you<\/span><span style=\"color: #00b0f0;\"> will put <\/span><span style=\"color: #00b0f0;\">ansible_vault<\/span><span style=\"color: #00b0f0;\"> encrypted variable here<\/span><span style=\"color: #00b0f0;\">, for now just put in your password for tes<\/span><span style=\"color: #00b0f0;\">t<\/span><span style=\"color: #00b0f0;\">ing)<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vm_dvswitch: DvSwitch<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vcenter_cluster: ProdCluster<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vcenter_host: vcenter.nicktailor.com<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vcenter_dc: London<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">#vm_folder: \/Production\/Unix\/<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">#vm_vlan_name: VM76123<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">vm_guest_id: rhel7_64Guest<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">#VMTemplate: redhat-template2020<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 10pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span>Save the file defaults\/main.yml<\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong>Ansible Hosts and Inventory:<\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong>Okay so this is where everyone handles things uniquely. I personally like to take the approach of creating inventory based on environment. Its logical and the best way to manage hosts in very large infrastructures. <\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong>So if you have DEV\/STAGING\/PRODUCTION as your environments. Then I would set it up as such<\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1. Inside your \/etc\/ansible directory create the following<\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Mkdir<\/span><span style=\"color: #ff0000;\"> -p \/etc\/ansible\/inventory<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Mkdir<\/span><span style=\"color: #ff0000;\"> -p \/etc\/ansible\/inventory\/DEV<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Mkdir<\/span><span style=\"color: #ff0000;\"> -p \/etc\/ansible\/inventory\/STAGING<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Mkdir<\/span><span style=\"color: #ff0000;\"> -p \/etc\/ansible\/inventory\/PRODUCTION<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: initial; color: #000000; font-size: 12pt;\">2.<\/span>Inside each environment(DEV,STAGING,PROODUCTION) one you want to create the following:<\/div>\n<p style=\"text-align: left; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Mkdir<\/span><span style=\"color: #ff0000;\"> -p \/etc\/ansible\/inventory\/DEV<\/span><span style=\"color: #ff0000;\">\/<\/span><span style=\"color: #ff0000;\">group_vars<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 90pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\"><span style=\"position: absolute; top: -0.37em; left: 0; font-size: 2em;\">\u25e6<\/span>&nbsp;<\/span><span style=\"color: #000000;\">This is where you can pass group variables if you have hosts setup as groups in your hosts file that we just created.<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Mkdir<\/span><span style=\"color: #ff0000;\"> -p \/etc\/ansible\/inventory\/DEV<\/span><span style=\"color: #ff0000;\">\/<\/span><span style=\"color: #ff0000;\">host<\/span><span style=\"color: #ff0000;\">_vars<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 90pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\"><span style=\"position: absolute; top: -0.37em; left: 0; font-size: 2em;\">\u25e6<\/span>&nbsp;<\/span><span style=\"color: #000000;\">This is where you pass specific variables per host<\/span><span style=\"color: #000000;\"> instead of groups<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Touch <\/span><span style=\"color: #ff0000;\">\/etc\/ansible\/inventory\/DEV\/hos<\/span><span style=\"color: #ff0000;\">ts<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: initial; color: #000000; font-size: 12pt;\">3.<\/span><span style=\"color: #000000;\">Open up<\/span><span style=\"color: #000000;\"> one of the host files in your <\/span><span style=\"color: #000000;\">favorite<\/span><span style=\"color: #000000;\"> editor vi, nano, joe, visual studio, etc\u2026.<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #ff0000;\">vi \/etc\/ansible\/inventory\/DEV\/hosts<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">For the purposes of this <\/span><span style=\"color: #000000;\">post<\/span><span style=\"color: #000000;\"> we are just going to<br \/>\ncreate one group<br \/>\n=====================================<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">[All]<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">nicktestvm.nicktailor.com <\/span><span style=\"color: #000000;\">ansible_host<\/span><span style=\"color: #000000;\">=192.168.1.200<\/span><\/p>\n<p>=====================================<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #000000;\">Save file<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><span style=\"color: #000000;\">Note: <\/span><span style=\"color: #000000;\">ansible_host<\/span><span style=\"color: #000000;\">=(<\/span><span style=\"color: #000000;\">ip<\/span><span style=\"color: #000000;\">) This is used when you want to override <\/span><span style=\"color: #000000;\">dns<\/span><span style=\"color: #000000;\"> of the host and tell ansible. Do not resolve the <\/span><span style=\"color: #000000;\">dns<\/span><span style=\"color: #000000;\"> this host only connect to this <\/span><span style=\"color: #000000;\">ip<\/span><span style=\"color: #000000;\">. You don\u2019t need this here, however if <\/span><span style=\"color: #000000;\">your\u2019re<\/span><span style=\"color: #000000;\"> using \u2018a\u2019 static address to deploy <\/span><span style=\"color: #000000;\">vm\u2019s<\/span><span style=\"color: #000000;\"> initially and not using <\/span><span style=\"color: #000000;\">vmwre_tools<\/span><span style=\"color: #000000;\"> to configure the <\/span><span style=\"color: #000000;\">network, and<\/span><span style=\"color: #000000;\"> went with SSH after<\/span><span style=\"color: #000000;\"> for configuration of the host<\/span><span style=\"color: #000000;\">. Then it will need to know which host to connect to setup the network. <\/span><span style=\"color: #000000;\">So<\/span><span style=\"color: #000000;\"> I just like to have there in<\/span> <span style=\"color: #000000;\">case I want to temporary tell ansible look here for this server.<\/span><\/strong><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: initial; color: #000000; font-size: 12pt;\">4.<\/span><span style=\"color: #000000;\">Now we want to create <\/span><span style=\"color: #000000;\">host_var<\/span><span style=\"color: #000000;\"> for the specific VM host we want to deploy. <\/span><\/div>\n<p style=\"text-align: left; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #000000;\">Create a <\/span><span style=\"color: #000000;\">host_var<\/span><span style=\"color: #000000;\"> file for the new host you want to <\/span><span style=\"color: #000000;\">deplo<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 90pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; font-size: 12pt;\">\uf0fc<\/span><strong><span style=\"color: #ff0000;\">Vi <\/span><\/strong><span style=\"color: #ff0000;\">\/etc\/ansible\/inventory\/DEV<\/span><span style=\"color: #ff0000;\">\/<\/span><span style=\"color: #ff0000;\">host_vars<\/span><span style=\"color: #ff0000;\">\/<\/span><span style=\"color: #ff0000;\">nicktestvm<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"text-align: left; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><strong><span style=\"color: #000000;\"><em>Note: You can see all the variables that were in the role and defaults are now being passed through here for this specific host. It <\/em><\/span><span style=\"color: #000000;\"><em>has to<\/em><\/span><span style=\"color: #000000;\"><em> be done in this fashion for it all work correctly. If you pass all this through the role may <\/em><\/span><span style=\"color: #000000;\"><em>crap<\/em><\/span><span style=\"color: #000000;\"><em> out on you.<\/em><\/span><\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><span style=\"color: #000000;\">#vm_requirements<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_ip<\/span><span style=\"color: #000000;\">:<\/span><span style=\"color: #000000;\"> 192.168.1.86<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_netmask<\/span><span style=\"color: #000000;\">: 255.255.255.0<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_gateway<\/span><span style=\"color: #000000;\">: <\/span><span style=\"color: #000000;\">192.168.1.1<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_vlan_name<\/span><span style=\"color: #000000;\">: <\/span>VM76123<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">VMTemplate<\/span><span style=\"color: #000000;\">: <\/span><span style=\"color: #000000;\">redhat-template2020<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_folder<\/span><span style=\"color: #000000;\">: <\/span><span style=\"color: #000000;\">\/Production\/Unix<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_state<\/span><span style=\"color: #000000;\">: <\/span><span style=\"color: #000000;\">poweredon<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_connected<\/span><span style=\"color: #000000;\">: true<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_datastore<\/span><span style=\"color: #000000;\">: vmfs-datastore1234<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><span style=\"color: #000000;\"><em>note: <\/em><\/span><span style=\"color: #000000;\"><em>vm_dns_servers<\/em><\/span><span style=\"color: #000000;\"><em>: this section is very important. This was the only way I could get the <\/em><\/span><span style=\"color: #000000;\"><em>dns<\/em><\/span><span style=\"color: #000000;\"><em> server to parse and update the \/etc\/<\/em><\/span><span style=\"color: #000000;\"><em>resolv.conf<\/em><\/span><span style=\"color: #000000;\"><em> properly. If you <\/em><\/span><span style=\"color: #000000;\"><em>list<\/em><\/span><span style=\"color: #000000;\"><em> them out individually as one <\/em><\/span><span style=\"color: #000000;\"><em>lineers<\/em><\/span><span style=\"color: #000000;\"><em>. It seems to be a bug and will simply empty out the file, which will leave your vm unable to resolve dns.<\/em><\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_dns_servers<\/span><span style=\"color: #000000;\">: [<\/span><span style=\"color: #000000;\">8.8.8.1<\/span><span style=\"color: #000000;\">, <\/span><span style=\"color: #000000;\">8.8.8.2<\/span><span style=\"color: #000000;\">]<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"color: #000000;\">vm_dns_suffix<\/span><span style=\"color: #000000;\">: <\/span><span style=\"color: #000000;\">nicktailor.co.uk<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #000000;\">Save the file<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><span style=\"color: #000000;\">Setting Ansible Vault and Encrypted variables<\/span><span style=\"color: #000000;\">:<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: initial; color: #000000; font-size: 12pt;\">5.<\/span><span style=\"color: #000000;\">Setting up the <\/span><span style=\"color: #000000;\">vmware<\/span><span style=\"color: #000000;\">-user password to be encrypted using ansible vault. Now this can be easily decrypted by anyone who has the vault password. But the benefit is that <\/span><span style=\"color: #000000;\">its<\/span><span style=\"color: #000000;\"> not directly visible in your open code for prying as eyes. Which is just a generally good idea<\/span><span style=\"color: #000000;\">.<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #000000;\">So<\/span><span style=\"color: #000000;\"> you want to create vault password for the variable in side defaults which was \u201c<\/span><span style=\"color: #000000;\">vcenter_password<\/span><span style=\"color: #000000;\">\u201d. Keep in mind variable is <\/span><span style=\"color: #000000;\">apart<\/span><span style=\"color: #000000;\"> of the encrypted process.<\/span><br \/>\n<span style=\"color: #000000;\"><br \/>\nthere a couple of ways to do this you can do it via file, or via prompt. <\/span><span style=\"color: #000000;\">I\u2019m<\/span><span style=\"color: #000000;\"> going to show you how to do it via file.<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #000000;\">First create a vault password file<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 144pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Echo \u201cpassword\u201d &gt;&gt; vault.pw.txt<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 144pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #ff0000;\">Cat vault.pw.txt (to ensure the password is now there) <\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 180pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.37em; left: 0; font-size: 2em;\">\u25e6<\/span>&nbsp;<\/span><strong><span style=\"color: #000000;\">This the password for the<\/span><span style=\"color: #000000;\"> ansible<\/span><span style=\"color: #000000;\"> vault not the password for your <\/span><span style=\"color: #000000;\">vcenter_password<\/span><\/strong><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 12pt;\">\uf0fc<\/span><span style=\"color: #000000;\">Now encrypt the <\/span><span style=\"color: #000000;\">vcenter_password<\/span><span style=\"color: #000000;\"> as a <\/span><span style=\"color: #000000;\">varible<\/span><span style=\"color: #000000;\"> inside the vault as id1. It good to use id\u2019s <\/span><span style=\"color: #000000;\">incase<\/span><span style=\"color: #000000;\"> you <\/span><span style=\"color: #000000;\">you<\/span><span style=\"color: #000000;\"> want to have multiple passwords inside your vault.<\/span><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 108pt;\"><strong><span style=\"color: #000000;\"><em>Note: the \u2013-name is the variable you want to pass in your code. So whatever you call that <\/em><\/span><span style=\"color: #000000;\"><em>has to<\/em><\/span><span style=\"color: #000000;\"><em> be there.<\/em><\/span><\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\">ansible-vault <\/span><span style=\"color: #ff0000;\">encrypt_string<\/span><span style=\"color: #ff0000;\"> &#8211;vault-id 1@vault.pass.txt &#8216;<\/span><span style=\"color: #ff0000;\">vcenter<\/span><span style=\"color: #ff0000;\">-password-here&#8217; &#8211;name &#8216;<\/span><span style=\"color: #ff0000;\">vcenter_password<\/span><span style=\"color: #ff0000;\">&#8216;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\">vcenter_password<\/span><span style=\"color: #ff0000;\">: !vault<\/span><span style=\"color: #ff0000;\"> |<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> $ANSIBLE_VAULT;1.<\/span><span style=\"color: #ff0000;\">2;AES<\/span><span style=\"color: #ff0000;\">256;1<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 31623638366337643437633065623538663565336232333863303763336364396438663032363364<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 3665376363663839306165663435356365643965343364310a313832393261363466393237666666<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 36666437626563386366653938383565663361646333333732336439356633616231653639626465<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 3130656134383365320a323032366238303366336562653865663130333963316237393839373830<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 65396139323739323266643961653766333633366638336435613933373966643561<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\">Encryption successful<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: initial; color: #000000; font-size: 12pt;\">6.<\/span><span style=\"color: #000000;\">Okay now you want copy <\/span><span style=\"color: #000000;\">by highlighting this section below<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\">vcenter_password<\/span><span style=\"color: #ff0000;\">: !vault<\/span><span style=\"color: #ff0000;\"> |<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> $ANSIBLE_VAULT;1.<\/span><span style=\"color: #ff0000;\">2;AES<\/span><span style=\"color: #ff0000;\">256;1<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 31623638366337643437633065623538663565336232333863303763336364396438663032363364<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 3665376363663839306165663435356365643965343364310a313832393261363466393237666666<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 36666437626563386366653938383565663361646333333732336439356633616231653639626465<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 3130656134383365320a323032366238303366336562653865663130333963316237393839373830<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #ff0000;\"> 65396139323739323266643961653766333633366638336435613933373966643561<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #000000;\">open your \/etc\/ansible\/roles\/ansible-<\/span><span style=\"color: #000000;\">vmware<\/span><span style=\"color: #000000;\">-deploy\/defaults\/<\/span><span style=\"color: #000000;\">main.yml<\/span><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; font-size: 12pt;\">\uf0fc<\/span><strong><span style=\"color: #ff0000;\">vi <\/span><\/strong><span style=\"color: #ff0000;\">etc\/ansible\/roles\/ansible-<\/span><span style=\"color: #ff0000;\">vmware<\/span><span style=\"color: #ff0000;\">-deploy\/defaults\/<\/span><span style=\"color: #ff0000;\">main.yml<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><span style=\"color: #000000;\">Next replace the whole \u2018<\/span><span style=\"color: #000000;\">vcenter_password<\/span><span style=\"color: #000000;\">\u2019 line with the highlight section above and save the file.<\/span><\/div>\n<ul>\n<li><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; font-size: 12pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">&nbsp;\u2022<\/span>&nbsp;<\/span><span style=\"color: #000000;\"> You should also store the vault password somewhere offsite in some password database and delete the vault.pass.txt file you created.<\/span><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><strong><span style=\"color: #1f2937; background-color: #f3f4f6;\">Deploy VM with ansible<\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">: <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; background-color: #f3f4f6;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><strong><span style=\"color: #1f2937; background-color: #f3f4f6;\">From inside the \/etc\/ansible directory you now need to create your playbook that will call the role you just setup.<\/span><\/strong><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; background-color: #f3f4f6;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><strong><span style=\"color: #1f2937; background-color: #f3f4f6;\">Create a new playbook file <\/span><span style=\"color: #1f2937; background-color: #f3f4f6;\">standard_build.yml<\/span><\/strong><\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; background-color: #f3f4f6;\">\uf0fc<\/span><strong><span style=\"color: #ff0000; background-color: #f3f4f6;\">Vi <\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">standard_build.yml<\/span><\/strong><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; background-color: #f3f4f6;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><strong><span style=\"color: #1f2937; background-color: #f3f4f6;\">Now add the following: <\/span><\/strong><\/div>\n<p style=\"text-align: left; margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><strong><span style=\"color: #ff0000; background-color: #f3f4f6;\">&#8211; hosts: all<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><strong><span style=\"color: #ff0000; background-color: #f3f4f6;\">&nbsp;&nbsp;<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">gather_facts<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">: no<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 5pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><strong><span style=\"color: #ff0000; background-color: #f3f4f6;\"> roles: <\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><strong><span style=\"color: #ff0000; background-color: #f3f4f6;\"> &#8211; role: ansible-<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">vmware<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">-deploy<\/span><\/strong><\/p>\n<\/div>\n<\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #1f2937; background-color: #f3f4f6;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><strong><span style=\"color: #1f2937; background-color: #f3f4f6;\">Save the file<\/span><\/strong><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; background-color: #f3f4f6;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><strong><span style=\"color: #1f2937; background-color: #f3f4f6;\">Now you want to call the new role to deploy against the environment and specific host we setup earlier<\/span><\/strong><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; background-color: #f3f4f6;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><strong><span style=\"color: #1f2937; background-color: #f3f4f6;\">Still from inside the \/etc\/ansible directory you want to run all your playbooks from here<\/span><\/strong><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt; margin-left: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-weight: bold; color: #000000; background-color: #f3f4f6;\">\uf0fc<\/span><strong><span style=\"color: #ff0000; background-color: #f3f4f6;\">ansible-playbook &#8211;<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">i<\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\"> inventory\/DEV\/hosts \u2013-ask-vault <\/span><span style=\"color: #ff0000; background-color: #f3f4f6;\">standard_build.yml<\/span> <\/strong><\/div>\n<\/div>\n<\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.8; font-size: 12pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><span style=\"color: #000000;\">Note<\/span><span style=\"color: #000000;\">: Important thing to remember when deploying <\/span><span style=\"color: #000000;\">linux<\/span><span style=\"color: #000000;\"> machines from a template is that all your machines will have the same &#8216;Network&#8217; UUID as the template machine. If you define these&#8230;. You will need to write some code to fix that up after the VM is deployed and powered up. Check&nbsp; out the link below on how to do that.<br \/>\n<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><span style=\"color: #000000;\"><a href=\"https:\/\/www.nicktailor.com\/?p=1177\">https:\/\/www.nicktailor.com\/?p=1177<\/a><br \/>\n<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p><em><strong>Special Note: if you attempt to deploy multiple hosts at the same time. This will deploy 5 clones in parallel at a time and not one by one. Which will reduce deployment time significantly. I didnt bother to see if i could override this&#8230;.:)<\/strong><\/em><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><span style=\"color: #000000;\">Output<\/span><span style=\"color: #000000;\"> log of successful automated ansible deploy<\/span><span style=\"color: #000000;\">: <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #000000;\">[<\/span><span style=\"color: #000000;\">root@nickansible<\/span><span style=\"color: #000000;\">]#<\/span><span style=\"color: #000000;\"> ansible-playbook &#8211;<\/span><span style=\"color: #000000;\">i<\/span><span style=\"color: #000000;\"> inventory\/DEV\/hosts <\/span><span style=\"color: #000000;\">standard_build.yml<\/span><span style=\"color: #000000;\"> &#8211;ask-vault &#8211;limit &#8216;<\/span><span style=\"color: #000000;\">nicktestvm<\/span><span style=\"color: #000000;\">&#8216;<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #000000;\">Vault password: (paste password here in your shell window)<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">PLAY [all] ****************************************************************************************************************************************************************************************************<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">TASK [ansible-<\/span><span style=\"color: #00b050;\">vmware<\/span><span style=\"color: #00b050;\">-deploy : Validate Project Requirements] **********************************************************************************************************************************************<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">ok<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">TASK [ansible-<\/span><span style=\"color: #00b050;\">vmware<\/span><span style=\"color: #00b050;\">-deploy : Login into vCenter and get cookies] *****************************************************************************************************************************************<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">ok: [<\/span><span style=\"color: #00b050;\">nicktestvm<\/span><span style=\"color: #00b050;\">]<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">TASK [ansible-<\/span><span style=\"color: #00b050;\">vmware<\/span><span style=\"color: #00b050;\">-deploy : Create a VM] ****************************************************************************************************************************************************************<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">changed: [<\/span><span style=\"color: #00b050;\">nicktestvm<\/span><span style=\"color: #00b050;\">]<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">TASK [ansible-<\/span><span style=\"color: #00b050;\">vmware<\/span><span style=\"color: #00b050;\">-deploy : debug] **********************************************************************************************************************************************************************<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">ok: [<\/span><span style=\"color: #00b050;\">nicktestvm<\/span><span style=\"color: #00b050;\">] =&gt; {<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\"> &#8220;vm_<\/span><span style=\"color: #00b050;\">deploy.instance<\/span><span style=\"color: #00b050;\">.hw_eth0.macaddress&#8221;: &#8220;00:40:51:53:11:a6&#8221;<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">}<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #00b050;\">nicktestvm<\/span><span style=\"color: #00b050;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #00b050;\"> :<\/span><span style=\"color: #00b050;\"> ok=<\/span><span style=\"color: #00b050;\">4<\/span><span style=\"color: #00b050;\"> changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>QUICK OVERVIEW OF WHAT ANSIBLE IS.. Ansible is a radically simple IT automation engine that automates&nbsp;cloud provisioning,&nbsp;configuration management,&nbsp;application deployment,&nbsp;intra-service orchestration, and many other IT needs. Designed for multi-tier deployments since day one, Ansible models your IT infrastructure by describing how all of your systems inter-relate, rather than just managing one system at a time. It uses no agents and no<a href=\"https:\/\/nicktailor.com\/tech-blog\/how-to-deploy-vmware-vm-using-ansible-from-a-clone-templates\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51,129],"tags":[],"class_list":["post-1139","post","type-post","status-publish","format-standard","hentry","category-ansible","category-vmware"],"_links":{"self":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/comments?post=1139"}],"version-history":[{"count":43,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1139\/revisions"}],"predecessor-version":[{"id":1566,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1139\/revisions\/1566"}],"wp:attachment":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/media?parent=1139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/categories?post=1139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/tags?post=1139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}