diff --git a/library/files/lineinfile b/library/files/lineinfile index 3568416713..b518158cdf 100644 --- a/library/files/lineinfile +++ b/library/files/lineinfile @@ -306,7 +306,7 @@ def main(): module.fail_json(rc=256, msg='Destination %s is a directory !' % dest) if params['state'] == 'present': - if 'line' not in params: + if params.get('line', None) is None: module.fail_json(msg='line= is required with state=present') # Deal with the insertafter default value manually, to avoid errors