mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
1bcba4f4a2
as it is /bin/false on many systems but /usr/bin/false on OS X test/playbook1.yml now just does command true, rather than command /bin/true, again so that it works on OS X Changed from using which false to just using command false to make it simpler and also match how playbook1.yml works
78 lines
2 KiB
YAML
78 lines
2 KiB
YAML
# extremely simple test of the most basic of playbook engine/functions
|
|
---
|
|
- hosts: all
|
|
|
|
# the 'weasels' string should show up in the output
|
|
|
|
vars:
|
|
answer: "Wuh, I think so, Brain, but if we didn't have ears, we'd look like weasels."
|
|
port: 5150
|
|
|
|
# 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
|
|
|
|
vars_files:
|
|
- common_vars.yml
|
|
- [ '$facter_operatingsystem.yml', 'default_os.yml' ]
|
|
|
|
tasks:
|
|
|
|
- name: test basic success command
|
|
action: command true
|
|
|
|
- name: test basic success command 2
|
|
action: command 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
|
|
|
|
# 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'"
|
|
|
|
handlers:
|
|
|
|
# in the above test example, this should fire ONCE (at the end)
|
|
- name: on change 1
|
|
action: shell echo 'this should fire once'
|
|
|
|
# in the above test example, this should fire ONCE (at the end)
|
|
|
|
- name: on change 2
|
|
action: shell echo 'this should fire once also'
|
|
|
|
# in the above test example, this should NOT FIRE
|
|
|
|
- name: on change 3
|
|
action: shell echo 'if you see this, this is wrong'
|
|
|
|
|