diff --git a/lib/smart_proxy_ansible/runner/ansible_runner.rb b/lib/smart_proxy_ansible/runner/ansible_runner.rb index f56d1dd..074d3d2 100644 --- a/lib/smart_proxy_ansible/runner/ansible_runner.rb +++ b/lib/smart_proxy_ansible/runner/ansible_runner.rb @@ -23,6 +23,7 @@ def initialize(input, suspended_action:, id: nil) @rex_command = action_input[:remote_execution_command] @check_mode = action_input[:check_mode] @job_check_mode = action_input[:job_check_mode] + @diff_mode = action_input[:diff_mode] @tags = action_input[:tags] @tags_flag = action_input[:tags_flag] @passphrase = action_input['secrets']['key_passphrase'] @@ -214,7 +215,7 @@ def start_ansible_runner end def cmdline - cmd_args = [tags_cmd, check_cmd].reject(&:empty?) + cmd_args = [tags_cmd, check_cmd, diff_cmd].reject(&:empty?) return nil unless cmd_args.any? cmd_args.join(' ') end @@ -232,6 +233,10 @@ def check_cmd end end + def diff_cmd + diff_mode? ? '"--diff"' : '' + end + def verbosity '-' + 'v' * @verbosity_level.to_i end @@ -248,6 +253,10 @@ def job_check_mode? @job_check_mode == true end + def diff_mode? + @diff_mode == true + end + def prepare_directory_structure inner = %w[inventory project env].map { |part| File.join(@root, part) } ([@root] + inner).each do |path|