{"id":1889,"date":"2020-10-20T01:00:00","date_gmt":"2020-10-20T01:00:00","guid":{"rendered":"http:\/\/inswwdev.azurewebsites.net\/au\/insights\/uncategorized\/ansible-awx-with-isolated-nodes\/"},"modified":"2024-12-13T02:20:55","modified_gmt":"2024-12-13T02:20:55","slug":"ansible-awx-with-isolated-nodes","status":"publish","type":"post","link":"https:\/\/www.insentragroup.com\/gb\/insights\/geek-speak\/cloud-and-modern-data-center\/ansible-awx-with-isolated-nodes\/","title":{"rendered":"Ansible AWX with Isolated Nodes"},"content":{"rendered":"<p><span>Yes, I know\u2026 you would like to run some Ansible workloads using isolated nodes and on top of that \u2013 you would like to use the AWX for this purpose. The following is a pure process to do just what you need. No additional fluff. It has been tested in several environments with AWX 14.1. <\/span><\/p>\n<p><span>Ahhh\u2026 and read to the end\u2026 there is a bonus awaiting you \ud83d\ude42<\/span><\/p>\n<ol>\n<li><span>Install Centos8 host<\/span><\/li>\n<li><span>dnf update -y<\/span><\/li>\n<li><span>dnf install epel-release python3-pip python3-devel -y<\/span><\/li>\n<li><span>dnf install ansible rsync gcc -y<\/span><\/li>\n<li><span>dnf install gcc<\/span><\/li>\n<li><span>echo &#8220;alias python=python3&#8221; &gt;&gt; ~\/.bashrc<\/span><\/li>\n<li><span>source ~\/.bashrc<\/span><\/li>\n<li><span>ln &#8211;symbolic \/usr\/bin\/python3 \/usr\/bin\/python<\/span><\/li>\n<li><span>python3 -m <\/span>pip install ansible-runner pywinrm<\/li>\n<li>mkdir \/var\/lib\/awx<\/li>\n<li>useradd awx<\/li>\n<li>chown awx:awx \/<em>var\/<\/em>lib\/awx<\/li>\n<li>ssh-keygen -t rsa -b 2048<\/li>\n<\/ol>\n<p>on the AWX node with awx_task container:<\/p>\n<ol>\n<li>docker ps<\/li>\n<li>docker exec -it awx_task \/bin\/bash<\/li>\n<li>awx-manage provision_instance &#8211;hostname hostname \u2013is-isolated<\/li>\n<li>awx-manage register_queue &#8211;queuename HKG &#8211;hostname hostname &#8211;controller tower<\/li>\n<li>awx-manage generate_isolated_key<\/li>\n<li>Copy the key to the isolated node to \/home\/awx\/.ssh\/authorized_keys<\/li>\n<li>On isolated node: chmod 640 \/home\/awx\/.ssh\/authorized_keys<\/li>\n<li>On AWX node in docker exec context:<\/li>\n<li>awx-manage test_isolated_connection &#8211;hostname hostname<\/li>\n<li>In the AWX GUI:<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_1.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/4eddecfb98af47d297ab9e14944757d0\" \/><\/p>\n<p>Confirm you can see HKG group (created with register_queue switch) \u2026 controller needs to be the controlling instance group. If you have one server in the instance group, this is the controlling group, if you have more, that is fine<\/p>\n<p style=\"padding-left: 40px;\">11. Click on HKG (or whatever name) and Instances<\/p>\n<p style=\"padding-left: 40px;\">12. Disable new node in the console:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_2.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/234ec6fc5bdb421f99d4899f5c1a242f\" \/><\/p>\n<p style=\"padding-left: 40px;\">13. Re-enable the node:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_3.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/8a090b4e119b491f89569d0627034cbb\" \/><\/p>\n<p style=\"padding-left: 40px;\">14. Wait and confirm the node stays Active<\/p>\n<p style=\"padding-left: 40px;\">15. docker logs -f awx_task. Confirm the following logs entries are being displayed:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_4.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/b5d9030f1d214995b2737101bef746c0\" \/><\/p>\n<p style=\"padding-left: 40px;\">16. Configure the Inventory and select the instance group<\/p>\n<p style=\"padding-left: 40px;\">17. Create the Template and select the instance group<\/p>\n<p style=\"padding-left: 40px;\">18.Observe the job\u2026 Notice that in the Job details, the Execution node is set to one of the Isolated Nodes and The Instance Groups is set to the group specified in the Template:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_5.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/d7ddc3c5b4c946829ce1e30ed857be19\" \/><\/p>\n<p style=\"padding-left: 40px;\">19. In the docker logs -f awx_task, you should see the following execution tasks (this one indicates the content of the Project\/Inventory and Template have been transferred to the Isolated Node:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_6.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/d97d907c4f034521a367d4ecf467acad\" \/><\/p>\n<p style=\"padding-left: 40px;\">20. At the time of running the ansible code, you can run journalctl -f on the isolated nod, you will see the directory where the artefacts are copied to and investigate.<\/p>\n<h3 style=\"padding-bottom: 15px; margin-bottom: 30px; margin-top: 40px; border-bottom: 1px solid #f16020;\">BONUS<\/h3>\n<p><span>The following Ansible Playbook should be converted into a role. The role should be run from the AWX node (as we need to execute a few commands in awx_task container). Alternatively \u2013 you can run this from any other node, but keep in mind \u2018delegate_to\u2019.<\/span><\/p>\n<p><span><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_7.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/2546628ea67d416f9ef6420005e4ece1\" \/><\/span><\/p>\n<p><span><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_8.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/2d51a69ec5a444afae87187718797d3a\" \/><\/span><\/p>\n<p><span><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_9.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/130d9147cbda46249fecc358690bbeb2\" \/><\/span><\/p>\n<p><span><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/20\/2021\/02\/insentra_sebastian_baszczyj_10192020_img_10.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/0dbb014334254d7f855b28abba91fc4b\" \/><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, I know\u2026 you would like to run some Ansible workloads using isolated nodes and on top of that \u2013 you would like to use the AWX for this purpose. The following is a pure process to do just what you need. No additional fluff. It has been tested in several environments with AWX 14.1.&hellip; <a class=\"more-link\" href=\"https:\/\/www.insentragroup.com\/gb\/insights\/geek-speak\/cloud-and-modern-data-center\/ansible-awx-with-isolated-nodes\/\">Continue reading <span class=\"screen-reader-text\">Ansible AWX with Isolated Nodes<\/span><\/a><\/p>\n","protected":false},"author":67,"featured_media":1890,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[21],"tags":[],"class_list":["post-1889","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-and-modern-data-center","entry"],"_links":{"self":[{"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/posts\/1889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/comments?post=1889"}],"version-history":[{"count":1,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/posts\/1889\/revisions"}],"predecessor-version":[{"id":22609,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/posts\/1889\/revisions\/22609"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/media\/1890"}],"wp:attachment":[{"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/media?parent=1889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/categories?post=1889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/tags?post=1889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}