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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -