ansible - supports_check_mode for non-Python module -
an ansible module written in python can support check mode setting supports_check_mode=true
:
module = ansiblemodule( argument_spec = dict(...), supports_check_mode=true )
now have 700+ lines ruby script i'd turn module , avoid translating python. there way how support check mode non-python modules?
ansible pass argument _ansible_check_mode
module, true if in check mode.
remember arguments put in file, , path file argument #2.
here php example:
./library/test_module.php
#!/usr/bin/env php <?php // want_json causes ansible store args in json $args = json_decode(file_get_contents($argv[1]), true); $check_mode = !empty($args['_ansible_check_mode']); $output = array( 'changed' => false, 'checking' => $check_mode ); echo json_encode($output);
matching playbook:
./test_module.yml
--- - hosts: localhost gather_facts: no become: no tasks: - test_module: key: value
Comments
Post a Comment