Issue 1:
From @calvinII on 2016-05-31T18:35:14Z

ISSUE TYPE

Bug Report

COMPONENT NAME

known_hosts

ANSIBLE VERSION

ansible 2.1.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

<!--- Paste verbatim output from “ansible --version” between quotes -->

CONFIGURATION

OS / ENVIRONMENT

Debian Jessie

SUMMARY

If I call known_hosts to add a given key it changes on every call

STEPS TO REPRODUCE

Easy to reproduce, insert new key via known_hosts module in your .ssh/known_hosts, check for it, retry it again, and see that it changes again even if the correct key is already in your known_hosts.

Example:

# Insert Key using known_hosts module
uhochholdinger@xelo:~$ ansible -i 'localhost,' all -m known_hosts -a 'key="xelo ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJzrHvJZ7bVys4f73Qr1B3qgLkX7sUP6JUpUgAJCCacTeelzQu2JbbOr6aho7K4k1iTZICfaEXEwFMAMtuchpw4= root@xelo" name="xelo"'
localhost | SUCCESS => {
"changed": true,
"gid": 10000,
"group": "np",
"key": "xelo ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJzrHvJZ7bVys4f73Qr1B3qgLkX7sUP6JUpUgAJCCacTeelzQu2JbbOr6aho7K4k1iTZICfaEXEwFMAMtuchpw4= root@xelo",
"mode": "0600",
"name": "xelo",
"owner": "uhochholdinger",
"path": "/home/uhochholdinger/.ssh/known_hosts",
"size": 300811,
"state": "file",
"uid": 1016
}

# Check if key is available, compare with added key!
uhochholdinger@xelo:~$ ssh-keygen -F xelo
# Host xelo found: line 978 type ECDSA
xelo ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJzrHvJZ7bVys4f73Qr1B3qgLkX7sUP6JUpUgAJCCacTeelzQu2JbbOr6aho7K4k1iTZICfaEXEwFMAMtuchpw4=

# Try to add key again
uhochholdinger@xelo:~$ ansible -i 'localhost,' all -m known_hosts -a 'key="xelo ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJzrHvJZ7bVys4f73Qr1B3qgLkX7sUP6JUpUgAJCCacTeelzQu2JbbOr6aho7K4k1iTZICfaEXEwFMAMtuchpw4= root@xelo" name="xelo"'
localhost | SUCCESS => {
"changed": true,
"gid": 10000,
"group": "np",
"key": "xelo ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJzrHvJZ7bVys4f73Qr1B3qgLkX7sUP6JUpUgAJCCacTeelzQu2JbbOr6aho7K4k1iTZICfaEXEwFMAMtuchpw4= root@xelo",
"mode": "0600",
"name": "xelo",
"owner": "uhochholdinger",
"path": "/home/uhochholdinger/.ssh/known_hosts",
"size": 300811,
"state": "file",
"uid": 1016
}

Cheers

Ulli

Copied from original issue: ansible/ansible-modules-extras#2350

Issue 2:
ISSUE TYPE

Bug Report / Feature Idea

COMPONENT NAME

ini_file

ANSIBLE VERSION

ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/something/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4]

CONFIGURATION

DEFAULT_REMOTE_PORT(/etc/ansible/ansible.cfg) = 22

PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 30

OS / ENVIRONMENT

Ubuntu Server 16.04 LTS, 64-bit

SUMMARY

When writing INI files from two instances to the same file and host it sometimes corrupts the file, resulting in wrong INI syntax (duplicates or a half section written to file).

STEPS TO REPRODUCE

Try to setup a test host and write to a INI file, execute the playbook/script few times at the same time.

EXPECTED RESULTS

I understand that it's a bad concept of potentially having the INI write at the same time, but with some deployment setup it could happen at any time you have scheduled tasks and manual tasks at the same time. It would be awesome to have a lock mechanism to the INI function.

ACTUAL RESULTS

Duplicates or weird syntax in the ini file.