mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-12 07:35:31 +01:00
Fix module in order to don't show "changed" status when running ansible playbook with authorized_key module if keys are not different
This commit is contained in:
parent
6343dbdcff
commit
0d5458c6cc
1 changed files with 6 additions and 3 deletions
|
|
@ -618,9 +618,12 @@ def enforce_state(module, params):
|
||||||
# for 'exclusive', make sure keys are written in the order the new keys were
|
# for 'exclusive', make sure keys are written in the order the new keys were
|
||||||
if state == "present" and exclusive:
|
if state == "present" and exclusive:
|
||||||
to_remove = frozenset(existing_keys).difference(keys_to_exist)
|
to_remove = frozenset(existing_keys).difference(keys_to_exist)
|
||||||
|
if len(to_remove) != 0:
|
||||||
for key in to_remove:
|
for key in to_remove:
|
||||||
del existing_keys[key]
|
del existing_keys[key]
|
||||||
do_write = True
|
do_write = True
|
||||||
|
else:
|
||||||
|
do_write = False
|
||||||
|
|
||||||
if do_write:
|
if do_write:
|
||||||
filename = keyfile(module, user, do_write, path, manage_dir, follow)
|
filename = keyfile(module, user, do_write, path, manage_dir, follow)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue