Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong condition is defined for Role Variables #66

Open
pcurt opened this issue Aug 8, 2022 · 0 comments
Open

Wrong condition is defined for Role Variables #66

pcurt opened this issue Aug 8, 2022 · 0 comments

Comments

@pcurt
Copy link

pcurt commented Aug 8, 2022

The issue

Some task are depending on the definition of some role variables.
For example the set proxy task is defined like it:

- name: Set proxy
  set_fact:
    agent_cmd_args: "{{ agent_cmd_args }} + ['--proxyurl \\'{{ az_devops_proxy_url }}\\'', '--proxyusername \\'{{ az_devops_proxy_username }}\\'', '--proxypassword \\'{{ az_devops_proxy_password }}\\'']"
  when:
    - az_devops_proxy_url is defined

The problem is that az_devops_proxy_url is defined to null in main.yml file
az_devops_proxy_url: null

With this initialisation the condition az_devops_proxy_url is defined is true and the task is not skipped.

The fix

To fix the issue we shall use this condition for all tasks depending a variable role definition:

 when:
    - az_devops_proxy_url is not none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant