Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tech_notes:ansible [2024-03-13 Wed wk11 20:53] baumkptech_notes:ansible [2024-03-13 Wed wk11 21:19] (current) – [ansible] baumkp
Line 1: Line 1:
 {{tag>linux ansible}} {{tag>linux ansible}}
 ======ansible====== ======ansible======
 +  *''sudo apt install sshpass'' The ''sshpass'' package must be installed.
 +  *Create a file ansible.cfg in your current folder with the following contents:
 +<code>[defaults]
 +host_key_checking = false</code>
   *create password less login to remote machines   *create password less login to remote machines
     *''ssh-keygen'' will create an ssh key pair     *''ssh-keygen'' will create an ssh key pair
Line 7: Line 11:
   *''%%ansible-inventory -i inventory.ini --list%%''   Lists the current inventory    *''%%ansible-inventory -i inventory.ini --list%%''   Lists the current inventory 
   *''%%ansible-playbook -i inventory.ini debian_update.yml --become-password-file '/mnt/ansible/password.yml'%%''   *''%%ansible-playbook -i inventory.ini debian_update.yml --become-password-file '/mnt/ansible/password.yml'%%''
-  *ansible all -m gather_facts -i inventory.ini --tree /tmp/facts +  *''%%ansible all -m gather_facts -i inventory.ini --tree /tmp/facts%%'' 
-  *ansible all -i inventory.ini -m ping -u root +  *''ansible all -i inventory.ini -m ping -u user'' 
-  *ansible -i inventroy.ini kpts -a "ls -la ~" -u root +  *''ansible -i inventory.ini kpts -a "ls -la ~" -u user'' 
-  *ansible all -a "df -h" -u root+  *''ansible -i inventory.ini kpts -a "df -h" -u user'' 
 +  *''ansible all -i inventory.ini -a "df -h" -u user''
  
-  *crontab -l +  *''crontab -l'' 
-  *5 4 * * 6 ansible-playbook /mnt/ansible/debian_update.yml -i /mnt/ansible/inventory.ini --become-password-file '/mnt/ansible/password.yml'+  *''%%5 4 * * 6 ansible-playbook /mnt/ansible/debian_update.yml -i /mnt/ansible/inventory.ini --become-password-file '/mnt/ansible/password.yml'%%''
  
-I should check about setting up ansible to save some time maintaining my servers.+====Resources====
   *[[https://computingforgeeks.com/install-and-use-ansible-on-debian-linux/|Install and Use Ansible on Debian 11/10]]   *[[https://computingforgeeks.com/install-and-use-ansible-on-debian-linux/|Install and Use Ansible on Debian 11/10]]
   *[[https://ostechnix.com/install-and-configure-ansible-in-linux/|Install And Configure Ansible In Linux]]   *[[https://ostechnix.com/install-and-configure-ansible-in-linux/|Install And Configure Ansible In Linux]]
   *[[https://www.middlewareinventory.com/blog/ansible-sudo-ansible-become-example/|Ansible sudo – ansible become example]]   *[[https://www.middlewareinventory.com/blog/ansible-sudo-ansible-become-example/|Ansible sudo – ansible become example]]
 +  *[[https://www.geekbits.io/how-to-install-and-configure-ansible-on-debian-11/|How to install and Configure Ansible on Debian 11]]
 +  *[[https://simeononsecurity.com/guides/automate-linux-patching-and-updates-with-ansible/|Automating Linux Patching and Updates with Ansible: A Comprehensive Guide]]
 +  *[[https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-debian-11|How To Install and Configure Ansible on Debian 11]]
 +  *[[https://www.jeffgeerling.com/blog/2022/ansible-playbook-upgrade-ubuntudebian-servers-and-reboot-if-needed|Ansible playbook to upgrade Ubuntu/Debian servers and reboot if needed]]
  
 ---- ----
 <- tech_notes:ipv6|Back ^ tech_notes:index|Start page ^ tech_notes:git|Next-> <- tech_notes:ipv6|Back ^ tech_notes:index|Start page ^ tech_notes:git|Next->