mrlesmithjr / ansible-netplan

Ansible role to manage Netplan
MIT License
132 stars 85 forks source link

Removed is defined check from config.yaml.j2 #37

Closed bromeara closed 1 year ago

bromeara commented 1 year ago

Description

By removing the 'if is defined' check and just using 'if ' in the template, the template can now support omit values that are technically defined but should be treated by roles as undefined, so they evaluate as false.

An example where this is useful is in a playbook using this role some hosts might have wifi capabilities while others do not, and so a host_var might have a list of access points or a blank string. By setting the blank string to omit before passing it to this role the wifi section of the config would not be included without throwing any errors.

Currently, it does throw an error if omit is passed to it since omit is defined but has no information the template needs to run.

Related Issue

36

Types of changes

  • [ x ] Bug fix (non-breaking change which fixes an issue)
  • [ x ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • [ * ] I have read the CONTRIBUTING document.(Doesnt seem to exist)
  • [ * ] I have run the pre-merge tests locally and they pass. No clear instructions on what those procedures are but the changes worked for me locally
  • [ * ] I have updated the documentation accordingly.
  • [ * ] I have added tests to cover my changes. Doesnt seem to be a currently existing test to modify for this template
  • [ * ] All new and existing tests passed.