gappsapps_tech

Ansible Documentation Website

This page is a placeholder while the page is under development.

Installation OSX

brew install ansible

Installation Ubuntu

sudo apt install ansible

Playbooks

Run on all hosts defined

ansible-playbook <YAML>

Run 10 hosts parallel

ansible-playbook <YAML> -f 10

Verbose on successful tasks

ansible-playbook <YAML> --verbose

Test run

ansible-playbook <YAML> -C

Dry run

ansible-playbook <YAML> -C -D

Run on single host

ansible-playbook <YAML> -l <host>

Run Infos

ansible-playbook <YAML> --list-hosts
ansible-playbook <YAML> --list-tasks

Syntax Check

ansible-playbook --syntax-check <YAML>

Remote Execution

ansible all -m ping

Execute arbitrary commands

ansible <hostgroup> -a <command>
ansible all -a "ifconfig -a"

Debugging

List facts and state of a host

All facts for one host

ansible <host> -m setup

Only ansible fact for one host

ansible <host> -m setup -a 'filter=ansible_eth*'

Only facter facts but for all hosts

ansible all -m setup -a 'filter=facter_*'

Save facts to per-host files in /tmp/facts

ansible all -m setup --tree /tmp/facts
Edit this page on GitHub