disk = [file:/OVS/Repositories/0004fb0000030000df2ee11376f1cd94/VirtualDisks/b7558d7745c14b02806d08f8003906e1.img,xvda,w,phy:/OVS/Repositories/0004fb0000030000df2ee11376f1cd94/VirtualDisks/0004fb0000120000049ec392e534e039,xvdb,w,file:/OVS/Repositories/0004fb0000030000df2ee11376f1cd94/VirtualDisks/0004fb0000120000843bb7e2fe395f24.img,xvdc,w](\w+.img) - name: Gather current virtual disks
lineinfile:
path: "{{ file }}"
regexp: (\w+.img)
line: ''
check_mode: yes
register: virt_disk
ok: [myftpserver] => {
"virt_disk": {
"backup": "",
"changed": true,
"diff": [
{
"after": "",
"after_header": "/var/ftp/vm.cfg (content)",
"before": "",
"before_header": "/var/ftp/vm.cfg (content)"
},
{
"after_header": "/var/ftp/vm.cfg (file attributes)",
"before_header": "/var/ftp/vm.cfg (file attributes)"
}
],
"failed": false,
"msg": "line replaced"
}
}
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fca87b68-ce68-4c14-840c-ecfba3a7664b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- name: Find virtual Disks
set_fact:
virt_disks: "{{ lookup('file','/var/ftp/vm.cfg') | regex_findall('\w+.img') }}"ERROR! Syntax Error while loading YAML.
found unknown escape character
The error appears to have been in '/etc/ansible/playbooks/one-offs/sanitize_vm.yml': line 21, column 75, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
set_fact:
virt_disks: "{{ lookup('file','/var/ftp/vm.cfg') | regex_findall('\w+.img') }}"
^ 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 }}"
TASK [Find virtual Disks] ****************************************************************************************************************************************************************************************************************
[WARNING]: Unable to find '/var/ftp/vm.cfg' in expected paths (use -vvvvv to see paths)
fatal: [ovmftp]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'file'. Error was a <class 'ansible.errors.AnsibleError'>, original message: could not locate file in lookup: /var/ftp/vm.cfg"}
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/723d9abf-e640-4494-82c3-565fcdcfeda4%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0894095e-005e-4e67-8007-56a8b2d9a73e%40googlegroups.com.