What is the exact error message you're getting? I only slightly agree with Mr. Fellers response ("create a custom vars plugin"), but in your case that might be overkill. I've seen teams that have a developer write some custom code that breaks soon after he/she leaves and then they are stuck with a bigger mess than if they had tried to work with Ansible included modules.
On Sunday, August 4, 2019 at 9:13:31 AM UTC-5, gerard moisset wrote: > > i'm trying to write playbook to downlaod packages from repo. > > here is my try. > > csv data > =========================== > > cat {{ansibleDir}}/temp/csv_data: > > module;goroco;repo > tzdata-26d;G01R01C01;dnc > ansible-26d;G00R00C00;dnc-unstable > webadmi-26d;G01R01C02;dnc-unstable > > > csv2yml file python script > ============================ > > cat {{ansibleDir}}/csv2yml.py: > > > #!/usr/bin/env python > > import csv > import sys > import yaml > > csv_data = [] > with open(sys.argv[1]) as csvfile: > reader = csv.DictReader(csvfile) > for row in reader: > csv_data.append(row) > > with open(sys.argv[1] + '.yml', 'w') as outfile: > outfile.write(yaml.dump({'csv_data': csv_data})) > > > > ymlFromCsv file > ================================ > > cat {{ansibleDir}}/temp/csv_data.yml: > > csv_data: > - {module;goroco;repo: tzdata-26d;G01R01C01;dnc} > - {module;goroco;repo: ansible-26d;G00R00C00;dnc-unstable} > - {module;goroco;repo: webadmi-26d;G01R01C02;dnc-unstable} > > > playbook > ================================= > > try do downlaod package from repo > > > --- > - hosts: localhost > connection: local > become: false > gather_facts: false > > > vars_files: > - /home/ansible/temp/csv_data.yml > tasks: > - name: parse csv and make vars file > command: "python /home/ansible/scripts/csv2yml.py > /home/ansible/temp/csv_data" > - debug: var=csv_data > > > > - name: define vars > include_vars: > file: "/home/ansible/temp/csv_data.yml" > > > missing task > ==================================== > > > > > i need task to be defined either from csv_data, or csv_data.yml, iterating > on, > > curl -v --remote-name --proxy {{ proxy }} --proxy-user {{ credentials }} > {{ downloadUrl }}/{{ delivery.repo }}/{{ delivery.module }}/{{ > delivery.goroco }}/PL-{{ delivery.module }}-{{delivery.goroco }}.tar > > but i've not yet found the way to reuse my vars. > > any help is welcome. > > > -- 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-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/dee43eaf-db55-4105-adc0-9a24d0a236a1%40googlegroups.com.