From 4c830400f8d6cfc4908196732969cbaf6e0837b5 Mon Sep 17 00:00:00 2001 From: Charles Zaffery Date: Fri, 21 Oct 2016 12:55:14 -0700 Subject: [PATCH] Remove line when 'state: absent' with 'option:' instead of commenting --- lib/ansible/modules/files/ini_file.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/files/ini_file.py b/lib/ansible/modules/files/ini_file.py index 19baaedebb..13589213ca 100644 --- a/lib/ansible/modules/files/ini_file.py +++ b/lib/ansible/modules/files/ini_file.py @@ -185,10 +185,10 @@ def do_ini(module, filename, section=None, option=None, value=None, state='prese else: index = index + 1 break - else: - # comment out the existing option line + elif state == 'absent': + # delete the existing line if match_active_opt(option, line): - ini_lines[index] = '#%s' % ini_lines[index] + del ini_lines[index] changed = True break