From 89c30cb923863c71a88647309cdc605b18caa777 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Wed, 23 Oct 2019 12:02:51 +0200 Subject: [PATCH] Using loop instead of with_X The loop keyword is the current recommended way to handle loops, and supports filters. It's available since Ansible version 2.5 so changing ansible requirement in driver-requirements. Change-Id: Ibff1f07ca00b8f5a5274d73f9e53196f49c33a66 --- doc/source/admin/drivers/ansible.rst | 2 +- driver-requirements.txt | 2 +- .../modules/ansible/playbooks/roles/discover/tasks/main.yaml | 2 +- releasenotes/notes/ansible-loops-de0eef0d5b79a9ff.yaml | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/ansible-loops-de0eef0d5b79a9ff.yaml diff --git a/doc/source/admin/drivers/ansible.rst b/doc/source/admin/drivers/ansible.rst index f95b7b25f7..3c1a7436c0 100644 --- a/doc/source/admin/drivers/ansible.rst +++ b/doc/source/admin/drivers/ansible.rst @@ -125,7 +125,7 @@ Requirements ============ Ansible - Tested with, and targets, Ansible 2.4.x + Tested with, and targets, Ansible 2.5.x Bootstrap image requirements ---------------------------- diff --git a/driver-requirements.txt b/driver-requirements.txt index 183a3122b2..c9874f12f9 100644 --- a/driver-requirements.txt +++ b/driver-requirements.txt @@ -14,7 +14,7 @@ python-xclarityclient>=0.1.6 sushy>=2.0.0 # Ansible-deploy interface -ansible>=2.4 +ansible>=2.5 # HUAWEI iBMC hardware type uses the python-ibmcclient library python-ibmcclient>=0.1.0 diff --git a/ironic/drivers/modules/ansible/playbooks/roles/discover/tasks/main.yaml b/ironic/drivers/modules/ansible/playbooks/roles/discover/tasks/main.yaml index f80d5b545e..20e09b4b5e 100644 --- a/ironic/drivers/modules/ansible/playbooks/roles/discover/tasks/main.yaml +++ b/ironic/drivers/modules/ansible/playbooks/roles/discover/tasks/main.yaml @@ -3,7 +3,7 @@ - set_fact: ironic_root_device: /dev/{{ item.key }} - with_dict: "{{ ansible_devices }}" + loop: "{{ ansible_devices | dict2items | sort(attribute='key') }}" when: - ironic_root_device is undefined - item.value.host diff --git a/releasenotes/notes/ansible-loops-de0eef0d5b79a9ff.yaml b/releasenotes/notes/ansible-loops-de0eef0d5b79a9ff.yaml new file mode 100644 index 0000000000..85f9a4085b --- /dev/null +++ b/releasenotes/notes/ansible-loops-de0eef0d5b79a9ff.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Changing minimum version of Ansible for use with the ``ansible`` + ``deploy_interface`` to version 2.5.