Move dynamic grouping conditional
Instead of using a when clause around the inclusion of the dynamic-grouping task, use a new var, 'group_when' that's only applied within the task. This will avoid checking localhost for a hostvar which doesn't actually apply and may not exist. Change-Id: I44fa2b0e5b62f632c4b2fe2cc453d08692d97544
This commit is contained in:

committed by
Kevin Carter (cloudnull)

parent
a3db82793b
commit
c1bcb9e922
@@ -13,12 +13,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Add {{ inventory_hostname }} to dynamic inventory group
|
||||
- name: Add hosts to dynamic inventory group
|
||||
add_host:
|
||||
group: "{{ dest_group }}"
|
||||
name: "{{ item }}"
|
||||
with_items: "{{ groups[src_group] }}"
|
||||
when:
|
||||
- "src_group in groups"
|
||||
- "group_when | default(True)"
|
||||
tags:
|
||||
- common-grouping
|
||||
|
@@ -23,8 +23,8 @@
|
||||
vars:
|
||||
src_group: "nova_compute"
|
||||
dest_group: "neutron_l3_agent, neutron_metadata_agent"
|
||||
when:
|
||||
- "neutron_plugin_type == 'ml2.ovs.dvr'"
|
||||
group_when:
|
||||
- "neutron_plugin_type == 'ml2.ovs.dvr'"
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user