ansible/test/playbook1.yml
Michael DeHaan 4de7bbb169 Allow conditional imports, see examples/playbook3.yml comments for a full explanation. Extensive
refactoring of playbooks now warranted, which we'll do before we move on.   This variable assignment
system makes nearly all possible magic possible, for we can use these variables however we like,
even as module names!
2012-03-19 22:42:31 -04:00

65 lines
1.6 KiB
YAML

# extremely simple test of the most basic of playbook engine/functions
---
- hosts: all
vars:
answer: "Wuh, I think so, Brain, but if we didn't have ears, we'd look like weasels."
port: 5150
vars_files:
- common_vars.yml
- [ '$facter_operatingsystem.yml', 'default_os.yml' ]
tasks:
- name: test basic success command
action: command /bin/true
- name: test basic success command 2
action: command /bin/true
- name: test basic shell, plus two ways to dereference a variable
action: shell echo $HOME $port {{ port }}
- name: test vars_files imports
action: shell echo $duck $cow $testing
# in the command below, the test file should contain a valid template
# and trigger the change handler
- name: test copy
action: copy src=sample.j2 dest=/tmp/ansible_test_data_copy.out
notify:
- on change 1
# this should trigger two change handlers, but the 2nd should
# not be triggered twice because it's already triggered
- name: test template
action: template src=sample.j2 dest=/tmp/ansible_test_data_template.out
notify:
- on change 1
- on change 2
# there should be various poll events within the range
- name: async poll test
action: shell sleep 5
async: 10
poll: 3
handlers:
# in the above test example, this should fire ONCE (at the end)
- name: on change 1
action: command /bin/true
# in the above test example, this should fire ONCE (at the end)
- name: on change 2
action: command /bin/true
# in the above test example, this should NOT FIRE
- name: on change 3
action: command /bin/true