When I execute the ansible task, I get the following:
fatal: [baseserver2.jlhimpel.net]: FAILED! => {"msg": "JMESPathError in json_query filter plugin:\ninvalid token: Parse error at column 59, token "32" (NUMBER), for expression:\n"repository[?os==fedora && architecture==x86_64 && release==32].{repoUrl: repoUrl}"\n
I'm not sure how to correct the syntax error. Also, please note that the value of release
may be all numeric or may be non-numeric (Note difference between "fedora" values and "ubuntu" values.
Any suggestions would be greatly appreciated.
defaults/main.xml
distributionRepositoryUrl:
repository:
- os: fedora
architecture: aarch64
release: 32
repoUrl: https://download.fedoraproject.org:/pub/fedora/linux/releases/32/Server/aarch64/os/
- os: fedora
architecture: x86_64
release: 32
repoUrl: https://download.fedoraproject.org:/pub/fedora/linux/releases/32/Server/x86_64/os/
- os: ubuntu
architecture: amd64
release: 18_04
repoUrl: https://archive.ubuntu.com:/ubuntu/dists/bionic/main/installer-amd64/
- os: ubuntu
architecture: i386
release: 18_04
repoUrl: https://archive.ubuntu.com:/ubuntu/dists/bionic/main/installer-i386/
vars/main.yml
os: fedora
architecture: x86_64
release: 32
tasks/main.yml
- name: Display os architecture release
debug:
msg: "os:{{ os }} architecture:{{ architecture }} release:{{ release }}"
- name: Lookup fedora x86_64 32 repoUrl
debug:
msg: "repoUtl:{{ fedVar.repoUrl }}"
loop: "{{ distributionRepositoryUrl | json_query(url_query) | flatten }}"
loop_control:
loop_var: fedVar
vars:
url_query: "repository[?os=={{ os }} && architecture=={{ architecture }} && release=={{ release }}].{repoUrl: repoUrl}"