ansible error message

Dear All:

I don’t know this error is?
can hlep me thanks.

ERROR! conflicting action statements: lineinfile, roles

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

The offending line appears to be:

  • name: Force certbot to use Python3
    ^ here

  • name: Force certbot to use Python3
    lineinfile:
    path: ‘{{ item }}’
    regexp: ‘^#!/usr/bin/python$’
    line: ‘#!/usr/bin/python3’
    with_items:

  • /usr/local/bin/certbot

  • /user/bin/certbot
    ignore_errors: yes
    failed_when: no

Dear All:

I don't know this error is?
can hlep me thanks.

ERROR! conflicting action statements: lineinfile, roles

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

The offending line appears to be:

- name: Force certbot to use Python3
^ here

- name: Force certbot to use Python3
lineinfile:
path: '{{ item }}'
regexp: '^#!/usr/bin/python$'
line: '#!/usr/bin/python3'
with_items:
- /usr/local/bin/certbot
- /user/bin/certbot
ignore_errors: yes
failed_when: no

Please show your complete playbook, especially the part where "roles" appears.

Regards
          Racke

---
- hosts: all
remote_user: sandy
become: true

tasks:

- name: install phpldapadmin
apt: name=phpldapadmin update_cache=yes

- name: install phpopenldap
apt:
name: '{{item.name}}'
state: '{{item.state | default("present")}}'
purge: yes
with_items:

  \- 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/local/bin/certbot
- /usr/bin/certbot
ignore_errors: yes
failed_when: no

- name: stat phpldapadmin
stat: path=/var/www/html/
register: phpldapadmin_stat

- name: Move phpldapadmin
shell: mv /var/www/html/ /var/www/html/
when: phpldapadmin_stat.stat.exists

 vars:
   certbot\_generate\_certificates: true
   certbot\_register\_email: xxxx@xxxx\.com
   certbot\_certificate\_domains:
     \- xxxxx\.com

 roles:
     \- \{role: certbot\-apache, become: yes \}
     \- role: letsencrypt
       letsencrypt\_webroot\_pah: /var/www/html
       letsencrypt\_email: xxxx@xxxx\.com
       letsencrypt\_cert\_domains:
        \- ldaptest\.xxx\.com
        \- xxx\.com
       letsencrypt\_renewal\_command\_args: '\-\-renew\-hook "systemctl restart apache"'

Use include_role or import_role.

Regards
           Racke

Syntax is wrong. Indentation and placement of 'vars' and 'roles' is wrong.
See "Working With Playbooks"
https://docs.ansible.com/ansible/latest/user_guide/playbooks.html#working-with-playbooks

  -vlado