I take it you want facts defined in network_port_channel.yml
to be local to that file. If that file were a role it would be a special case of a problem I attempted to solve very recently (see my post on the topic), so I have a suggestion.
While you can refactor to a role and use my collection, I wouldn’t bet on it being production ready. Instead, since I believe you are in control of all the code, you can set a dictionary as a fact at the start of each iteration, and set any local facts on that dictionary fact.
--- # network_port_channel.yml
- name: reset the fact to serve as a local namespace
ansible.builtin.set_fact:
local: {}
- name: set `my_fact` key on `local`
ansible.builtin.set_fact:
local: "{{ local | combine({ 'my_fact': my_value }) }}"
- name: use the local fact
ansible.builtin.debug:
var: local.my_fact
- ...