Quick Ansible test

Page content

This is memo when I want to run simple tasks quickly.

Directory.

$ tree
.
├── ansible.cfg
├── hosts
└── test.yml

In hosts.

[servers]
server1.mydomain.com
server2.mydomain.com
server3.mydomain.com

test.yml.

- name: test-playbook
  hosts: servers
  tasks:
    - cron:
        name: "Add a cron when rebooting"
        special_time: reboot
        job: "echo $PATH"
        user: atlex00

ansible.cfg

[defaults]
host_key_checking = False
deprecation_warnings=False

Exec:

ansible-playbook ./test.yml -i hosts -bD -C