tech_notes:ansible

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tech_notes:ansible [2022-10-08 Sat wk40 19:14] baumkptech_notes:ansible [2024-03-13 Wed wk11 21:19] (current) – [ansible] baumkp
Line 1: Line 1:
 +{{tag>linux ansible}}
 ======ansible====== ======ansible======
-I should check about setting up ansible to save some time maintaining my servers.+  *''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 
 +    *''ssh-keygen'' will create an ssh key pair 
 +    *''ssh-copy-id -i ~/.ssh/id_rsa.pub userp@remote.local.machine.io'' to copy the public key to the remote machine for same user. 
 +  *''cd /mnt/ansible''  These commands only work in this directory or with full paths 
 +  *''%%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 all -m gather_facts -i inventory.ini --tree /tmp/facts%%'' 
 +  *''ansible all -i inventory.ini -m ping -u user'' 
 +  *''ansible -i inventory.ini kpts -a "ls -la ~" -u user'' 
 +  *''ansible -i inventory.ini kpts -a "df -h" -u user'' 
 +  *''ansible all -i inventory.ini -a "df -h" -u user'' 
 + 
 +  *''crontab -l'' 
 +  *''%%5 4 * * 6 ansible-playbook /mnt/ansible/debian_update.yml -i /mnt/ansible/inventory.ini --become-password-file '/mnt/ansible/password.yml'%%'' 
 + 
 +====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 ^ |End->+<- tech_notes:ipv6|Back ^ tech_notes:index|Start page ^ tech_notes:git|Next->
  • /app/www/public/data/attic/tech_notes/ansible.1665227674.txt.gz
  • Last modified: 2023-04-30 Sun wk17 17:44
  • (external edit)