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)