Meta module

Hello,

I have playbook played in tower and at the end of a block I use meta: end_play module without any condition.
I don’t know why but this task is ignored and when I enable debug it displays:
META:
Instead of:
META: END PLAY

What can be the reason for tower or ansible to ignore meta?

Best Regards,
Folio Brice Roland

-vvv output of that task would be helpful in finding out

Hi,

I tried it, without success.
No information in output, except for the task just before it.

Best Regards,
Folio Brice Roland

That is all capitals, and it's not an item in a list.
Can you post the actual YAML instead of some mangled human interpretation?

Dick

so it is working, the play is ending, it is not being skipped

Hi,

Here the issuing part of code:

  • name: “Check aggregated interface configuration and save the differences”
    ansible.builtin.set_fact:
    aggregated_interface_configuration_difference: “{{ lines | difference(r_aggregated_interface_configuration.stdout_lines | first) }}”
    vars:
    lines:

  • inherit port-profile RLB-CLIENT-TRUNK-PO-MEMBER-10G

  • " description PZB-{{ server_serial_number }}-{{ pizza_box_name }}"

  • " channel-group {{ port_channel_id }}"

  • " no snmp trap link-status"

  • name: “Check difference between the configuration of interfaces and targets configurations”
    ansible.builtin.assert:
    that:

  • (po_configuration_difference | length) == 0

  • (aggregated_interface_configuration_difference | length) == 0
    fail_msg: “Port-channel for {{ server_serial_number }}-{{ pizza_box_name }} duo already exists with wrong configuration, cannot create new configuration”

  • name: “Close session if port-channel and interfaces configurations are correct”
    ansible.builtin.meta: end_play

  • name: “Validate discovered interfaces”
    run_once: yes
    delegate_to: localhost
    any_errors_fatal: yes
    vars:
    all_switches_interfaces: “{{ hostvars | dict2items(key_name=‘host’, value_name=‘hostvars’) | selectattr(‘hostvars.interface_without_po_set’, ‘defined’) | map(attribute=‘hostvars.interface_without_po_set’) | list | flatten }}”

Here, the result:
TASK [Check aggregated interface configuration and save the differences] *******
skipping: [SWITCH56]
skipping: [SWITCH55]
skipping: [SWITCH58]
skipping: [SWITCH57]
skipping: [SWITCH65]
skipping: [SWITCH66]
ok: [SWITCH64]
ok: [SWITCH63]

TASK [Check difference between the configuration of interfaces and targets configurations] ***
skipping: [SWITCH56]
skipping: [SWITCH55]
skipping: [SWITCH57]
skipping: [SWITCH58]
skipping: [SWITCH66]
skipping: [SWITCH65]
ok: [SWITCH64] => {
“changed”: false,
“msg”: “All assertions passed”
}
ok: [SWITCH63] => {
“changed”: false,
“msg”: “All assertions passed”
}

TASK [Validate discovered switch interfaces from switch-side MAC addresses] ****
ok: [SWITCH56 → localhost]

As you can see, the task Check difference between the configuration of interfaces and targets configurations is successfull so just after that the meta end play must stop the execution but the playbook continues and the next task Validate discovered switch interfaces from switch-side MAC addresses is played.

So I don’t understand.

Best Regards,
Folio Brice Roland

You don't have any conditionals defined on the tasks, but from the
output you show they are inheriting some conditional (otherwise they
would not skip hosts) so the meta task is probably skipped because the
first host that triggers it has that conditional result in False (see
run_once/bypass host loop behaviors).

Hi Brian !

Thanks a lot!
Indeed,as the first host that triggered it does not have the required conditions the task is skipped for all others hosts.
It seems that it does not work like others modules that check the condition for all hosts to execute or not the task for each of them.

Best Regards,
Folio Brice Roland

many actions do this, they normally have a note that states they
'bypass host loop', for example add_host, and group_by do the same
thing.