unistra / ansible-collection-glpi

Ansible dynamic inventory for GLPI.
GNU General Public License v3.0
9 stars 5 forks source link

Adding new items is not working #7

Closed antonwantstosleep closed 1 year ago

antonwantstosleep commented 1 year ago

Hi! I am using your module to manage GLPI from Ansible. Thank you very much!

Looks like you forgot to add add directives to the plugins/modules/api.py.

# add
if 'add' in ignore_actions:
    return {'changed': False, 'action': 'added',
            'msg': "action ignored as specified by 'ignore_actions'"
                   "parameter"}
# I`ve made like this
doc = {}
doc.update(values)
glpi.add(itemtype, doc)
# the end
return {'changed': True, 'action': 'added'}
fmenabe commented 1 year ago

I've corrected the issue.

But, as stated in the module README, the module was quickly done and not well thought and has limitations. For example it will always indicate a change even if nothing has been updated.