pip3 list | grep -E "ansible|ldap" ansible 8.0.0 ansible-core 2.15.0 python-ldap 3.4.4
ldap_users: - cn: user01 dn: cn=user01,ou=users,dc=example,dc=com sshPublicKey: - ssh-ed25519 ... - ssh-rsa ... description: - dev - stg - prod
description: dev description: stg description: prod
古いので公式の "community.general.ldap*" を使ったほうが良い。
- name: ldapPublicKey ldap_entry: server_uri: "{{ uri }}" bind_dn: "{{ binddn }}" bind_pw: "{{ bindpw }}" dn: "{{ item.dn }}" state: present objectClass: ldapPublicKey sshPublicKey: "{{ item.sshPublicKey }}" with_items: "{{ ldap_users }}" - name: override description exactly ldap_attr: server_uri: "{{ uri }}" bind_dn: "{{ binddn }}" bind_pw: "{{ bindpw }}" dn: "{{ item.dn }}" name: description state: exact values: "{{ item.description }}" with_items: "{{ ldap_users }}"
sudo apt install libsasl2-dev python-dev libldap2-dev libssl-dev
sudo yum install python-devel openldap-devel
pip install python-ldap