{"id":9569,"date":"2026-08-13T17:04:01","date_gmt":"2026-08-13T17:04:01","guid":{"rendered":"http:\/\/blog.dankohn.info\/?p=9569"},"modified":"2026-08-16T18:30:54","modified_gmt":"2026-08-16T18:30:54","slug":"my-ansible-install-on-a-pi","status":"publish","type":"post","link":"http:\/\/blog.dankohn.info\/index.php\/2026\/08\/13\/my-ansible-install-on-a-pi\/","title":{"rendered":"My Ansible Install on a PI"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Useful Links:<br><a href=\"https:\/\/geektechstuff.com\/2019\/06\/25\/installing-ansible-raspberry-pi\/\">https:\/\/geektechstuff.com\/2019\/06\/25\/installing-ansible-raspberry-pi\/<\/a><br><br><a href=\"https:\/\/geektechstuff.com\/2019\/06\/27\/ansible-setting-up-ssh-raspberry-pi\/\">https:\/\/geektechstuff.com\/2019\/06\/27\/ansible-setting-up-ssh-raspberry-pi\/<\/a><br><br><a href=\"https:\/\/docs.ansible.com\/projects\/ansible\/latest\/reference_appendices\/config.html#ansible-configuration-settings-locations\">https:\/\/docs.ansible.com\/projects\/ansible\/latest\/reference_appendices\/config.html#ansible-configuration-settings-locations<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Did the install commands:<br><em>sudo apt-get update<\/em><br><em>sudo apt-get upgrade<\/em><br><em>sudo apt install ansible<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">this did not create the default directory \/etc\/ansible or the default config files so had to do the following:<br><em>sudo mkdir -p \/etc\/ansible<br>sudo touch \/etc\/ansible\/ansible.cfg \/etc\/ansible\/hosts<\/em><br><em>ansible-config init &#8211;disabled &gt; ansible.cfg<br>sudo mv ansible.cfg \/etc\/ansible\/ansible.cfg<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now check the config:<br><em>ansible \u2013version<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now edited the hosts file for ansible<br><em>sudo pico -w \/etc\/ansible\/hosts<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">and put in a test group:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>[test]<br>192.168.0.1<br>192.168.0.2<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">errored as predicted in <a href=\"https:\/\/geektechstuff.com\/2019\/06\/25\/installing-ansible-raspberry-pi\/\">https:\/\/geektechstuff.com\/2019\/06\/25\/installing-ansible-raspberry-pi\/<\/a> but I did not like the solution of ssh keys, so I found how to add name and password to host file:<br><em>[test]<br>192.168.0.212<br><br>[test:vars]<br>ansible_user=user<br>ansible_password=*******<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">and that worked for what I want (to be able to log into switches and routers to run commands<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Host 192.168.0.*<br>    kexalgorithms +diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-  hellman-group1-sha1<br>    HostkeyAlgorithms +ssh-rsa<br>    PubkeyAcceptedAlgorithms +ssh-rsa<br>    Ciphers +aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">had to modify hosts file as follows:<br><br><em>[sw]<br>192.168.0.12<br>192.168.0.22<br>192.168.0.32<br>192.168.0.42<br><br>[sw:vars]<br>ansible_connection=network_cli<br>ansible_network_os=cisco.ios.ios<br>ansible_user=______<br>ansible_password=_____<br><br>[router]<br>192.168.0.11<br>192.168.0.21<br>192.168.0.31<br>192.168.0.41<br><br>[router:vars]<br>ansible_connection-network_cli<br>ansible_network_os_cisco.ios.ios<br><em>ansible_user=______<br>ansible_password=_____<\/em><\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">then got error saying I was missing paramiko so I had to do the following:<br><em>sudo apt-get update &amp;&amp; sudo apt-get install -y python3-paramiko<\/em><\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\">After that I tested with the following command:<br><em>ansible sw -m ansible.netcommon.cli_command -a &#8220;command=&#8217;show ip interface brief'&#8221;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">and got correct response from connected\/configured switch! YAY!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">other useful command for testing is:<br><em>ansible sw -m ansible.netcommon.cli_command -a &#8220;command=&#8217;show version | include Cisco IOS&#8221;<\/em><br><br><em>ansible sw -m ansible.netcommon.cli_command -a &#8220;command=&#8217;show version | include register&#8221;<\/em><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Started working on my first playbooks&#8230;..<br><br>looking at:<br><a href=\"https:\/\/github.com\/colin-mccarthy\/ansible-playbooks-for-cisco-ios\">https:\/\/github.com\/colin-mccarthy\/ansible-playbooks-for-cisco-ios<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">to execute playbook:<br><em>ansible-playbook playbook.yml<\/em><br>[note playbooks CAN have parameters passed to them&#8230;for example:<br><em>ansible-playbook playbook.yml -e &#8220;app_version=2.4.1 environment=production&#8221;<\/em><br>where {{ app_version }} will have the value of 2.4.1 and {{ environment }} will have value of production. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Useful Links:https:\/\/geektechstuff.com\/2019\/06\/25\/installing-ansible-raspberry-pi\/ https:\/\/geektechstuff.com\/2019\/06\/27\/ansible-setting-up-ssh-raspberry-pi\/ https:\/\/docs.ansible.com\/projects\/ansible\/latest\/reference_appendices\/config.html#ansible-configuration-settings-locations Did the install commands:sudo apt-get updatesudo apt-get upgradesudo apt install ansible this did not create the default directory \/etc\/ansible or the default config files so had to do the following:sudo mkdir -p \/etc\/ansiblesudo touch \/etc\/ansible\/ansible.cfg \/etc\/ansible\/hostsansible-config &hellip; <a href=\"http:\/\/blog.dankohn.info\/index.php\/2026\/08\/13\/my-ansible-install-on-a-pi\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[],"class_list":["post-9569","post","type-post","status-publish","format-standard","hentry","category-networking"],"_links":{"self":[{"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/posts\/9569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/comments?post=9569"}],"version-history":[{"count":13,"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/posts\/9569\/revisions"}],"predecessor-version":[{"id":9620,"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/posts\/9569\/revisions\/9620"}],"wp:attachment":[{"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/media?parent=9569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/categories?post=9569"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.dankohn.info\/index.php\/wp-json\/wp\/v2\/tags?post=9569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}