Invisible Ansible Collection

Hi. New to Ansible, and especially the collections. I installed a collection as ansible_admin on a LINUX server, but then when I try to run it I get: “ERROR! ‘servicenow.itsm.change_request’ is not a valid attribute for a Play”. Full log of install and the YML playbook attached. Please help to run this playbook..

+++++++++++OS CHECKS++++++++++++++++++++++++++++++++++++++
[ansible_admin@ctrl ~]$ ansible-galaxy collection install servicenow.itsm --force
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/servicenow-itsm-2.8.0.tar.gz to /home/ansible_admin/.ansible/tmp/ansible-local-697509tnc1jhu/tmp2z5pk9vv/servicenow-itsm-2.8.0-tjnbllot
Installing 'servicenow.itsm:2.8.0' to '/home/ansible_admin/.ansible/collections/ansible_collections/servicenow/itsm'
servicenow.itsm:2.8.0 was installed successfully
[ansible_admin@ctrl ~]$  ansible-galaxy collection verify servicenow.itsm
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/servicenow-itsm-2.8.0.tar.gz to /home/ansible_admin/.ansible/tmp/ansible-local-69758mb0348sr/tmpdfe6l2iw/servicenow-itsm-2.8.0-p4e1pw_o
Verifying 'servicenow.itsm:2.8.0'.
Installed collection found at '/home/ansible_admin/.ansible/collections/ansible_collections/servicenow/itsm'
MANIFEST.json hash: a46e1a7295dd9557bac4b3fbe3278c3ece58fb26700ffc91618d0496655e0f43
Successfully verified that checksums for 'servicenow.itsm:2.8.0' match the remote collection.
[ansible_admin@ctrl ~]$  ansible-galaxy collection list
# /home/ansible_admin/.ansible/collections/ansible_collections
Collection      Version
--------------- -------
servicenow.itsm 2.8.0
# /usr/share/ansible/collections/ansible_collections
Collection               Version
------------------------ -------
redhat.rhel_system_roles 1.88.9
[ansible_admin@ctrl ~]$

+++++++++++++ANSIBLE servicenow.itsm.change_request PLAYBOOK++++++++++++++++++++++++++++++++
---
- name: Create change request | login
  servicenow.itsm.change_request:
    instance:
      host: https://dev336605.service-now.com
      username: aes.creator
      password: password
    type: standard
    state: new
    requested_by: some.user
    short_description: Install new Cisco Super Duper Shmooper
    description: Please install new Cat. 6500 in Data center 01
    attachments:
      - path: path/to/attachment.txt
    priority: moderate
    risk: low
    impact: low
    other:
      expected_start: 2021-02-12

- name: Change state of the change request
  servicenow.itsm.change_request:
    instance:
      host: https://dev336605.service-now.com
      username: aes.creator
      password: password

    state: assess
    assignment_group: some.group
    number: CHG0000001

- name: Close change_request
  servicenow.itsm.change_request:
    instance:
      host: https://dev336605.service-now.com
      username: aes.creator
      password: password

    state: closed
    close_code: "successful"
    close_notes: "Closed"
    assignment_group: some.group
    number: CHG0000001

- name: Delete change_request
  servicenow.itsm.change_request:
    instance:
      host: https://dev336605.service-now.com
      username: aes.creator
      password: password

    state: absent
    number: CHG0000001

+++++ERROR+++++++++++++++++++++++++++++++++

[ansible_admin@ctrl ansible]$ ansible-playbook ./playbooks/service_now_create_ticket.yml -v 
Using /etc/ansible/ansible.cfg as config file
ERROR! 'servicenow.itsm.change_request' is not a valid attribute for a Play
The error appears to be in '/etc/ansible/playbooks/service_now_create_ticket.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: Create change request | login
  ^ here
[ansible_admin@ctrl ansible]$
  • Set at least one tag (the experts follow the tags, so the right people will find you if you tag)

The part you show that is the playbook is not a valid playbook. That is a list of tasks like what is found in a role. Have a read of these docs. You’ll need to start your playbook off with some kind of hosts targeting pattern (hosts: all) and a tasks key. The bits you already have follow the tasks key.

1 Like

Thank you Tim. You were right. As soon as made the change it failed, but for another reason which means it has gone past my issue which you resolved. Thx.
+++++++++++++++++++
[ansible_admin@ctrl ansible]$ ansible-playbook ./playbooks/service_now_create_ticket.yml -v
Using /etc/ansible/ansible.cfg as config file
[WARNING]: Collection servicenow.itsm does not support Ansible version 2.14.17

PLAY [Sample playbook] ***********************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [Create a new incident] *****************************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Unsupported parameters for (servicenow.itsm.incident) module: instance.caller, instance.impact, instance.short_description, instance.urgency. Supported parameters include: access_token, api_path, client_id, client_secret, custom_headers, grant_type, host, password, refresh_token, timeout, username, validate_certs.”}

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
[ansible_admin@ctrl ansible]$