ansible playbook error

ERROR! unexpected parameter type in action: <class ‘ansible.parsing.yaml.objects.AnsibleSequence’>

The error appears to be in ‘/home/sandy/phpldapadmin.yml’: line 8, column 6, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  • name: install phpopenldap
    ^ here

sandy@test-VirtualBox:~$ sudo vi phpldapadmin.yml

  • hosts: all
    remote_user: sandy
    become: true

tasks:

  • name: install phpopenldap
    apt:
    name: ‘{{item.name}}’
    state: ‘{{item.state | default(“present”)}}’
    purge: yes
    with_items:

  • name: phpldapadmin

  • name: php

  • name: libapache2-mod-php

  • name: mcrypt

  • name: php-mysql

- name: Force certbot to use Python 3

lineinfile:

path: ‘{{ item }}’

regexp: ‘^#!/usr/bin/python$’

line: ‘#!/usr/bin/python3’

with_items:

- /usr/bin/certbot

ignore_errors: yes

failed_when: no

- name: stat phpldapadmin

stat: path=/var/www/html/

register: phpldapadmin_stat

Hi Sandy,

The issue is with indentation
Under tasks you have to give two white space to make it indent

Try following

tasks:

  • name: something

Let me know if you have any issue.

Thanks,
Vivek