lineinfile module converts double quotes to single quotes unexpectedly #40476
Labels
affects_2.5
This issue/PR affects Ansible v2.5
bug
This issue/PR relates to a bug.
module
This issue/PR relates to a module.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
ISSUE TYPE
COMPONENT NAME
lineinfile
ANSIBLE VERSION
CONFIGURATION
DEFAULT_FORKS([REDACTED]) = 15
DEFAULT_HOST_LIST[REDACTED]) = [u'/data/ansible-best-practice/inventories/all.inventory']
DEFAULT_REMOTE_USER([REDACTED]) = ansnixpr
DEFAULT_STDOUT_CALLBACK([REDACTED]) = skippy
DEFAULT_TIMEOUT([REDACTED]) = 30
HOST_KEY_CHECKING([REDACTED]) = False
OS / ENVIRONMENT
RedHat 7.3 (controller and target)
SUMMARY
double quotes being converted to single quotes; escaping does not help.
STEPS TO REPRODUCE
EXPECTED RESULTS
Expected file: /etc/rhsm/facts/katello.facts to contain:
{ "network.hostname" : "hostname.example.com" }
ACTUAL RESULTS
File contained: all double quotes converted to single quotes. Suspect text is being interpreted as JSON format and quoting is occuring. Need double quotes:
{'network.hostname': 'hostname.example.com'}
Note: removing the opening and closing braces. I.e.:
Change:
{ "network.hostname" : "{{ ansible_fqdn }}" }
to:
"network.hostname" : "hostname.example.com"
yields the expected output in the file (i.e. the double quotes are not converted to single quotes).
The text was updated successfully, but these errors were encountered: