From 512174a828039d10dcd15f46a8de170595ec0f16 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 26 Feb 2020 17:42:17 +0000 Subject: [PATCH] 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 --- ansible/cleanup_state.yml | 4 +++- ansible/library/tenks_update_state.py | 2 ++ ansible/roles/virtualbmc-daemon/tasks/main.yml | 2 +- ansible/schedule.yml | 4 +++- releasenotes/notes/ansible-2.7-2.8-63f01fbf5ab9ba08.yaml | 5 +++++ requirements.txt | 2 +- 6 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 ansible/library/tenks_update_state.py create mode 100644 releasenotes/notes/ansible-2.7-2.8-63f01fbf5ab9ba08.yaml diff --git a/ansible/cleanup_state.yml b/ansible/cleanup_state.yml index f865caf..ebab81b 100644 --- a/ansible/cleanup_state.yml +++ b/ansible/cleanup_state.yml @@ -18,5 +18,7 @@ copy: # tenks_schedule lookup plugin outputs a dict. Pretty-print this to # 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 }}" diff --git a/ansible/library/tenks_update_state.py b/ansible/library/tenks_update_state.py new file mode 100644 index 0000000..d2bbd38 --- /dev/null +++ b/ansible/library/tenks_update_state.py @@ -0,0 +1,2 @@ +# NOTE(mgoddard): Dummy module to fudge ansible-lint into working. +# tenks_update_state is actually an action_plugin. diff --git a/ansible/roles/virtualbmc-daemon/tasks/main.yml b/ansible/roles/virtualbmc-daemon/tasks/main.yml index b3b07e6..6aa26a6 100644 --- a/ansible/roles/virtualbmc-daemon/tasks/main.yml +++ b/ansible/roles/virtualbmc-daemon/tasks/main.yml @@ -12,7 +12,7 @@ - name: Ensure package dependencies are installed package: name: "{{ vbmcd_packages }}" - state: installed + state: present register: result until: result is success retries: 3 diff --git a/ansible/schedule.yml b/ansible/schedule.yml index de6977e..3241fa4 100644 --- a/ansible/schedule.yml +++ b/ansible/schedule.yml @@ -50,5 +50,7 @@ copy: # tenks_schedule lookup plugin outputs a dict. Pretty-print this to # 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 }}" diff --git a/releasenotes/notes/ansible-2.7-2.8-63f01fbf5ab9ba08.yaml b/releasenotes/notes/ansible-2.7-2.8-63f01fbf5ab9ba08.yaml new file mode 100644 index 0000000..1d15858 --- /dev/null +++ b/releasenotes/notes/ansible-2.7-2.8-63f01fbf5ab9ba08.yaml @@ -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. diff --git a/requirements.txt b/requirements.txt index 697b757..cf36bc4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,6 @@ pbr>=2.0 # Apache-2.0 # 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 selinux;python_version>='3' # MIT