openldap for ubuntu

14 views
Skip to first unread message

Sandy Hung

unread,
Jan 20, 2020, 1:38:35 AM1/20/20
to Ansible Project
I have problem run openldap show error message, how to solved this problem thanks.

ERROR! conflicting action statements: copy, force

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

The offending line appears to be:


   - name: Copy file config.php
     ^ here




This is my ansible 

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

   tasks:
     - name: install openldap
       apt: name=slapd update_cache=yes

     - name: install openldap
       apt: name=ldap-utils update_cache=yes

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


     - name: check openldap is running
       service: name=slapd state=started

     - name: Enabling LDAPS
       shell: SLAPD_SERVICES="ldap://127.0.0.1:389/ ldaps:/// ldapi:///"

     - name: Set a password for the admin user
       ldap_passwd:
         dn: cn=admin,dc=abagile,dc=com
         passwd: "{{ vault_secret }}"

     - name: Setting passwords in admin
       ldap_passwd:
          dn: "{{ item.key }}"
          passwd: "{{ item.value }}"
       with_dict:
          alice: alice123123
          bob:   "|30b!"
          admin: "{{ vault_secret }}"

     - name: Testing the above LDAPS config
       shell: ldapsearch -d 9 -D "ou=users,dc=abagile,dc=com" \ -w password -b "dc=ababile,dc=com" -H "ldaps://ldaptest.abagile.com" "objectCllass=*"

Sandy Hung

unread,
Jan 20, 2020, 1:42:01 AM1/20/20
to Ansible Project
sorry error message is

fatal: [192.168.1.153]: FAILED! => {"msg": "The task includes an option with an undefined variable. The e'vault_secret' is undefined\n\nThe error appears to be in '/home/sandy/ldapinstall.yml': line 23, column \nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\name: Set a password for the admin user\n       ^ here\n"}
please help me thanks.

Sandy Hung於 2020年1月20日星期一 UTC+8下午2時38分35秒寫道:

Stefan Hornburg (Racke)

