{"id":2100,"date":"2020-04-07T01:00:00","date_gmt":"2020-04-07T01:00:00","guid":{"rendered":"http:\/\/inswwdev.azurewebsites.net\/au\/insights\/uncategorized\/ansible-tower-api\/"},"modified":"2024-12-13T02:01:57","modified_gmt":"2024-12-13T02:01:57","slug":"ansible-tower-api","status":"publish","type":"post","link":"https:\/\/www.insentragroup.com\/us\/insights\/geek-speak\/professional-services\/ansible-tower-api\/","title":{"rendered":"Ansible Tower API"},"content":{"rendered":"<p>So, you have Ansible Tower installed in your environment and now you just need to find a way to make sure everything is working smoothly and as expected. The bonus is \u2013 you can use automation with the API.<\/p>\n<h3 style=\"padding-bottom: 15px; margin-bottom: 30px; margin-top: 40px; border-bottom: 1px solid #f16020;\">Ansible Tower API Monitoring<\/h3>\n<p class=\"LO-normal\"><span>Ansible Tower provides several mechanisms which can be used for monitoring of the standalone Ansible Tower and clustered Ansible Towers. <\/span><\/p>\n<p class=\"LO-normal\"><span>The following API call, provides information about the cluster health: <\/span><\/p>\n<p><strong>https:\/\/tower_fqdn\/api\/v2\/ping\/<\/strong><\/p>\n<p class=\"LO-normal\"><span>The following example output can be expected when both instances (application nodes) are active. Notice the value assigned to variable \u2018capacity\u2019:<\/span><\/p>\n<p class=\"LO-normal\"><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/21\/2021\/02\/insentra-seb-04-07-2020-img-1.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/459beca8332841f79dd55682ccb11787\" \/><\/p>\n<p class=\"LO-normal\"><span>In case one of the nodes is down, the capacity of the solution changes:<\/span><\/p>\n<p class=\"LO-normal\"><span><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/21\/2021\/02\/insentra-seb-04-07-2020-img-2.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/9fdf730672264756b513304453f19144\" \/><\/span><\/p>\n<p class=\"LO-normal\"><span>Another useful API call is: <a rel=\"noopener nofollow\" href=\"https:\/\/ansible_fqdn\/api\/v2\/metrics\/\" target=\"_blank\">https:\/\/ansible_fqdn\/api\/v2\/metrics\/<\/a> <\/span><\/p>\n<p class=\"LO-normal\"><span>This call provides the information about system related metrics, including the available capacity of the nodes. For example:<\/span><\/p>\n<p class=\"LO-normal\"><span><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/21\/2021\/02\/insentra-seb-04-07-2020-img-3.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/e8e4b6a087924c269c5401a9dff920e5\" \/><\/span><\/p>\n<p class=\"LO-normal\"><span>The following example provides additional information about the licensing status of the Ansible Tower; the number of licensed nodes vs used licenses; the license expiration time; licensed features etc: <\/span><\/p>\n<p class=\"LO-normal\"><strong>https:\/\/tower_fqdn\/api\/v2\/config\/<\/strong><\/p>\n<p class=\"LO-normal\"><span><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/21\/2021\/02\/insentra-seb-04-07-2020-img-4.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/d488a3cab20747e8b2f8290ba622ed7d\" \/><\/span><\/p>\n<p class=\"LO-normal\"><span>The following API call can be used to measure the performance and collect the data for performance plotting. It also provides insight into a job distribution and can help with the job allocation in busy environments.<\/span><\/p>\n<p class=\"LO-normal\"><span>Note the capacity, committed capacity, jobs_running and jobs_total. Values of those variables can provide insight into job slicing and job allocation. It can be also used to validate if another cluster node should be added to increase the capacity of the cluster: <\/span><\/p>\n<p class=\"LO-normal\"><strong>https:\/\/tower_fqdn\/api\/v2\/instance_groups\/<\/strong><\/p>\n<p class=\"LO-normal\"><strong><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/21\/2021\/02\/insentra-seb-04-07-2020-img-5.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/1dc3619b98ab4c0a8e2eade27cc9656a\" \/><\/strong><\/p>\n<p><span>Note the API provides the metrics for each individual instance group. This implies\u00a0 each individual instance group can be queried for specific information. This data can be used to plot graphs presenting utilisation of each instance group. For example: <\/span><\/p>\n<p><strong>https:\/\/tower_fqdn\/api\/v2\/instance_groups\/1\/<\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/www.insentragroup.com\/wp-content\/uploads\/sites\/21\/2021\/02\/insentra-seb-04-07-2020-img-6.jpg\" alt=\"\" data-udi=\"umb:\/\/media\/8a5cf2aff90945c186fddbd4c6c88413\" \/><\/strong><\/p>\n<p class=\"LO-normal\"><span>Ansible Tower offers even more API calls. Please refer to the following link, to verify available APIs: <\/span><\/p>\n<p class=\"LO-normal\"><strong>https:\/\/tower_fqdn\/api\/v2\/<\/strong><\/p>\n<p class=\"LO-normal\"><span>For more information on Ansible Tower API, please refer to the following documentation: <\/span><\/p>\n<p class=\"LO-normal\"><strong>https:\/\/docs.ansible.com\/ansible-tower\/latest\/html\/towerapi\/index.html<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, you have Ansible Tower installed in your environment and now you just need to find a way to make sure everything is working smoothly and as expected. The bonus is \u2013 you can use automation with the API. Ansible Tower API Monitoring Ansible Tower provides several mechanisms which can be used for monitoring of&hellip; <a class=\"more-link\" href=\"https:\/\/www.insentragroup.com\/us\/insights\/geek-speak\/professional-services\/ansible-tower-api\/\">Continue reading <span class=\"screen-reader-text\">Ansible Tower API<\/span><\/a><\/p>\n","protected":false},"author":67,"featured_media":2101,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[25],"tags":[],"class_list":["post-2100","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-professional-services","entry"],"_links":{"self":[{"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/posts\/2100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/comments?post=2100"}],"version-history":[{"count":1,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/posts\/2100\/revisions"}],"predecessor-version":[{"id":23151,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/posts\/2100\/revisions\/23151"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/media\/2101"}],"wp:attachment":[{"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/media?parent=2100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/categories?post=2100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/tags?post=2100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}