{"id":5664,"date":"2018-12-03T15:55:49","date_gmt":"2018-12-03T15:55:49","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=5664"},"modified":"2021-11-17T06:11:44","modified_gmt":"2021-11-17T06:11:44","slug":"login-to-linux-ansible-remote-server-enabled-with-ldap-using-ssh","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/login-to-linux-ansible-remote-server-enabled-with-ldap-using-ssh\/","title":{"rendered":"Login to linux ansible remote server enabled with LDAP using SSH?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5666\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/12\/Login-to-linux.png\" alt=\"\" width=\"400\" height=\"215\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/12\/Login-to-linux.png 400w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/12\/Login-to-linux-300x161.png 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/p>\n<p>Here is the scnario which we tried last week with Pranav Goel in order to login the Ansible remote server which is enlabe with LDAP and become a su to execute any playbook tasks. Here are the steps given as below;<\/p>\n<p><strong>Inventory:<\/strong><\/p>\n<p>[code]<br>\n[root@ussltcovm498 ansible]# cat inventory<br>\nhostname.demo.com ansible_user=adname\\\\aduser ansible_ssh_pass=password ansible_become_pass=password<br>\n[\/code]<\/p>\n<p><strong>Ansible Configuration File)<\/strong><\/p>\n<p>[code]<br>\n[privilege_escalation]<br>\nbecome=True<br>\nbecome_method=su<br>\nbecome_user=oracle<br>\n#become_ask_pass=True<br>\n[\/code]<\/p>\n<p><strong>Note:<\/strong><br>\nIn order to pass LDAP user use &#8220;\\\\&#8221;<\/p>\n<p><strong>Command to Check:<\/strong><\/p>\n<p>[code]ansible all -i inventory -m command -a &#8220;whoami&#8221;[\/code]<\/p>\n<p>&nbsp;<\/p>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_35627\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_44631\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_35627\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Here is the scnario which we tried last week with Pranav Goel in order to login the Ansible remote server which is enlabe with LDAP and become a su to execute any playbook tasks. Here are the steps given as below; Inventory: [code] [root@ussltcovm498 ansible]# cat inventory hostname.demo.com ansible_user=adname\\\\aduser ansible_ssh_pass=password ansible_become_pass=password [\/code] Ansible Configuration File)&#8230;<\/p>\n","protected":false},"author":1,"featured_media":5666,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[5038],"tags":[639,5145,460,399,896,5144],"class_list":["post-5664","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ansible","tag-ansible","tag-ansible-cfg","tag-linux","tag-server","tag-ssh","tag-su"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=5664"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5664\/revisions"}],"predecessor-version":[{"id":25540,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5664\/revisions\/25540"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/5666"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=5664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=5664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=5664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}