test/playbook1.yml
45abe3c1
 # extremely simple test of the most basic of playbook engine/functions
 ---
 - hosts: all
9985995a
   connection: local
6ab615c7
 
1c9b43df
 # the 'weasels' string should show up in the output
6ab615c7
 
45abe3c1
   vars:
c1fe0dd7
     answer: "Wuh, I think so, Brain, but if we didn't have ears, we'd look like weasels."
45abe3c1
     port: 5150
6ab615c7
 
 # we should have import events for common_vars and CentOS.yml (if run on CentOS)
 # sorry, tests are a bit platform specific just for now
 
4de7bbb1
   vars_files:
     - common_vars.yml
     - [ '$facter_operatingsystem.yml', 'default_os.yml' ]
1c9b43df
 
45abe3c1
   tasks:
 
   - name: test basic success command
1bcba4f4
     action: command true
45abe3c1
 
   - name: test basic success command 2
1bcba4f4
     action: command true
45abe3c1
 
5ed2b894
   - name: test basic shell, plus two ways to dereference a variable
cdaa2085
     action: shell echo $HOME $port
45abe3c1
 
4de7bbb1
   - name: test vars_files imports
     action: shell echo $duck $cow $testing
 
5371a9e4
 # in the command below, the test file should contain a valid template
 # and trigger the change handler
 
45abe3c1
   - name: test copy
b15c8e9c
     action: copy src=sample.j2 dest=/tmp/ansible_test_data_copy.out
1c9b43df
     notify:
5371a9e4
     - on change 1
 
 # this should trigger two change handlers, but the 2nd should
 # not be triggered twice because it's already triggered
45abe3c1
 
   - name: test template
40af8eff
     action: template src=$item dest=/tmp/ansible_test_data_template.out
     first_available_file:
     - nonexistantfile
     - sample.j2
1c9b43df
     notify:
5371a9e4
     - 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
45abe3c1
 
6ab615c7
 # the following command should be skipped
 
   - name: this should be skipped
     action: shell echo 'if you see this, this is wrong ($facter_operatingsystem)'
     only_if: "'$facter_operatingsystem' == 'Imaginary'"
 
45abe3c1
   handlers:
 
5371a9e4
 # in the above test example, this should fire ONCE (at the end)
45abe3c1
   - name: on change 1
6ab615c7
     action: shell echo 'this should fire once'
5371a9e4
 
 # in the above test example, this should fire ONCE (at the end)
 
45abe3c1
   - name: on change 2
6ab615c7
     action: shell echo 'this should fire once also'
5371a9e4
 
 # in the above test example, this should NOT FIRE
 
   - name: on change 3
6ab615c7
     action: shell echo 'if you see this, this is wrong'
45abe3c1