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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/822689ba-6059-4401-b500-ddf3c1ee7b98%40googlegroups.com.

Reply via email to