Files
ansible/README.md
2023-08-20 02:40:20 +01:00

29 lines
1.1 KiB
Markdown

# Run Ansible Playbook Test
- ansible all --key-file ~/.ssh/ansible -i inventory -m ping
# Run Ansible Playbook Once we have the .cfg Created
- ansible all -m ping
# Show our Servers List
- ansible all --list-hosts
# Shows all Data from the servers
- ansible all -m setup
- ansible all -m setup -a 'filter=ansible_distribution*'
- ansible all -m gather_facts
- ansible all -m gather_facts --limit root@49.13.21.211
# Run Ansible Playbook Commmand
The similar command is used to update the cache on all hosts:
- sudo apt update
- ansible all -m apt -a update_cache=true --become --ask-become-pass
* -m: This is used to specify the module name
* -a: This is used to specify the arguments to the module
* Become: This is used to run the command as root user
* Ask-become-pass: This is used to ask for the password of the root user
# Update Ubuntu Packages
- ansible all -m apt -a 'upgrade=dist update_cache=yes' --become --ask-become-pass
- ansible all -m apt -a 'upgrade=yes update_cache=yes' --become --ask-become-pass
- ansible all -m apt -a 'name=nginx state=latest' --become --ask-become-pass --limit root@49.13.21.211