is not a valid attribute for a Play

I installed the collection theforeman.foreman and upgraded to ansible-galaxy 2.10 so the collection is listed when I query ansible-galaxy. But using the example code in Foreman :: Plugin documentation index I get the error
‘’ is not a valid attribute for a Play
What am I doing wrong?

It seems that you placed the module name outside of the task, check it with the code below (this is a task to create a user, different module, same principle):

- name: 'Example'
  hosts: 'foreman'
   - name: 'Create user for Ansible'
        username: 'admin'
        password: 'secretadminpassword'
        server_url: ''
        validate_certs: false
        name: ansible
        user_password: 'automation_rocks'
        auth_source: 'Internal'
        admin: false
        firstname: 'Ansible'
        lastname: 'Automation'
        mail: 'root@localhost'
        timezone: 'Amsterdam'
          - 'Viewer'
          - 'View hosts'
          - 'Default Organization'
          - 'Default Location'
        state: 'present'
1 Like


Could you post the whole playbook you’re using? I guess you have a syntax error somewhere around the tasks list.

The whole playbook should look something like this:

- hosts: localhost
1 Like

Thanks - I had an issue with the placement of the collection name.

1 Like