I'm trying to build certain software on each machine locally. The playbook would download the source tarball (using get_url), configure and build it.
I'd like to define the list of items to build as something like the below:
srcpkg:
python:
ver: "3.7.0"
sha: "0382996d1ee6aafe59763426cf0139ffebe36984474d0ec4126dd1c40a8b3549"
url: "https://www.python.org/ftp/python/{{ srcpkg.python.ver }}/python/Python-{{ srcpkg.python.pyver }}.tar.xz"
Unfortunately, such references to itself (the url
refers to ver
in the above example) cause Ansible to throw a "recursive loop detected" error at runtime.
Is there a way -- either in Ansible or, maybe, simply in Yaml -- to define things so that I wouldn't have to repeat the version in more than one place?
Update: tried to use anchor/reference:
srcpkg:
python:
ver: &ver "3.7.0"
sha: "0382996d1ee6aafe59763426cf0139ffebe36984474d0ec4126dd1c40a8b3549"
url: "https://www.python.org/ftp/python/{{ *ver }}/python/Python-{{ *ver }}.tar.xz"
to no avail: Ansible complains of "unexpected '*'".