Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Inventory Plugin for ServiceNow cmdb no longer working with servicenow.itsm version 2.5.0 #361

Closed
shrutebattlestargalactica opened this issue May 22, 2024 · 4 comments

Comments

@shrutebattlestargalactica
Copy link

shrutebattlestargalactica commented May 22, 2024

SUMMARY

After upgrading to latest AMI and EKS 1.29 and EBS add on v1.30.0-eksbuild.1 we can no longer sync any of our ServiceNow dynamic inventory sources with servicenow.itsm version 2.5.0

WORKAROUND: explicitly define the servicenow.itsm version from the collections>requirements file to 2.4.0*

ISSUE TYPE
  • Bug Report
COMPONENT NAME

servicenow.itsm.now inventory plugin

ANSIBLE VERSION
Running in AWX version 24.3.1
COLLECTION VERSION
2.4.0
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT

AWS EKS, kubernetes version 1.29, eks.6 platform version running AWX through the awx-operator

STEPS TO REPRODUCE

Run an inventory sync

### now.yml dynamic inventory ###
plugin: servicenow.itsm.now
table: cmdb_ci_server
columns:
  - name
  - operational_status
  - u_patch_cycle
  - fqdn
  - os
  - os_version
  - ip_address
  - managed_by
  - sys_class_name
  - environment

compose:
  ansible_host: fqdn

#filters
query:
  - managed_by_group: LIKE SOMEVALUEHERE
    sys_class_name: = cmdb_ci_win_server
    operational_status: = 1
    os: NOT LIKE 2003
  - managed_by_group: LIKE SOMEVALUEHERE
    sys_class_name: = cmdb_ci_linux_server
    operational_status: = 1
  - managed_by_group: LIKE SOMEVALUEHERE
    sys_class_name: = cmdb_ci_aix_server
    operational_status: = 1
    
#server groups
keyed_groups:
  - key: u_patch_cycle | lower
    prefix: "os_patch_cycle"
  - key: sys_class_name | lower
    prefix: "class"
EXPECTED RESULTS

Inventory sync completes successfully

ACTUAL RESULTS

Inventory doesnt get parsed

ansible-inventory [core 2.12.5.post0]
  config file = /runner/project/ansible.cfg
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections:/usr/share/automation-controller/collections
  executable location = /usr/local/bin/ansible-inventory
  python version = 3.8.13 (default, Jun 24 2022, 15:27:57) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
  jinja version = 2.11.3
  libyaml = True
Using /runner/project/ansible.cfg as config file
ansible_collections.nutanix.ncp.plugins.inventory.ntnx_prism_vm_inventory declined parsing /runner/project/inventory/myinventorysource_now.yml as it did not pass its verify_file() method
host_list declined parsing /runner/project/inventory/myinventorysource_now.yml as it did not pass its verify_file() method
script declined parsing /runner/project/inventory/myinventorysource_now.yml as it did not pass its verify_file() method
toml declined parsing /runner/project/inventory/myinventorysource_now.yml as it did not pass its verify_file() method
[WARNING]:  * Failed to parse
/runner/project/inventory/myinventorysource_now.yml with
ansible_collections.servicenow.itsm.plugins.inventory.now plugin: sequence item
3: expected str instance, AnsibleSequence found
  File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/runner/requirements_collections/ansible_collections/servicenow/itsm/plugins/inventory/now.py", line 529, in parse
    cache_sub_key = "/".join(
[WARNING]:  * Failed to parse
/runner/project/inventory/myinventorysource_now.yml with auto plugin: sequence
item 3: expected str instance, AnsibleSequence found
  File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/local/lib/python3.8/site-packages/ansible/plugins/inventory/auto.py", line 58, in parse
    plugin.parse(inventory, loader, path, cache=cache)
  File "/runner/requirements_collections/ansible_collections/servicenow/itsm/plugins/inventory/now.py", line 529, in parse
    cache_sub_key = "/".join(
[WARNING]:  * Failed to parse
/runner/project/inventory/myinventorysource_now.yml with yaml plugin: Plugin
configuration YAML file, not YAML inventory
  File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/local/lib/python3.8/site-packages/ansible/plugins/inventory/yaml.py", line 112, in parse
    raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]:  * Failed to parse
/runner/project/inventory/myinventorysource_now.yml with ini plugin: Invalid
host pattern 'plugin:' supplied, ending in ':' is not allowed, this character
is reserved to provide a port.
  File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/local/lib/python3.8/site-packages/ansible/plugins/inventory/ini.py", line 136, in parse
    raise AnsibleParserError(e)
[WARNING]: Unable to parse /runner/project/inventory/myinventorysource_now.yml
as an inventory source
ERROR! No inventory was parsed, please check your configuration and options.

@shrutebattlestargalactica
Copy link
Author

shrutebattlestargalactica commented May 22, 2024

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx-prod
  namespace: awx
spec:
  image_pull_policy: Always
  service_type: nodeport
  ingress_type: none
  service_labels: |
    environment: myenvironment
    team: myteamname
  hostname: awx.mydomain.com
  postgres_configuration_secret: mysupersecretkey
  secret_key_secret: mysupersecretkey
  web_resource_requirements: {}
  task_resource_requirements: {}
  ee_resource_requirements: {}

@shrutebattlestargalactica shrutebattlestargalactica changed the title Dynamic Inventory Plugin for ServiceNow cmdb no longer working with AWX 24.3.1 Dynamic Inventory Plugin for ServiceNow cmdb no longer working with servicenow.itsm version 2.4.0 May 22, 2024
@shrutebattlestargalactica shrutebattlestargalactica changed the title Dynamic Inventory Plugin for ServiceNow cmdb no longer working with servicenow.itsm version 2.4.0 Dynamic Inventory Plugin for ServiceNow cmdb no longer working with servicenow.itsm version 2.5.0 May 22, 2024
@tupyy
Copy link
Contributor

tupyy commented May 22, 2024

Fixed in #360

@shrutebattlestargalactica
Copy link
Author

Fixed in #360

Thanks!

@tupyy
Copy link
Contributor

tupyy commented May 22, 2024

@shrutebattlestargalactica I'm closing this issue. Please reopen if you have any problem with the module.
Thank you!

@tupyy tupyy closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants