As far as I can tell I have all of my quotes... it just doesn't seem to
like my escaping... Adding verbosity didn't give me any useful information.
- name: Sanitize vm.cfg step 2 of
lineinfile:
path: "{{ file }}"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
backrefs: "{{ item.backrefs }}"
with_items:
- { regexp: "^(vif.*'mac=)((\w{2}:){3})((\w{2}:?){3})(.+)'$", line:
"\1\2AA:{{
99 | random(start=10, step=1) }}:{{ 99 | random(start=10, step=1) }}\6":
backrefs: yes }
- { regexp: "(^uuid)(?:[=\s']+)'(.*)'.*$", line: "{{ newid.stdout
}}", backrefs: no }
- { regexp: "(^name)(?:[=\s']+)'(.*)'.*$", line: "{{ newid.stdout
}}", backrefs: no }
Result:
ERROR! Syntax Error while loading YAML.
found unknown escape character
The error appears to have been in '/etc/ansible/playbooks/one-offs/test.yml'
: line 46, column 37, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
with_items:
- { regexp: "^(vif.*'mac=)((\w{2}:){3})((\w{2}:?){3})(.+)'$", line:
"\1\2AA:{{
99 | random(start=10, step=1) }}:{{ 99 | random(start=10, step=1) }}\6":
backrefs: yes }
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f9be92b0-81fc-401d-a99a-fd997b144c80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.