Ansible Commands

#check ansible version
ansible --version

ansible [core 2.11.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/h1t3ch/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /home/h1t3ch/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True
  
#Ping all host in the host file
ansible all -m ping -k -K
ansible-playbook --ask-become-pass /etc/ansible/playbook/update_dc01.yml
#Running playbook

#updates plex server
ansible-playbook --ask-become-pass /etc/ansible/playbooks/update_plex.yml

#updates the docker server
ansible-playbook --ask-become-pass  /etc/ansible/playbooks/update_docker.yml

#updates the dc01 server
ansible-playbook --ask-become-pass  /etc/ansible/playbooks/update_dc01.yml

#updates all the servers (dc01,plex,docker)
ansible-playbook --ask-become-pass  /etc/ansible/playbooks/update_servers.yml




#Running custom playbook with -I
ansible-playbook --ask-become-pass -i /etc/ansible/hosts/inventory.yml /etc/ansible/playbooks/update_hosts.yml

#Testing Ansible Inventory
ansible-inventory -i /etc/ansible/playbooks/update_hosts.yml --list


#testing Ansible config
Ansible all --list-hosts

#Test playbook
ansible-playbook --ask-become-pass  /etc/ansible/playbooks/update_docker.yml --check