Hello,

I'm trying to read some .csv files, then create config files for each of 
the .csv files, based on a template. Reading the files is not a problem. 
However, I can't seem to get the destination parameter to work. I would 
like the output file to be the name of the original .csv file with a .xml 
extension.

---

- name: Read the csv files
  find:
    paths: /home/sysadmin/TimsTest1/roles/opengear/files
    patterns: '*.csv'
  register: files_matched

- name: Create OpenGear device configs
  template:
    src: "opengear8port.j2"
    dest: "{{ files_matched.files.path | basename | 
regex_replace('csv','xml') }}"
  with_items: "{{ files_matched.files }}"


When I run the playbook, I receive the following on the final task:

TASK [opengear : Create OpenGear device configs] 
***************************************************************************************************************************
task path: /home/sysadmin/TimsTest1/roles/opengear/tasks/main.yml:9
fatal: [localhost]: FAILED! => {
    "failed": true, 
    "msg": "the field 'args' has an invalid value, which appears to include 
a variable that is undefined. The error was: 'list object' has no attribute 
'path'\n\nThe error appears to have been in 
'/home/sysadmin/TimsTest1/roles/opengear/tasks/main.yml': line 9, column 3, 
but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n- name: Create OpenGear 
device configs\n  ^ here\n"
}


I can't seem to get the syntax correct on the destination. Any help is 
appreciated.

Thank you

-- 
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/30916d81-a107-4e46-b7fe-d938b58619b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to