jinja2 - Using a relative path to reference another element in a multi dimensional array in Ansible-YAML -


i have multidimensional array that's defined in yaml syntax. part of group_vars file that's used ansible:

mirrors:   - name: "ubuntu"     dists:        - precise       - precise-backports       - precise-proposed       - precise-security       - precise-updates     frontend_uri: "/ubuntu"     package_pattern: "/ubuntu/pool"     sync_hour: 0     upstreams:       main: "nl.archive.ubuntu.com"       backups:         - "ubuntu.mirror.ac.ke"         - "ke.archive.ubuntu.com" 

what bothers me mirrors[0].frontend_uri , mirrors[0].package_pattern generated out of mirrors[0].name, need somehow reference them using relative path because don't want include iterator of first level (0) path, more or less this:

mirrors:   - name: "ubuntu"     dists:        - precise       - precise-backports       - precise-proposed       - precise-security       - precise-updates     frontend_uri: "/{{ .name }}"     package_pattern: "/{{ .name }}/pool"     sync_hour: 0     upstreams:       main: "nl.archive.ubuntu.com"       backups:         - "ubuntu.mirror.ac.ke"         - "ke.archive.ubuntu.com" 

is there way reference other parts of multi dimensional array using relative path?

this work: *name yamlism allows use defined alias & rest using variable reference not defined in same tree.

_name: &name "ubuntu" - name: *name     dists:        - precise       - precise-backports       - precise-proposed       - precise-security       - precise-updates     frontend_uri: "/{{ _name }}"     package_pattern: "/{{ _name }}/pool"     sync_hour: 0     upstreams:       main: "nl.archive.ubuntu.com"       backups:         - "ubuntu.mirror.ac.ke"         - "ke.archive.ubuntu.com" 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -