Ansible Installation Guide
This guide provides all the key information and getting-started instructions after a successful Ansible installation via DeploySage-CLI.
Getting Started: Ad-Hoc Commands
Ansible can run single tasks directly from the command line without needing a playbook. This is useful for quick checks and simple operations.
# Check the installed Ansible version
ansible --version
# Ping all hosts in your inventory to check connectivity
ansible all -m ping
# Gather system facts from all hosts
ansible all -m setup
# Run a shell command on all web servers
ansible webservers -m shell -a 'uptime'
Working with Playbooks
Playbooks are where you define your automation tasks in YAML format. They are the core of Ansible's power.
# Check the syntax of your playbook
ansible-playbook my_playbook.yml --syntax-check
# Run a playbook
ansible-playbook my_playbook.yml
# Perform a "dry run" to see what changes would be made
ansible-playbook my_playbook.yml --check
Key Directories and Files
The installer sets up a standard directory structure for your Ansible projects.
| Item | Value |
|---|---|
| Main Configuration File | /etc/ansible/ansible.cfg |
| Default Inventory File | /etc/ansible/hosts |
| Working Directory | /opt/ansible/ |
| Example Playbook | /opt/ansible/playbooks/example.yml |