-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Need to at least allow/parse return values from modules (see ec2_ami).
Could allow this:
task 'Copy something over' do
result = foobar do
src '/file1.conf'
dest '/file2.conf'
end
become
notify 'handler1'
changed_when "'no upgrade' in #{result.stdout}"
endto become this:
task 'Copy something over' do
result = foobar do
src '/file1.conf'
dest '/file2.conf'
end
become
notify 'handler1'
changed_when result.stdout.include? 'no upgrade'
endThe first case already compiles to this:
---
# This is a generated YAML file by ansible-ruby, DO NOT EDIT
- name: Copy something over
copy:
src: "/file1.conf"
dest: "/file2.conf"
become: true
register: result_1
changed_when: "'no upgrade' in result_1.stdout"
notify:
- handler1Basically it creates a light AST that would mimic the Ruby string/primitive methods and convert that to the Python/YAML/jinja stuff. Would want to cover basics only. More sophisticated stuff should be in custom modules. Even this might be difficult since different modules return different types of results.
Also could make the with_dict syntax easier so that you don't have to do value.stuff and instead can do value[:stuff]. Might be a slippery slope there though.