{"id":463,"date":"2022-02-05T18:30:44","date_gmt":"2022-02-05T18:30:44","guid":{"rendered":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/aws-devops-engineer-professional-dop-c01-question451\/"},"modified":"2022-02-05T18:30:44","modified_gmt":"2022-02-05T18:30:44","slug":"aws-devops-engineer-professional-dop-c01-question451","status":"publish","type":"post","link":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/aws-devops-engineer-professional-dop-c01-question451\/","title":{"rendered":"AWS DevOps Engineer Professional DOP-C01 &#8211; Question451"},"content":{"rendered":"<div class=\"question\">If designing a single playbook to run across multiple Linux distributions that have distribution specific commands, what would be the best method to allow a successful run?<br \/><strong><br \/>A.<\/strong> Enable fact gathering and use the `when&#039; conditional to match the distribution to the task.<br \/><strong>B.<\/strong> This is not possible, a separate playbook for each target Linux distribution is required.<br \/><strong>C.<\/strong> Use `ignore_errors: true&#039; in the tasks.<br \/><strong>D.<\/strong> Use the `shell&#039; module to write your own checks for each command that is ran.<\/div>\n<p><\/p>\n<style> .hidden-div{ display:none } <\/style>\n<p>\t\t\t\t\t\t\t<button onclick=\"getElementById('hidden-div').style.display = 'block'\"> Show Answer <\/button> <button onclick=\"getElementById('hidden-div').style.display = 'none'\">Hide Answer<\/button><\/p>\n<div class=\"hidden-div\" id=\"hidden-div\"><span style=\"\"><\/p>\n<div class=\"answer\">Correct Answer: <strong>A<\/strong><\/div>\n<p><strong>Explanation:<\/strong> <\/p>\n<div class=\"explanation\">\nExplanation:<br \/>\nAnsible provides a method to only run a task when a condition is met using the `when&#8217; declarative. With gather facts enabled, the play has access to the distribution name of the Linux system, thus, tasks can be tailored to a specific distribution and ran only when the condition is met, e.g.: ` &#8211; when: ansible_os_family == &#8220;Debian&#8221;&#8216;.<br \/>\nReference:<br \/>\n<a href=\"http:\/\/docs.ansible.com\/ansible\/playbooks_conditionals.html\" title=\"External link\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/docs.ansible.com\/ansible\/playbooks_conditionals.html<\/a><\/div>\n<p><\/strong><\/span> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>If designing a single playbook to run across multiple Linux distributions that have distribution specific commands, what would be the best method to allow a successful run?A. Enable fact gathering and use the `when&#039; conditional to match the distribution to the task.B. This is not possible, a separate playbook for each target Linux distribution is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,454],"class_list":["post-463","post","type-post","status-publish","format-standard","hentry","category-aws-devops-engineer-professional-dop-c01","tag-aws-devops-engineer-professional-dop-c01","tag-question-451"],"_links":{"self":[{"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/posts\/463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/comments?post=463"}],"version-history":[{"count":0,"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/posts\/463\/revisions"}],"wp:attachment":[{"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/media?parent=463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/categories?post=463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/exampracticetests.com\/aws\/DevOps_Engineer_Professional_DOP-C01\/wp-json\/wp\/v2\/tags?post=463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}