unread,
Jan 20, 2020, 1:48:19 AM1/20/20
to ansible...@googlegroups.com
On 1/20/20 7:42 AM, Sandy Hung wrote:
> sorry error message is
>
> fatal: [192.168.1.153]: FAILED! => {"msg": "The task includes an option with an undefined variable. The e'vault_secret'
> is undefined\n\nThe error appears to be in '/home/sandy/ldapinstall.yml': line 23, column \nbe elsewhere in the file
> depending on the exact syntax problem.\n\nThe offending line appears to be:\n\name: Set a password for the admin user\n 
>      ^ here\n"}
> please help me thanks.

You have to define the variable vault_secret.

Regards
Racke

>
> Sandy Hung於 2020年1月20日星期一 UTC+8下午2時38分35秒寫道:
>
> I have problem run openldap show error message, how to solved this problem thanks.
>
> ERROR! conflicting action statements: copy, force
>
> The error appears to be in '/home/sandy/phpldapadmin.yml': line 68, column 6, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
>
>    - name: Copy file config.php
>      ^ here
>
>
>
>
> This is my ansible 
>
> ---
>  - hosts: all
>    remote_user: sandy
>    become: true
>
>    tasks:
>      - name: install openldap
>        apt: name=slapd update_cache=yes
>
>      - name: install openldap
>        apt: name=ldap-utils update_cache=yes
>
>      - name: install phpldapadmin
>        apt: name=phpldapadmin update_cache=yes
>
>
>      - name: check openldap is running
>        service: name=slapd state=started
>
>      - name: Enabling LDAPS
>        shell: SLAPD_SERVICES="ldap://127.0.0.1:389/ <http://127.0.0.1:389/> ldaps:/// ldapi:///"
>
>      - name: Set a password for the admin user
>        ldap_passwd:
>          dn: cn=admin,dc=abagile,dc=com
>          passwd: "{{ vault_secret }}"
>
>      - name: Setting passwords in admin
>        ldap_passwd:
>           dn: "{{ item.key }}"
>           passwd: "{{ item.value }}"
>        with_dict:
>           alice: alice123123
>           bob:   "|30b!"
>           admin: "{{ vault_secret }}"
>
>      - name: Testing the above LDAPS config
>        shell: ldapsearch -d 9 -D "ou=users,dc=abagile,dc=com" \ -w password -b "dc=ababile,dc=com" -H
> "ldaps://ldaptest.abagile.com <http://ldaptest.abagile.com>" "objectCllass=*"
>
> --
> 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/b7ed4353-ff1c-4f52-b475-c3f8782f4e5c%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/b7ed4353-ff1c-4f52-b475-c3f8782f4e5c%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 20, 2020, 1:58:20 AM1/20/20
to Ansible Project
How to define  the variable vault_secret?
thanks.


Sandy Hung於 2020年1月20日星期一 UTC+8下午2時38分35秒寫道:
I have problem run openldap show error message, how to solved this problem thanks.

Stefan Hornburg (Racke)

unread,
Jan 20, 2020, 2:08:54 AM1/20/20
to ansible...@googlegroups.com
On 1/20/20 7:58 AM, Sandy Hung wrote:
> How to define  the variable vault_secret?
> thanks.

Well you should know what the value of this variable is ...

There are many places where you can define variables:

https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html

Regards
Racke

>
>
> Sandy Hung於 2020年1月20日星期一 UTC+8下午2時38分35秒寫道:
>
> I have problem run openldap show error message, how to solved this problem thanks.
>
> ERROR! conflicting action statements: copy, force
>
> The error appears to be in '/home/sandy/phpldapadmin.yml': line 68, column 6, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
>
>    - name: Copy file config.php
>      ^ here
>
>
>
>
> This is my ansible 
>
> ---
>  - hosts: all
>    remote_user: sandy
>    become: true
>
>    tasks:
>      - name: install openldap
>        apt: name=slapd update_cache=yes
>
>      - name: install openldap
>        apt: name=ldap-utils update_cache=yes
>
>      - name: install phpldapadmin
>        apt: name=phpldapadmin update_cache=yes
>
>
>      - name: check openldap is running
>        service: name=slapd state=started
>
>      - name: Enabling LDAPS
>        shell: SLAPD_SERVICES="ldap://127.0.0.1:389/ <http://127.0.0.1:389/> ldaps:/// ldapi:///"
>
>      - name: Set a password for the admin user
>        ldap_passwd:
>          dn: cn=admin,dc=abagile,dc=com
>          passwd: "{{ vault_secret }}"
>
>      - name: Setting passwords in admin
>        ldap_passwd:
>           dn: "{{ item.key }}"
>           passwd: "{{ item.value }}"
>        with_dict:
>           alice: alice123123
>           bob:   "|30b!"
>           admin: "{{ vault_secret }}"
>
>      - name: Testing the above LDAPS config
>        shell: ldapsearch -d 9 -D "ou=users,dc=abagile,dc=com" \ -w password -b "dc=ababile,dc=com" -H
> "ldaps://ldaptest.abagile.com <http://ldaptest.abagile.com>" "objectCllass=*"
>
> --
> 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/09858b91-a31e-414e-91d3-59555df8be54%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/09858b91-a31e-414e-91d3-59555df8be54%40googlegroups.com?utm_medium=email&utm_source=footer>.
signature.asc

Sandy Hung

unread,
Jan 20, 2020, 2:23:34 AM1/20/20
to Ansible Project
yes,but learning ansible only 2 week so, I don;t how to define variables.

 
Stefan Hornburg (Racke)於 2020年1月20日星期一 UTC+8下午3時08分54秒寫道:

Mark Anthony Garcia

unread,
Jan 20, 2020, 2:32:58 AM1/20/20
to ansible...@googlegroups.com
You can read this documentation on ansible.


Regards,
Mark Garcia 

> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/09858b91-a31e-414e-91d3-59555df8be54%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/09858b91-a31e-414e-91d3-59555df8be54%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.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9dc79194-9e1d-4e2e-8022-79889a77874a%40googlegroups.com.

Sandy Hung

unread,
Jan 20, 2020, 5:05:23 AM1/20/20
to Ansible Project




Dear All:

andyidea can help me thanks.




PLAY [all] ************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************
ok: [192.168.1.153]

TASK [install openldap] ***********************************************************************************************
ok: [192.168.1.153]

TASK [install openldap] ***********************************************************************************************
ok: [192.168.1.153]

TASK [install phpldapadmin] *******************************************************************************************
ok: [192.168.1.153]

TASK [check openldap is running] **************************************************************************************
ok: [192.168.1.153]

TASK [Enabling LDAPS] *************************************************************************************************
changed: [192.168.1.153]

TASK [Testing the above LDAPS config] *********************************************************************************
fatal: [192.168.1.153]: FAILED! => {"changed": true, "cmd": "ldapsearch -d 9 -D \"cn=test,cn=user,dc=abagile,dc=com\" -w password -b \"dc=ababile,dc=com\" -H \"ldaps://ldaptest.abagile.com\" \"objectCllass=*\"", "delta": "0:00:00.006822", "end": "2020-01-20 18:01:46.447142", "msg": "non-zero return code", "rc": 255, "start": "2020-01-20 18:01:46.440320", "stderr": "ldap_url_parse_ext(ldaps://ldaptest.abagile.com)\nldap_create\nldap_url_parse_ext(ldaps://ldaptest.abagile.com:636/??base)\nldap_sasl_bind\nldap_send_initial_request\nldap_new_connection 1 1 0\nldap_int_open_connection\nldap_connect_to_host: TCP ldaptest.abagile.com:636\nldap_new_socket: 3\nldap_prepare_socket: 3\nldap_connect_to_host: Trying 192.168.1.153:636\nldap_pvt_connect: fd: 3 tm: -1 async: 0\nattempting to connect: \nconnect errno: 111\nldap_close_socket: 3\nldap_err2string\nldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)", "stderr_lines": ["ldap_url_parse_ext(ldaps://ldaptest.abagile.com)", "ldap_create", "ldap_url_parse_ext(ldaps://ldaptest.abagile.com:636/??base)", "ldap_sasl_bind", "ldap_send_initial_request", "ldap_new_connection 1 1 0", "ldap_int_open_connection", "ldap_connect_to_host: TCP ldaptest.abagile.com:636", "ldap_new_socket: 3", "ldap_prepare_socket: 3", "ldap_connect_to_host: Trying 192.168.1.153:636", "ldap_pvt_connect: fd: 3 tm: -1 async: 0", "attempting to connect: ", "connect errno: 111", "ldap_close_socket: 3", "ldap_err2string", "ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)"], "stdout": "", "stdout_lines": []}



PLAY RECAP ************************************************************************************************************
192.168.1.153              : ok=6    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0




Sandy Hung於 2020年1月20日星期一 UTC+8下午2時38分35秒寫道:
Reply all
Reply to author
Forward
0 new messages