{"id":2449,"date":"2023-02-08T14:41:23","date_gmt":"2023-02-08T14:41:23","guid":{"rendered":"https:\/\/blog.samarthya.me\/wps\/?p=2449"},"modified":"2023-02-08T15:31:31","modified_gmt":"2023-02-08T15:31:31","slug":"ansible-ssh-access","status":"publish","type":"post","link":"https:\/\/blog.samarthya.me\/wps\/2023\/02\/08\/ansible-ssh-access\/","title":{"rendered":"Ansible: SSH Access"},"content":{"rendered":"\n<p>To set up SSH access for inventory hosts in <code>Ansible<\/code>, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Generate an SSH key pair\n<ul class=\"wp-block-list\">\n<li><code>ssh-keygen -t rsa<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Copy the public key to the remote host\n<ul class=\"wp-block-list\">\n<li><code>ssh-copy-id user@hostname<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Test the connection to the remote host:\n<ul class=\"wp-block-list\">\n<li><code>ssh user@hostname<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Modify the <code>ansible.cfg<\/code> file to set the remote user, if necessary.<\/li>\n\n\n\n<li>Add the remote host to the Ansible inventory file.<\/li>\n\n\n\n<li>Run the Ansible playbook to execute the desired tasks on the remote host.<\/li>\n<\/ol>\n\n\n\n<p>Note: If you need to access multiple remote hosts, repeat steps 2-5 for each host.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To set up SSH access for inventory hosts in Ansible, follow these steps: Note: If you need to access multiple remote hosts, repeat steps 2-5 for each host.<\/p>\n","protected":false},"author":2,"featured_media":2435,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[34],"tags":[278,246],"class_list":["post-2449","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical","tag-ansible","tag-ssh"],"_links":{"self":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/comments?post=2449"}],"version-history":[{"count":1,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2449\/revisions"}],"predecessor-version":[{"id":2451,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2449\/revisions\/2451"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media\/2435"}],"wp:attachment":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media?parent=2449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/categories?post=2449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/tags?post=2449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}