2012-03-18 23:29:11 +01:00
|
|
|
# extremely simple test of the most basic of playbook engine/functions
|
|
|
|
---
|
|
|
|
- hosts: all
|
|
|
|
vars:
|
2012-03-18 23:50:25 +01:00
|
|
|
answer: "???"
|
2012-03-18 23:29:11 +01:00
|
|
|
port: 5150
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: test basic success command
|
|
|
|
action: command /bin/true
|
|
|
|
|
|
|
|
- name: test basic success command 2
|
|
|
|
action: command /bin/true
|
|
|
|
|
|
|
|
- name: test basic shell
|
2012-03-18 23:50:25 +01:00
|
|
|
action: shell echo $HOME
|
2012-03-18 23:29:11 +01:00
|
|
|
|
2012-03-19 00:25:56 +01:00
|
|
|
# in the command below, the test file should contain a valid template
|
|
|
|
# and trigger the change handler
|
|
|
|
|
2012-03-18 23:29:11 +01:00
|
|
|
- name: test copy
|
2012-03-18 23:50:25 +01:00
|
|
|
action: copy src=sample.j2 dest=/tmp/ansible_test_data_copy.out
|
2012-03-19 00:25:56 +01:00
|
|
|
notify:
|
|
|
|
- on change 1
|
|
|
|
|
|
|
|
# this should trigger two change handlers, but the 2nd should
|
|
|
|
# not be triggered twice because it's already triggered
|
2012-03-18 23:29:11 +01:00
|
|
|
|
|
|
|
- name: test template
|
2012-03-18 23:50:25 +01:00
|
|
|
action: template src=sample.j2 dest=/tmp/ansible_test_data_template.out
|
2012-03-19 00:25:56 +01:00
|
|
|
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
|
2012-03-18 23:29:11 +01:00
|
|
|
|
|
|
|
handlers:
|
|
|
|
|
2012-03-19 00:25:56 +01:00
|
|
|
# in the above test example, this should fire ONCE (at the end)
|
2012-03-18 23:29:11 +01:00
|
|
|
- name: on change 1
|
|
|
|
action: command /bin/true
|
2012-03-19 00:25:56 +01:00
|
|
|
|
|
|
|
# in the above test example, this should fire ONCE (at the end)
|
|
|
|
|
2012-03-18 23:29:11 +01:00
|
|
|
- name: on change 2
|
|
|
|
action: command /bin/true
|
2012-03-19 00:25:56 +01:00
|
|
|
|
|
|
|
# in the above test example, this should NOT FIRE
|
|
|
|
|
|
|
|
- name: on change 3
|
2012-03-18 23:29:11 +01:00
|
|
|
action: command /bin/true
|
|
|
|
|
|
|
|
|