ansible-freeipa icon indicating copy to clipboard operation
ansible-freeipa copied to clipboard

API.bootstrap() already called

Open mnaser opened this issue 2 years ago • 8 comments

In our CI, using Ansible 2.10, when running inside check mode, we see the following:

TASK [freeipa.ansible_freeipa.ipahostgroup] ************************************
changed: [XXX] => (item={'name': 'XXXX_controllers'})
failed: [XXX] (item={'name': 'XXXX_cephs'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "XXX_cephs"}, "msg": "API.bootstrap() already called"}
failed: [XXX] (item={'name': 'XXX_computes'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "XXX_computes"}, "msg": "API.bootstrap() already called"}

It seems like after the first one, the rest fails.

mnaser avatar Nov 09 '21 15:11 mnaser

Can you give more details about the issue? What is the OS version? Which IPA version? Can you provide a minimal playbook that reproduces the issue?

Some modules do not play well with check_mode returning changed: True when it should be changed: False, but I have never seen the behavior you reported. We need more data to even check if it is a bug or not.

rjeffman avatar Nov 09 '21 23:11 rjeffman

Ansible is running inside the container cytopia/ansible:2.10-tools. Task looks like the following:

- freeipa.ansible_freeipa.ipahostgroup:
    ipaadmin_principal: "{{ ipaadmin_principal }}"
    ipaadmin_password: "{{ ipaadmin_password }}"
    name: "{{ item.name }}"
    host: "{{ item.hosts | default([]) }}"
    hostgroup: "{{ item.host_groups | default([]) }}"
  loop:
    - name: group1
    - name: group2
    - name: group3
    - name: group
      host_groups:
        - group1
        - group2
        - group3

We are running the task in check mode and diff mode(with --check and --diff options)

xuxant avatar Jan 12 '22 09:01 xuxant

We still need the IPA, ansible-freeipa and OS versions.

I was not able to reproduce your issue.

rjeffman avatar Jan 12 '22 12:01 rjeffman

Also note that check_mode is supported, but output is no different if using --diff, which is not yet supported (see #483).

rjeffman avatar Jan 12 '22 12:01 rjeffman

I am able to reproduce this issue while using mitogen_linear strategy to run the playbook.

xuxant avatar Jan 31 '22 06:01 xuxant

The use of mitogen_linear is not currently supported, due to the way IPA works, and the way we use IPA's API.

Support for mitogen_linear it is not planned in the near future.

rjeffman avatar Jan 31 '22 15:01 rjeffman

@rjeffman fair enough, we'll stop using it in that case. would it make sense to probably document it to help others or shouldn't be necessary to close this issue?

mnaser avatar Feb 15 '22 17:02 mnaser

@mnaser it would be hard to document what we do not support, specially, third-party tools, as it happened with this issue, that we didn't even know a tool like that existed. I prefer to approach it like "if it is not explicitly stated that it is supported, it is not supported and you are on your own, sorry".

Often, it is better to have the issue opened, which might turn out to be something that we want and can implement. If it turns out there there is a lot of demand for a feature, we might need to prioritize it if it can be implemented, even if not previously planned. The problem with mitogen_linear is that although it seems an interesting thing to support, due to the way IPA API is used, we can't implement it (at least, this time).

rjeffman avatar Feb 15 '22 17:02 rjeffman