Skip to content

Errors with undefined scope variables. #2

@crayfishx

Description

@crayfishx

User (GitHub handle unknown) Wrote by email:

One final question.

In the jerakia.yaml file used for Ansible under the scope section is there a mechanism to attempt relating multiple variables.
What we ended up having in our configuration file was:

scope:
  hostname: ansible_nodename
  environment: ansible_local.custom.environment
  location: ansible_local.custom.location
  osfamily: ansible_os_family

What we found was that this ended up generating errors on systems that were missing local facts files that defined environment and location. Knowing this now we have adjusted the behavior of our playbooks but we were wondering if there was a supported mechanism to specifiy default values or other variables to use if one is not defined, i.e. something like the following:

scope:
  hostname: ansible_nodename
  environment: ansible_local.custom.environment|default('development')
  location: ansible_local.custom.location|default('deploying')
  osfamily: ansible_os_family

Or

scope:
  hostname: ansible_nodename
  environment: ansible_local.custom.environment, playbook_var_environment
  location: ansible_local.custom.location, playbook_var_location
  osfamily: ansible_os_family

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions