{"id":1281,"date":"2021-05-09T18:39:54","date_gmt":"2021-05-09T18:39:54","guid":{"rendered":"https:\/\/www.nicktailor.com\/?p=1281"},"modified":"2024-04-30T05:49:56","modified_gmt":"2024-04-30T05:49:56","slug":"how-to-create-a-new-host-in-foreman-with-ansible","status":"publish","type":"post","link":"https:\/\/nicktailor.com\/tech-blog\/how-to-create-a-new-host-in-foreman-with-ansible\/","title":{"rendered":"How to Create a New Host in Foreman with Ansible"},"content":{"rendered":"<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong>Okay\u2026this one was quite difficult to find online<\/strong>. Seems like the ansible documentation for the foreman module was seriously lacking or not kept up to date by anyone. I searched for awhile to see if anyone had an actual working model of it.<br \/>\n<strong>Not<\/strong> even in the<strong> ansible chat rooms<\/strong> did anyone know&#8230;.which was weak.<\/p>\n<p><strong>So I spent some time getting this to work smoothly, and you will probably not find anywhere else on the web on how to do this. If you do show me\u2026.so I can kick myself.<\/strong><\/p>\n<p>Lets get dangerous then. \ud83d\ude0a<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\">Step by step:<\/p>\n<p><strong>Foreman \u2013 Already setup and your \u201c<span style=\"color: #0070c0;\">computer resource<\/span>\u201d is hooked in (<span style=\"color: #00b050;\">VMware<\/span>)<\/strong><br \/>\n<strong><span style=\"color: #c00000;\"><em>Note: The compute<\/em><\/span><span style=\"color: #c00000;\"><em> profile<\/em><\/span><span style=\"color: #c00000;\"><em>(<\/em><\/span><span style=\"color: #c00000;\"><em>vmware<\/em><\/span><span style=\"color: #c00000;\"><em>) when<\/em><\/span><span style=\"color: #c00000;\"><em> hooked in<\/em><\/span><span style=\"color: #c00000;\"><em>,<\/em><\/span> <span style=\"color: #c00000;\"><em>will<\/em><\/span><span style=\"color: #c00000;\"><em> also<\/em><\/span><span style=\"color: #c00000;\"><em> trigger a new <\/em><\/span><span style=\"color: #c00000;\"><em>vm<\/em><\/span><span style=\"color: #c00000;\"><em> creation in <\/em><\/span><span style=\"color: #c00000;\"><em>vsphere<\/em><\/span><span style=\"color: #c00000;\"><em> prepped to do DHCP. <\/em><\/span><span style=\"color: #c00000;\"><em>You can combine variables from <\/em><\/span><span style=\"color: #00b050;\"><em>vmware_guest<\/em><\/span> <span style=\"color: #c00000;\"><em>module and this module as they require similar variables to be passed. To setup a one stop <\/em><\/span><span style=\"color: #c00000;\"><em>shop<\/em><\/span><span style=\"color: #c00000;\"><em> to deploy in foreman and <\/em><\/span><span style=\"color: #c00000;\"><em>vmware<\/em><\/span><span style=\"color: #c00000;\"><em> with just using ansible. <\/em><\/span><span style=\"color: #c00000;\"><em>Iv<\/em><\/span><span style=\"color: #c00000;\"><em> done this already<\/em><\/span><span style=\"color: #c00000;\"><em>\u2026..<\/em><\/span><\/strong><br \/>\n<strong><span style=\"color: #c00000;\"><em><br \/>\nSpecial notes: The foreman I had setup did not have organisation or location configured. This caused the module to not function properly and I had to contact one of the developers who helped me patch the code so I didn\u2019t require them to be configured or defined. Which I will show you all how to do.<\/em><\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong>Ansible \u2013 Assuming you have it setup and working with <span style=\"color: #ff0000;\">python 2.7 not sure this module will work with python 3. <\/span><span style=\"color: #ff0000;\">Havent<\/span><span style=\"color: #ff0000;\"> tried that yet<\/span><span style=\"color: #ff0000;\">\u2026..<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong>Module \u2013 TheForeman Collection<\/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;\"><strong><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000;\">1.<\/span>To install it<\/strong><\/div>\n<div class=\"ol\" 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: 72pt;\"><strong><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">a.<\/span><span style=\"color: #c20f45; background-color: #f9f2f4;\">ansible-galaxy collection install <\/span><span style=\"color: #c20f45; background-color: #f9f2f4;\">theforeman.foreman<\/span><\/strong><\/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: 72pt;\"><strong><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">b.<\/span>edit ansible.cfg file and add the following lines.<\/strong><\/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;\"><strong><span style=\"color: #ff0000;\">Note: You can find the locations of these certs on foreman server. You will to copy them over to ansible for the <\/span><span style=\"color: #ff0000;\">callback<\/span><span style=\"color: #ff0000;\"> to work properly. However, it is not needed to complete the host creation, you likely just see an error at the end of the play.<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><strong><span style=\"color: #0070c0;\">[<\/span><span style=\"color: #0070c0;\">callback_foreman<\/span><span style=\"color: #0070c0;\">]<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><strong><span style=\"color: #0070c0;\">url<\/span><span style=\"color: #0070c0;\"> = &#8216;http:\/\/foreman-1.tdr.corp-apps.com&#8217;<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><strong><span style=\"color: #0070c0;\">ssl_cert<\/span><span style=\"color: #0070c0;\"> = \/etc\/foreman-proxy\/<\/span><span style=\"color: #0070c0;\">ssl-cert.pem<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><strong><span style=\"color: #0070c0;\">ssl_key<\/span><span style=\"color: #0070c0;\"> = \/etc\/foreman-proxy\/<\/span><span style=\"color: #0070c0;\">ssl-pvt.pem<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><strong><span style=\"color: #0070c0;\">verify_certs<\/span><span style=\"color: #0070c0;\"> = \/etc\/foreman-proxy\/<\/span><span style=\"color: #0070c0;\">ssl<\/span><span style=\"color: #0070c0;\">-ca<\/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: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 18pt;\">Okay once installed you. If you look at the ansible documentation on how to manage hosts using this module\u2026from redhat.<\/p>\n<p><span style=\"color: #ff0000;\">It utterly useless\u2026and will not work if you try to use the examples below.<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><a href=\"https:\/\/people.redhat.com\/evgeni\/fam-antsibull\/plugins\/host_module.html\">https:\/\/people.redhat.com\/evgeni\/fam-antsibull\/plugins\/host_module.html<\/a><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #404040;\">&#8211; <\/span><strong><span style=\"color: #062873;\">name<\/span><\/strong><span style=\"color: #404040;\">: <\/span><span style=\"color: #4070a0;\">&#8220;Create<\/span> <span style=\"color: #4070a0;\">a<\/span> <span style=\"color: #4070a0;\">host&#8221;<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"color: #404040;\">&nbsp; &nbsp;&nbsp;<\/span><strong><span style=\"color: #062873;\">host<\/span><\/strong><span style=\"color: #404040;\">:<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"color: #404040;\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><strong><span style=\"color: #062873;\">username<\/span><\/strong><span style=\"color: #404040;\">: <\/span><span style=\"color: #4070a0;\">&#8220;admin&#8221;<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"color: #404040;\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><strong><span style=\"color: #062873;\">password<\/span><\/strong><span style=\"color: #404040;\">: <\/span><span style=\"color: #4070a0;\">&#8220;<\/span><span style=\"color: #4070a0;\">changeme<\/span><span style=\"color: #4070a0;\">&#8220;<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"color: #404040;\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><strong><span style=\"color: #062873;\">server_url<\/span><\/strong><span style=\"color: #404040;\">: <\/span><span style=\"color: #4070a0;\">&#8220;https:\/\/foreman.example.com&#8221;<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"color: #404040;\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><strong><span style=\"color: #062873;\">name<\/span><\/strong><span style=\"color: #404040;\">: <\/span><span style=\"color: #4070a0;\">&#8220;<\/span><span style=\"color: #4070a0;\">new_host<\/span><span style=\"color: #4070a0;\">&#8220;<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"color: #404040;\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><strong><span style=\"color: #062873;\">hostgroup<\/span><\/strong><span style=\"color: #404040;\">: <\/span><span style=\"color: #404040;\">my_hostgroup<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"color: #404040;\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><strong><span style=\"color: #062873;\">state<\/span><\/strong><span style=\"color: #404040;\">: present<\/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<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;\"><strong><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 9pt;\">2.<\/span><span style=\"color: #404040;\">Okay now since my foreman is not configured with Organisation and Locations. <\/span><span style=\"color: #404040;\">I had to patch the python code with the help of one of contributing authors of the module.<\/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.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: 0; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000; font-size: 9pt;\">3.<\/span><strong><span style=\"color: #404040;\">Apply the following patch.<\/span><\/strong><\/div>\n<p style=\"text-align: left; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><strong><span style=\"color: #404040;\">The fix was to avoid trying to touch a specific resource that is only available when you have Org\/<\/span><span style=\"color: #404040;\">Loc<\/span><span style=\"color: #404040;\"> enabled.<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><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; margin-left: 36pt;\"><strong><span style=\"color: #404040;\">diff &#8211;git plugins\/module_utils\/<\/span><span style=\"color: #c00000;\">foreman_helper.py<\/span><span style=\"color: #404040;\"> plugins\/module_utils\/foreman_helper.py<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #404040;\">index 432c76<\/span><span style=\"color: #404040;\">df..<\/span><span style=\"color: #404040;\">c9a3abda 100644<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #404040;\">&#8212; plugins\/module_utils\/foreman_helper.py<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #404040;\">+++ plugins\/module_utils\/foreman_helper.py<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #404040;\">@@ -396,8 +396,9 @@ class <\/span><span style=\"color: #404040;\">ForemanAnsibleModule<\/span><span style=\"color: #404040;\">(<\/span><span style=\"color: #404040;\">AnsibleModule<\/span><span style=\"color: #404040;\">):<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #000000;\"> _<\/span><span style=\"color: #000000;\">host_update<\/span><span style=\"color: #000000;\"> = <\/span><span style=\"color: #000000;\">next(<\/span><span style=\"color: #000000;\">x for x in _<\/span><span style=\"color: #000000;\">host_methods<\/span><span style=\"color: #000000;\"> if x[&#8216;name&#8217;] == &#8216;update&#8217;)<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #000000;\"> for param in [&#8216;<\/span><span style=\"color: #000000;\">location_id<\/span><span style=\"color: #000000;\">&#8216;, &#8216;<\/span><span style=\"color: #000000;\">organization_id<\/span><span style=\"color: #000000;\">&#8216;]:<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #000000;\">&#8211; _<\/span><span style=\"color: #000000;\">host_update_taxonomy_param<\/span><span style=\"color: #000000;\"> = <\/span><span style=\"color: #000000;\">next(<\/span><span style=\"color: #000000;\">x for x in _<\/span><span style=\"color: #000000;\">host_update<\/span><span style=\"color: #000000;\">[&#8216;params&#8217;] if x[&#8216;name&#8217;] == param)<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #000000;\">&#8211; _<\/span><span style=\"color: #000000;\">host_update<\/span><span style=\"color: #000000;\">[&#8216;params&#8217;<\/span><span style=\"color: #000000;\">].remove<\/span><span style=\"color: #000000;\">(_<\/span><span style=\"color: #000000;\">host_update_taxonomy_param<\/span><span style=\"color: #000000;\">)<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #000000;\">+ _<\/span><span style=\"color: #000000;\">host_update_taxonomy_param<\/span><span style=\"color: #000000;\"> = <\/span><span style=\"color: #000000;\">next(<\/span><span style=\"color: #000000;\">(x for x in _<\/span><span style=\"color: #000000;\">host_update<\/span><span style=\"color: #000000;\">[&#8216;params&#8217;] if x[&#8216;name&#8217;] == param), None)<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #000000;\">+ if _<\/span><span style=\"color: #000000;\">host_update_taxonomy_param<\/span><span style=\"color: #000000;\"> is not None:<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #000000;\">+ _<\/span><span style=\"color: #000000;\">host_update<\/span><span style=\"color: #000000;\">[&#8216;params&#8217;<\/span><span style=\"color: #000000;\">].remove<\/span><span style=\"color: #000000;\">(_<\/span><span style=\"color: #000000;\">host_update_taxonomy_param<\/span><span style=\"color: #000000;\">)<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #404040;\"> @_<\/span><span style=\"color: #404040;\">check_patch_needed<\/span><span style=\"color: #404040;\">(<\/span><span style=\"color: #404040;\">fixed_version<\/span><span style=\"color: #404040;\">=&#8217;2.0.0&#8242;)<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #404040;\"> def _<\/span><span style=\"color: #404040;\">patch_templates_resource_name<\/span><span style=\"color: #404040;\">(self):<\/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;\"><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; font-weight: bold; color: #000000; font-size: 9pt;\">4.<\/span><strong><span style=\"color: #404040;\">Once this patch is implemented. You will need a role that has all the correct variables to pass to your foreman in order for it to be able create a host without erroring.<\/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.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; margin-left: 36pt;\"><strong><span style=\"color: #0070c0;\">Trick<\/span><span style=\"color: #00b0f0;\">: with ansible you can write some of the code and run the playbook and if there are missing variables it will tell you what they are.<\/span><\/strong><\/p>\n<p 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; 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; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\">fatal: [testnick1]: FAILED! =&gt; {<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;changed&#8221;: false, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;invocation&#8221;: {<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">module_args<\/span><span style=\"color: #ff0000;\">&#8220;: {<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">activation_keys<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;architecture&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;build&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;comment&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">compute_attributes<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">compute_profile<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">compute_resource<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">config_groups<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">content_source<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">content_view<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;domain&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;enabled&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;environment&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">hostgroup<\/span><span style=\"color: #ff0000;\">&#8220;: &#8220;<\/span><span style=\"color: #ff0000;\">my_hostgroup<\/span><span style=\"color: #ff0000;\">&#8220;, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;image&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">interfaces_attributes<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">ip<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">kickstart_repository<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">lifecycle_environment<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;location&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;mac&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;managed&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;medium&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;name&#8221;: &#8220;testnick1&#8221;, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">openscap_proxy<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">operatingsystem<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;organization&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;owner&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">owner_group<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;parameters&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;password&#8221;: &#8220;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&#8221;, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">provision_method<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">ptable<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">puppet_ca_proxy<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">puppet_proxy<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">puppetclasses<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">pxe_loader<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;realm&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">root_pass<\/span><span style=\"color: #ff0000;\">&#8220;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">server_url<\/span><span style=\"color: #ff0000;\">&#8220;: &#8220;http:\/\/foreman-1.<\/span><span style=\"color: #ff0000;\">nictailor.com<\/span><span style=\"color: #ff0000;\">\/&#8221;, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;state&#8221;: &#8220;present&#8221;, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;subnet&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;subnet6&#8221;: null, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;username&#8221;: &#8220;<\/span><span style=\"color: #ff0000;\">ntailor<\/span><span style=\"color: #ff0000;\">&#8220;, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">validate_certs<\/span><span style=\"color: #ff0000;\">&#8220;: true<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> }<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> }, <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\"> &#8220;<\/span><span style=\"color: #ff0000;\">msg<\/span><span style=\"color: #ff0000;\">&#8220;: &#8220;The hostname must be FQDN&#8221;<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\">}<\/span><\/strong><\/p>\n<p 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; 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; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\">PLAY RECAP ************************************************************************************************************************************************************************<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><strong><span style=\"color: #ff0000;\">testnick1 <\/span><span style=\"color: #ff0000;\"> :<\/span><span style=\"color: #ff0000;\"> ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 <\/span><\/strong><\/p>\n<p 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; 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; margin-left: 36pt;\"><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; color: #000000;\">5.<\/span>Okay so once you get all the variables. Its just a matter of playing around until you\u2019re able to get to work.<\/div>\n<div class=\"ol\" 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: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">c.<\/span>Mkdir a directory inside \/etc\/ansible\/roles<\/div>\n<div class=\"ol\" 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;\"><em><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #0070c0;\">i.<\/span><span style=\"color: #0070c0;\">m<\/span><span style=\"color: #0070c0;\">kdir<\/span><span style=\"color: #0070c0;\"> ansible-provision-foreman<\/span><\/em><\/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: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">d.<\/span><span style=\"color: #000000;\">Inside the directory create two directories (defaults &amp; tasks)<\/span><\/div>\n<div class=\"ol\" 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: 108pt;\"><em><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #0070c0;\">ii.<\/span><span style=\"color: #0070c0;\">Mkdir<\/span><span style=\"color: #0070c0;\"> defaults &amp;&amp; <\/span><span style=\"color: #0070c0;\">mkdir<\/span><span style=\"color: #0070c0;\"> tasks<\/span><\/em><\/div>\n<\/div>\n<\/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=\"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; color: #000000;\">6.<\/span><span style=\"color: #000000;\">Now inside the <\/span><span style=\"color: #000000;\">tasks<\/span><span style=\"color: #000000;\"> directory, create a file called <\/span><span style=\"color: #000000;\">main.yml<\/span><span style=\"color: #000000;\"> and insert the code below<\/span><\/div>\n<div class=\"ol\" 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; color: #002060;\">e.<\/span>vi main.yml<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">Create a Host: This code is what you need for this module to work.<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&#8211; name: &#8220;Create a host&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;theforeman.foreman.host:<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">username: &#8220;{{ foreman_user }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">password: &#8220;{{ vcenter_password }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;server_url: &#8220;{{ server_url }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">name: &#8220;{{ inventory_hostname }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;hostgroup: &#8220;{{ host_group }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">managed: no<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">build: no<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;compute_profile: &#8220;{{ compute_profile }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;compute_resource: &#8220;{{ computer_resource }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;compute_attributes:<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpus: &#8220;{{ vm_cpu_count }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memory_mb: &#8220;{{ vm_memory }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;interfaces_attributes:<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&#8211; type: &#8220;interface&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">primary: true<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compute_attributes:<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">name: nic1<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">network: &#8220;{{ vm_vlan_name }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">interface: &#8220;{{ vm_interface }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">subnet: &#8220;{{ vm_subnet }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ip: &#8220;{{ vm_ip }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">domain: &#8220;{{ domain }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">provision: yes<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;operatingsystem: &#8220;{{ operating_system }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">medium: &#8220;{{ medium }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">architecture: x86_64<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;pxe_loader: PXELinux BIOS<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;puppet_ca_proxy: &#8220;{{ puppet_ca_proxy }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;puppet_proxy: &#8220;{{ puppet_proxy }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;root_pass: &#8220;{{ root_pass }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">environment: tdr<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\"># ptable: Centos &#8211; LVM &#8211; \/ , swap<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;ptable: &#8220;{{ ptable }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\"># owner: unix<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">state: present<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;validate_certs: false<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;delegate_to: localhost<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&#8211; name: &#8220;Switch host on&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;theforeman.foreman.host_power:<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">username: &#8220;{{ foreman_user }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">password: &#8220;{{ foreman_password }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;server_url: &#8220;{{ server_url&nbsp; }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">hostname: &#8220;{{ inventory_hostname }}&#8221;<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">state: on<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;&nbsp;&nbsp;validate_certs: false<\/h2>\n<h2 style=\"margin-top: 2pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.3; color: #2f5496; font-size: 13pt;\">&nbsp;&nbsp;delegate_to: localhost<\/h2>\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: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">f.<\/span>save file.<\/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; color: #000000;\">7.<\/span>Okay so next want now want to pass the basic defaults for new host creating. How we do that is define what those are under defaults. These variables wont change<\/div>\n<div class=\"ol\" 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: 72pt;\"><em><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">g.<\/span><span style=\"color: #0070c0;\">Cd<\/span><span style=\"color: #0070c0;\"> ..<\/span><span style=\"color: #0070c0;\">\/defaults<\/span><\/em><\/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: 72pt;\"><em><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">h.<\/span><span style=\"color: #0070c0;\">Vi <\/span><span style=\"color: #0070c0;\">main.yml<\/span><\/em><\/div>\n<\/div>\n<\/div>\n<p style=\"text-align: left; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"color: #c00000;\">Note: <\/span><span style=\"color: #c00000;\">You can find all these variables <\/span><span style=\"color: #c00000;\">inside foreman GUI with a bit of digging.<\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><strong><span style=\"color: #0070c0;\">foreman_user<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">Reptilianfilth<\/span><\/strong><br \/>\n<strong><span style=\"color: #0070c0;\">foreman_password<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">{ generally<\/span><span style=\"color: #0070c0;\"> want a ansible vault password }<\/span><\/strong><br \/>\n<strong><span style=\"color: #0070c0;\">compute_profile<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">vmware<\/span><\/strong><br \/>\n<strong><span style=\"color: #0070c0;\">computer_resource<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">vcenter.<\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">.internal<\/span><\/strong><br \/>\n<strong><span style=\"color: #0070c0;\">domain: <\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">.internal<\/span><\/strong><br \/>\n<strong><span style=\"color: #0070c0;\">medium: 7.8-CentOS<\/span><\/strong><br \/>\n<strong><span style=\"color: #0070c0;\">puppet_ca_proxy<\/span><span style=\"color: #0070c0;\">: puppet-2.<\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">.internal<\/span><\/strong><br \/>\n<strong><span style=\"color: #0070c0;\">puppet_proxy<\/span><span style=\"color: #0070c0;\">: puppet-2.<\/span><span style=\"color: #0070c0;\">nic.<\/span><span style=\"color: #0070c0;\">internal<\/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: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">i.<\/span><span style=\"color: #000000;\">Save file<\/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=\"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; color: #000000;\">8.<\/span><span style=\"color: #000000;\">Okay now we want to pass the host specific variables for new host creations and or <\/span><span style=\"color: #000000;\">vm<\/span><span style=\"color: #000000;\"> deployments.<\/span><\/div>\n<div class=\"ol\" 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: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">j.<\/span><span style=\"color: #000000;\">Move into to your \/etc\/ansible\/inventory\/{{environment}}\/<\/span><span style=\"color: #000000;\">host_vars<\/span><span style=\"color: #000000;\"> directory<\/span><\/div>\n<div class=\"ol\" 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: -9pt; color: #0070c0;\">iii.<\/span><span style=\"color: #0070c0;\">CD <\/span><span style=\"color: #0070c0;\">\/etc\/ansible\/inventory\/{{environment}}\/<\/span><span style=\"color: #0070c0;\">host_vars<\/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: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #0070c0;\">iv.<\/span><span style=\"color: #0070c0;\">Create a file called <\/span><span style=\"color: #0070c0;\">testserver<\/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: 108pt;\"><span style=\"display: inline-block; position: relative; text-indent: -9pt; color: #0070c0;\">v.<\/span><span style=\"color: #0070c0;\">Vi <\/span><span style=\"color: #0070c0;\">testserver<\/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.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">#VM creation variables<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">vm_network<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">corp-<\/span><span style=\"color: #0070c0;\">192<\/span><span style=\"color: #0070c0;\">.1<\/span><span style=\"color: #0070c0;\">68<\/span><span style=\"color: #0070c0;\">.65_corp<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">vm_interface<\/span><span style=\"color: #0070c0;\">: VMXNET3<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">vm_subnet<\/span><span style=\"color: #0070c0;\">: 192.168.65.0<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">vm_ip<\/span><span style=\"color: #0070c0;\">: 192.168.65.103<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">domain: <\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">.internal<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">managed: no<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">host_group<\/span><span style=\"color: #0070c0;\">: Base-Server\/Centos-7.8.2003<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">operating_system<\/span><span style=\"color: #0070c0;\">: Centos 7.8.2003<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">ptable<\/span><span style=\"color: #0070c0;\">: Centos &#8211; LVM &#8211; <\/span><span style=\"color: #0070c0;\">\/ ,<\/span><span style=\"color: #0070c0;\"> swap<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">root_pass<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">changeme<\/span><span style=\"color: #0070c0;\">twiceaday<\/span><\/strong><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><strong><span style=\"color: #0070c0;\">medium: 7.8-CentOS<\/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<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: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">k.<\/span><span style=\"color: #000000;\">Past the above and 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;\"><strong><span style=\"color: #7030a0;\">Special <\/span><span style=\"color: #7030a0;\">Note: Now if you wanted to <\/span><span style=\"color: #7030a0;\">have it so you can use <\/span><span style=\"color: #00b050;\">foreman module <\/span><span style=\"color: #7030a0;\">or <\/span><span style=\"color: #00b050;\">vmware_guest<\/span><span style=\"color: #7030a0;\"> module combining the variables names between the modules. <\/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: #7030a0;\">You can do <\/span><span style=\"color: #7030a0;\">as below. You will need to ensure the variables match but it works. You can get around having to <\/span><span style=\"color: #7030a0;\">rely on<\/span><span style=\"color: #7030a0;\"> DHCP with this<\/span><span style=\"color: #7030a0;\">.<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">#VM creation variables foreman and <\/span><span style=\"color: #0070c0;\">v<\/span><span style=\"color: #0070c0;\">mware<\/span><span style=\"color: #0070c0;\"> together<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_vlan_name<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">_<\/span><span style=\"color: #0070c0;\">192<\/span><span style=\"color: #0070c0;\">.<\/span><span style=\"color: #0070c0;\">168<\/span><span style=\"color: #0070c0;\">.44_db_stor2<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_datastore<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">esx_<\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">rc<\/span><span style=\"color: #0070c0;\">orp<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_dvswitch<\/span><span style=\"color: #0070c0;\">: VDS-<\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">-Corporate<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_interface<\/span><span style=\"color: #0070c0;\">: VMXNET3<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_subnet<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">192<\/span><span style=\"color: #0070c0;\">.1<\/span><span style=\"color: #0070c0;\">268<\/span><span style=\"color: #0070c0;\">.44.0<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_ip<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">192<\/span><span style=\"color: #0070c0;\">.1<\/span><span style=\"color: #0070c0;\">68<\/span><span style=\"color: #0070c0;\">.44.14<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_netmask<\/span><span style=\"color: #0070c0;\">: 255.255.255.0<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_gateway<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">192<\/span><span style=\"color: #0070c0;\">.<\/span><span style=\"color: #0070c0;\">168<\/span><span style=\"color: #0070c0;\">.<\/span><span style=\"color: #0070c0;\">44<\/span><span style=\"color: #0070c0;\">.254<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_dns_servers<\/span><span style=\"color: #0070c0;\">: [<\/span><span style=\"color: #0070c0;\">192<\/span><span style=\"color: #0070c0;\">.<\/span><span style=\"color: #0070c0;\">168<\/span><span style=\"color: #0070c0;\">.<\/span><span style=\"color: #0070c0;\">1<\/span><span style=\"color: #0070c0;\">.<\/span><span style=\"color: #0070c0;\">1<\/span><span style=\"color: #0070c0;\">]<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_dns_suffix<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">nic<\/span><span style=\"color: #0070c0;\">.internal<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_cpu_count<\/span><span style=\"color: #0070c0;\">: 4<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_memory<\/span><span style=\"color: #0070c0;\">: 16384<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_state<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">poweredon<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">vm_connected<\/span><span style=\"color: #0070c0;\">: true<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">domain: <\/span><span style=\"color: #0070c0;\">tdr.internal<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">managed: no<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">host_group<\/span><span style=\"color: #0070c0;\">: Base-Server\/Centos-7.8.2003<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">operating_system<\/span><span style=\"color: #0070c0;\">: Centos 7.8.2003<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">ptable<\/span><span style=\"color: #0070c0;\">: Centos &#8211; LVM &#8211; <\/span><span style=\"color: #0070c0;\">\/ ,<\/span><span style=\"color: #0070c0;\"> swap<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">root_pass<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">changeme<\/span><span style=\"color: #0070c0;\">twiceaday<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0070c0;\">medium: 7.8-CentOS<\/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; color: #000000;\">9.<\/span><span style=\"color: #000000;\">Next you need to ensure your host are listed in your inventory host file<\/span><\/div>\n<div class=\"ol\" 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: 72pt;\"><em><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">l.<\/span><span style=\"color: #000000;\">vi<\/span><span style=\"color: #000000;\"> ..<\/span><span style=\"color: #000000;\">\/hosts<\/span><\/em><\/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: 72pt;\"><em><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #002060;\">m.<\/span><span style=\"color: #000000;\">testnick3.<\/span><span style=\"color: #000000;\">nic<\/span><span style=\"color: #000000;\">.internal<\/span><\/em><\/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; color: #000000;\">10.<\/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;\"><span style=\"color: #000000;\">Before you to start one last thing. If you remember in the defaults we outlined <\/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: #0070c0;\">compute_profile<\/span><span style=\"color: #0070c0;\">: <\/span><span style=\"color: #0070c0;\">vmware<\/span><\/strong><br \/>\n<strong><span style=\"color: #ff0000;\"> (this is the foreman profile it will use, so whatever defaults you have set for network and <\/span><span style=\"color: #ff0000;\">disksize<\/span><span style=\"color: #ff0000;\"> here is what will be used to trigger foreman to create a host in <\/span><span style=\"color: #ff0000;\">vcenter<\/span><span style=\"color: #ff0000;\">, so it good to go check this in foreman first.)<\/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: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><span style=\"color: #000000;\">Run playbook: from \/etc\/ansible<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #4472c4;\">[<\/span><span style=\"color: #4472c4;\">root@nick<\/span> <span style=\"color: #4472c4;\">ansible]#<\/span><span style=\"color: #4472c4;\"> ansible-playbook &#8211;<\/span><span style=\"color: #4472c4;\">i<\/span><span style=\"color: #4472c4;\"> inventory\/TDR\/hosts <\/span><span style=\"color: #4472c4;\">foremancreatehost.yml<\/span><span style=\"color: #4472c4;\"> &#8211;ask-vault-pass &#8211;limit &#8216;testnick3.<\/span><span style=\"color: #4472c4;\">tdr<\/span><span style=\"color: #4472c4;\">.internal&#8217;<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #4472c4;\">Vault password: <\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #4472c4;\">PLAY [all] **********************************************************************************************************************************************<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #4472c4;\">TASK [ansible-provision-<\/span><span style=\"color: #4472c4;\">foreman :<\/span><span style=\"color: #4472c4;\"> Create a host] ********************************************************************************************************<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #4472c4;\">changed: [testnick3.tdr.internal]<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #4472c4;\">PLAY RECAP *******************************************************************************************************************************************************************************<\/span><\/strong><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #00b050;\">testnick3.tdr.internal <\/span><span style=\"color: #00b050;\"> :<\/span><span style=\"color: #00b050;\"> ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 <\/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;\"><strong><span style=\"color: #4472c4;\">403 Client Error: Forbidden for url: http:\/\/foreman-1.nic.corp.com\/api\/v2\/reports (<\/span><span style=\"color: #4472c4;\"><span style=\"color: #ff0000;\">if you see this, just ignore it<\/span><\/span><span style=\"color: #4472c4;\">) Its just callback report.<\/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: 8pt; padding-bottom: 0; line-height: 1.3;\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"265\" class=\"wp-image-1282 size-full\" src=\"http:\/\/www.nicktailor.com\/wp-content\/uploads\/2021\/05\/testnick3-602w265h.png\" srcset=\"https:\/\/nicktailor.com\/tech-blog\/wp-content\/uploads\/2021\/05\/testnick3-602w265h.png 602w, https:\/\/nicktailor.com\/tech-blog\/wp-content\/uploads\/2021\/05\/testnick3-602w265h-600x265.png 600w, https:\/\/nicktailor.com\/tech-blog\/wp-content\/uploads\/2021\/05\/testnick3-602w265h-300x132.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Okay\u2026this one was quite difficult to find online. Seems like the ansible documentation for the foreman module was seriously lacking or not kept up to date by anyone. I searched for awhile to see if anyone had an actual working model of it. Not even in the ansible chat rooms did anyone know&#8230;.which was weak. So I spent some time<a href=\"https:\/\/nicktailor.com\/tech-blog\/how-to-create-a-new-host-in-foreman-with-ansible\/\" 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,26],"tags":[],"class_list":["post-1281","post","type-post","status-publish","format-standard","hentry","category-ansible","category-red-hat-satellite"],"_links":{"self":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1281","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=1281"}],"version-history":[{"count":13,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1281\/revisions"}],"predecessor-version":[{"id":1582,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1281\/revisions\/1582"}],"wp:attachment":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/media?parent=1281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/categories?post=1281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/tags?post=1281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}