Bump ansible version constraints to >=2.7,<2.10

This means that ansible 2.9 is typically used, and causes ansible-lint
to fail. Two workarounds have been added to address this:

* Use .get() to avoid passing an undefined object through to_nice_yaml
  filter
* Create a dummy tenks_update_state.py module to avoid ansible-lint
  being confused about our action plugin.

Change-Id: I54388f713e17a47601be2db63a26fc43ca7ac6c8
This commit is contained in:
Mark Goddard 2020-02-26 17:42:17 +00:00
parent 3db82fd551
commit 512174a828
6 changed files with 15 additions and 4 deletions

View File

@ -18,5 +18,7 @@
copy: copy:
# tenks_schedule lookup plugin outputs a dict. Pretty-print this to # tenks_schedule lookup plugin outputs a dict. Pretty-print this to
# persist it in a YAML file. # persist it in a YAML file.
content: "{{ new_state.result | to_nice_yaml }}" # NOTE(mgoddard): Use .get to avoid a nasty error in ansible-lint
# (cannot represent an object).
content: "{{ new_state.get('result') | to_nice_yaml }}"
dest: "{{ state_file_path }}" dest: "{{ state_file_path }}"

View File

@ -0,0 +1,2 @@
# NOTE(mgoddard): Dummy module to fudge ansible-lint into working.
# tenks_update_state is actually an action_plugin.

View File

@ -12,7 +12,7 @@
- name: Ensure package dependencies are installed - name: Ensure package dependencies are installed
package: package:
name: "{{ vbmcd_packages }}" name: "{{ vbmcd_packages }}"
state: installed state: present
register: result register: result
until: result is success until: result is success
retries: 3 retries: 3

View File

@ -50,5 +50,7 @@
copy: copy:
# tenks_schedule lookup plugin outputs a dict. Pretty-print this to # tenks_schedule lookup plugin outputs a dict. Pretty-print this to
# persist it in a YAML file. # persist it in a YAML file.
content: "{{ new_state.result | to_nice_yaml }}" # NOTE(mgoddard): Use .get to avoid a nasty error in ansible-lint
# (cannot represent an object).
content: "{{ new_state.get('result') | to_nice_yaml }}"
dest: "{{ state_file_path }}" dest: "{{ state_file_path }}"

View File

@ -0,0 +1,5 @@
---
features:
- |
Updates the minimum allowed version of Ansible from 2.6 to 2.7, and the
maximum allowed version from 2.7.x to 2.9.x.

View File

@ -4,6 +4,6 @@
pbr>=2.0 # Apache-2.0 pbr>=2.0 # Apache-2.0
# NOTE(mgoddard): Ansible 2.8.0 breaks ansible-lint. # NOTE(mgoddard): Ansible 2.8.0 breaks ansible-lint.
ansible>=2.6.0,<2.8.0 # GPLv3 ansible>=2.7.0,<2.10.0 # GPLv3
os-client-config # Apache-2.0 os-client-config # Apache-2.0
selinux;python_version>='3' # MIT selinux;python_version>='3' # MIT