Open
Description
Summary
Let's say we have host-1 with runner_version: 2.316.1
and host-2 with runner_version: "latest"
. Role will fail in that case.
I suppose it's because the following task has when: runner_version == "latest"
condition:
- name: Find the latest runner version (RUN ONCE)
ansible.builtin.uri:
url: "https://api.github.com/repos/{{ runner_download_repository }}/releases/latest"
headers:
Content-Type: "application/json"
method: GET
return_content: true
status_code: 200
body_format: json
check_mode: false
register: api_response
run_once: true
become: false
delegate_to: localhost
when: runner_version == "latest"
Issue Type
Bug Report
Ansible Version
ansible [core 2.12.6]
config file = /infra-github-runners/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
jinja version = 3.1.2
libyaml = True
Steps to Reproduce
- Configure environment like the following:
TASK [debug] *******************************************************************
ok: [host-1] => {
"runner_version": "2.316.1"
}
ok: [host-2] => {
"runner_version": "latest"
}
- Run role against two hosts
- Output will be the following (shortened):
TASK [ansible-github_actions_runner : Find the latest runner version (RUN ONCE)] ***
skipping: [host-1]
...
TASK [ansible-github_actions_runner : Set runner_version variable (If latest)] ***
skipping: [host-1]
fatal: [host-2]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'json'\n\nThe error appears to be in '/__w/infra-github-runners/infra-github-runners/roles/ansible-github_actions_runner/tasks/install_runner.yml': line 10, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set runner_version variable (If latest)\n ^ here\n"}
Expected Results
api_response
is set for all hosts in play
Actual Results
`api_response` is set only if the first host has `runner_version: "latest"`