{"id":70,"date":"2023-08-05T07:20:58","date_gmt":"2023-08-05T07:20:58","guid":{"rendered":"http:\/\/it4home.dk\/?p=70"},"modified":"2023-08-06T09:22:28","modified_gmt":"2023-08-06T09:22:28","slug":"automating-neofetch-installation-and-configuration-using-ansible","status":"publish","type":"post","link":"https:\/\/it4home.dk\/index.php\/2023\/08\/05\/automating-neofetch-installation-and-configuration-using-ansible\/","title":{"rendered":"Automating Neofetch Installation and Configuration using Ansible"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-top-right\"><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/70?print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\" ><\/a><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/70?print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\" ><img decoding=\"async\" src=\"https:\/\/it4home.dk\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>\n<p class=\"wp-block-paragraph\">Introduction:<br>Neofetch is a simple and visually appealing command-line system information tool. By using Ansible, we can automate the installation of Neofetch and its configuration, including adding it to the .bashrc file and displaying the Raspberry Pi&#8217;s temperature. In this guide, we&#8217;ll walk you through creating an Ansible playbook to achieve this automation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Install Ansible<br>Before proceeding, make sure you have Ansible installed on your system. If you haven&#8217;t installed Ansible yet, you can follow the official Ansible installation instructions for your operating system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Create the Ansible Playbook<br>Create a new YAML file named <code>neofetch_setup.yaml<\/code> and add the following content to it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>---\n- name: Install Neofetch and update .bashrc\n  hosts: your_host  # Replace \"your_host\" with the target host or group where you want to install Neofetch.\n  become: yes\n\n  tasks:\n    - name: Install Neofetch\n      apt:\n        name: neofetch\n        state: present\n\n    - name: Add Neofetch to .bashrc\n      blockinfile:\n        path: ~\/.bashrc\n        block: |\n          if &#91;&#91; -z $(grep -Fxq \"neofetch\" ~\/.bashrc) ]]; then\n              echo \"neofetch\" &gt;&gt; ~\/.bashrc\n          fi\n\n    - name: Add vcgencmd measure_temp to .bashrc\n      blockinfile:\n        path: ~\/.bashrc\n        block: |\n          if &#91;&#91; -z $(grep -Fxq \"vcgencmd measure_temp\" ~\/.bashrc) ]]; then\n              echo \"vcgencmd measure_temp\" &gt;&gt; ~\/.bashrc\n          fi<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the playbook, make sure to replace &#8220;your_host&#8221; with the target host or group where you want to install Neofetch. Also, ensure that your target host has the necessary privileges (sudo access) to install packages and modify the .bashrc file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Run the Ansible Playbook<br>To run the Ansible playbook and install Neofetch on the target host, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible-playbook neofetch_setup.yaml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ansible will connect to the target host, install Neofetch, and update the .bashrc file with the appropriate commands.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Verify Neofetch Installation<br>To verify that Neofetch is installed and configured correctly, log in to the target host and open a new terminal. You should see the Neofetch output displaying system information. Additionally, the Raspberry Pi&#8217;s temperature will be displayed along with the system details.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Conclusion:<br>You&#8217;ve successfully created an Ansible playbook to automate the installation of Neofetch and its configuration on your Raspberry Pi. Ansible allows you to manage multiple hosts efficiently and ensure consistent setups across your infrastructure. Now you can enjoy using Neofetch to get a stylish system summary each time you open a terminal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Happy system information tracking!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction:Neofetch is a simple and visually appealing command-line system information tool. By using Ansible, we can automate the installation of Neofetch and its configuration, including adding it to the .bashrc file and displaying the&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":188,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[32,5,7],"tags":[35],"class_list":["post-70","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ansible","category-linux","category-raspberry","tag-ok"],"_links":{"self":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":2,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":141,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/70\/revisions\/141"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media\/188"}],"wp:attachment":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}