Can't remove host if Foreman callback plugin is enabled

Problem:
When foreman plugin is enabled I can’t use foreman.host module in order to remove a host from foreman.
I think it is because foreman callback plugin is executed for each task. Therefore, firstly foreman.host is removes a host from foreman and after a short while foreman callback plugin is executed to report host status to foreman. Which in consequence, re-creates that previously removed host.

I tried to disable callback module by:

  • setting env variable FOREMAN_CALLBACK_DISABLE=1
  • by adding a var in vars file: disable_callback: 1

And it doesn’t help.
Are there other options, apart from having extra ansible.cfg file in which this plugin is not enabled?

Expected outcome:
Possibility to temporarily disable foreman plugin.

Foreman and Proxy versions:
Foreman 3.8

Distribution and version:
Ubuntu 20.04

Ok I fixed that by modyfing v2_runner_on_ok method of foreman plugin:

        module_params = result._task.args.copy()
        if module == 'setup' or 'ansible_facts' in res:
            self.disabled = False
            host = result._host.get_name()
            self.send_facts(host, res)
        elif module == 'theforeman.foreman.host':
            if 'state' in module_params:
                if module_params['state'] == 'absent':
                    self.disabled = True
        else:
            self.disabled = False
            self.append_result(result)