However, the quoted string at the end is screwing my up. How do I make this work? Would ansible.builtin.blockinfile be better? If so, how would I set that up?
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see
details
[WARNING]: Found both group and host with same name: uoj
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in ‘/etc/ansible/playbooks/updatedns.yml’: line 8, column 16, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
name: Add to file
lineinfile: dest=/somedir/somefile insertafter=EOF line=‘_some-name TXT “aZJACEhonRJiOCL1ZtkKMKnx7U 4m5j bSswyClGb6wGk”’
^ here
“lineinfile” should line up with “name” above. The “lineinfile:” is the mapping that it’s complaining cannot be indented more than “name:”. Such indentation creates a new context. Thus the message, “mapping values are not allowed in this context”.
Is there a reason to use the “key=value” format instead of:
Thanks, Todd! with your hints, I was able to get the results I want.
Hopefully, I’m staying on-topic (and not being a pita) when I ask for further assistance with this playbook, and lineinfile. Here’s the playbook, thus far: