play_hosts is deprecated

Bug #1674947 reported by Jean-Philippe Evrard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
Low
Luke Short

Bug Description

In galera server, system crontab, keepalived, and nova, we are using play_hosts.

We should move to ansible_play_hosts or, maybe, move to use ansible_play_batch.

Changed in openstack-ansible:
status: New → Confirmed
importance: Undecided → Low
Luke Short (ekultails)
Changed in openstack-ansible:
assignee: nobody → Luke Short (ekultails)
Revision history for this message
Eduardo Gonzalez (egonzalez90) wrote :

First we need to bump min ansible version to 2.2, atm ansible 2.0 and 2.1 are also supported and wont work with new parameters

Luke Short (ekultails)
Changed in openstack-ansible:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible (master)

Fix proposed to branch: master
Review: https://review.openstack.org/473197

Revision history for this message
Luke Short (ekultails) wrote :

According to http://docs.ansible.com/ansible/playbooks_variables.html the variable "ansible_play_batch" is the replacement for "play_hosts." I found and replaced all entries with the updated variable name.

The master (Pike) branch is using Ansible 2.3, Ocata is using 2.2, and Newton is using 2.1. Maybe we can have this also back-ported to the Ocata branch.

Revision history for this message
Luke Short (ekultails) wrote :

The Ansible documentation was a little confusing, making it sound like ansible_play_batch was the replacement for play_hosts. @odyssey4me pointed out in my initial patch that this might not be the case so I did some further testing and can verify that we definitely want to use ansible_play_hosts (which grabs all of the hosts from the Playbook) and not ansible_play_batch (which only grabs the name of hosts that the current task is running on).

I also tested using the deprecated play_hosts variable with Ansible 2.3 and 2.4 (from GitHub) and can confirm that it still works. It is still better for us to update this now rather than to wait for later when/if it's removed.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible (master)

Reviewed: https://review.openstack.org/473197
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible/commit/?id=7c642cc4df3239ea0621a6037e5072d851f7b148
Submitter: Jenkins
Branch: master

commit 7c642cc4df3239ea0621a6037e5072d851f7b148
Author: ekultails <email address hidden>
Date: Sun Jun 25 11:39:22 2017 -0400

    Change the variable name play_hosts to ansible_play_hosts

    Starting in Ansible 2.2, the play_hosts variable has been renamed to ansible_play_hosts. play_hosts is now deprecated and may be removed in a future release of Ansible.
    Reference: http://docs.ansible.com/ansible/playbooks_variables.html#magic-variables-and-how-to-access-information-about-other-hosts

    Closes-Bug: 1674947
    Change-Id: I3540aee86c0fd3a2b0bf086d4770b765aa1a052e

Changed in openstack-ansible:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/481551

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible (stable/ocata)

Reviewed: https://review.openstack.org/481551
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible/commit/?id=e9e64622504a00e5f65642335e172df66a446cc1
Submitter: Jenkins
Branch: stable/ocata

commit e9e64622504a00e5f65642335e172df66a446cc1
Author: Jesse Pretorius <email address hidden>
Date: Fri Jul 7 10:37:03 2017 +0100

    Change the variable name play_hosts to ansible_play_hosts

    Starting in Ansible 2.2, the play_hosts variable has been
    renamed to ansible_play_hosts. play_hosts is now deprecated
    and may be removed in a future release of Ansible.

    Also, the play_hosts variable represents the hosts in a
    serial batch, rather than all the hosts targeted by the
    playbook which is what these variables are intending.

    Reference: http://docs.ansible.com/ansible/playbooks_variables.html#magic-variables-and-how-to-access-information-about-other-hosts

    Backport note:
    Re-implementation of https://review.openstack.org/473197
    due to structural changes.

    Closes-Bug: 1674947
    Change-Id: I3540aee86c0fd3a2b0bf086d4770b765aa1a052e

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible 16.0.0.0b3

This issue was fixed in the openstack/openstack-ansible 16.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible 15.1.7

This issue was fixed in the openstack/openstack-ansible 15.1.7 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.