8000 Wrong condition is defined for Role Variables · Issue #66 · workleap/ansible-role-azure-devops-agent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Wrong condition is defined for Role Variables #66
Open
@pcurt

Description

@pcurt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0