ansible error message

19 views
Skip to first unread message

Sandy Hung

unread,
Jan 21, 2020, 4:09:16 AM1/21/20
to Ansible Project
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

Stefan Hornburg (Racke)

unread,
Jan 21, 2020, 4:24:29 AM1/21/20
to ansible...@googlegroups.com
Please show your complete playbook, especially the part where "roles" appears.

Regards
Racke

>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/2b8e28c9-bd13-44eb-83a2-f55b27aeb97c%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/2b8e28c9-bd13-44eb-83a2-f55b27aeb97c%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

Sandy Hung

unread,
Jan 21, 2020, 4:34:34 AM1/21/20
to Ansible Project
---
- 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: xx...@xxxx.com
       certbot_certificate_domains:
         - xxxxx.com

     roles:
         - {role: certbot-apache, become: yes }
         - role: letsencrypt
           letsencrypt_webroot_pah: /var/www/html
           letsencrypt_email: xx...@xxxx.com
           letsencrypt_cert_domains:
            - ldaptest.xxx.com
            - xxx.com
           letsencrypt_renewal_command_args: '--renew-hook "systemctl restart apache"'

   - name: Allow everything and enable UFW
     ufw:
      state: enabled
     policy: allow

Stefan Hornburg (Racke)

unread,
Jan 21, 2020, 4:52:30 AM1/21/20
to ansible...@googlegroups.com
Use include_role or import_role.

Regards
Racke
> > ansible...@googlegroups.com <javascript:> <mailto:ansible-proje...@googlegroups.com <javascript:>>.
> <https://groups.google.com/d/msgid/ansible-project/2b8e28c9-bd13-44eb-83a2-f55b27aeb97c%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/2b8e28c9-bd13-44eb-83a2-f55b27aeb97c%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/58a13ddb-153c-4040-99a4-9c44e6a31163%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/58a13ddb-153c-4040-99a4-9c44e6a31163%40googlegroups.com?utm_medium=email&utm_source=footer>.
signature.asc

Vladimir Botka

unread,
Jan 21, 2020, 5:09:12 AM1/21/20
to Sandy Hung, ansible...@googlegroups.com
On Tue, 21 Jan 2020 01:34:34 -0800 (PST)
Sandy Hung <sandy...@abagile.com> wrote:

> ---
> - hosts: all
> remote_user: sandy
> become: true
>
> tasks:
>
> - name: install phpldapadmin
> apt: name=phpldapadmin update_cache=yes
> [...]
>
> vars:
> certbot_generate_certificates: true
> certbot_register_email: xx...@xxxx.com
> certbot_certificate_domains:
> - xxxxx.com
>
> roles:
> - {role: certbot-apache, become: yes }
> [...]
>
> - name: Allow everything and enable UFW
> ufw:
> state: enabled
> policy: allow

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
Reply all
Reply to author
Forward
0 new messages