Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atterdag/ansible-filters-ldif
Ansible filter to read or write LDIF
https://github.com/atterdag/ansible-filters-ldif
ansible ansible-modules ldif pypi pypi-package python
Last synced: about 1 month ago
JSON representation
Ansible filter to read or write LDIF
- Host: GitHub
- URL: https://github.com/atterdag/ansible-filters-ldif
- Owner: atterdag
- License: gpl-3.0
- Created: 2019-11-14T16:17:02.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-27T15:40:45.000Z (over 1 year ago)
- Last Synced: 2024-09-30T01:42:20.203Z (about 2 months ago)
- Topics: ansible, ansible-modules, ldif, pypi, pypi-package, python
- Language: Python
- Homepage: https://pypi.org/project/ansible-filters-ldif/
- Size: 52.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
Ansible LDIF filter
===================Ansible filter to read or write LDIF.
.. image:: https://img.shields.io/pypi/v/ansible-filters-ldif.svg
:alt: Latest version
:target: https://pypi.python.org/pypi/ansible-filters-ldif/
.. image:: https://sonarcloud.io/api/project_badges/measure?project=atterdag_ansible-filters-ldif&metric=alert_status
:alt: SonarCloud
:target: https://sonarcloud.io/summary/new_code?id=atterdag_ansible-filters-ldif
.. image:: https://app.travis-ci.com/atterdag/ansible-filters-ldif.svg?branch=master
:alt: Travis CI
:target: https://app.travis-ci.com/atterdag/ansible-filters-ldif
.. image:: https://img.shields.io/badge/License-GPLv3-yellow.svg
:alt: License: GPLv3
:target: https://opensource.org/licenses/GPL-3.0Install this Ansible Filter:
* via ``pip``:
::
pip install ansible-filters-ldif
* via ``ansible-galaxy``:
::
ansible-galaxy install 'git+https://github.com/atterdag/ansible-filters-ldif.git'
..
Ansible filters always runs on localhost.
Examples
--------Convert dictionary to LDIF
.. code:: yaml
---
- name: Create dictionary with entries
set_fact:
dictionary:
- - dc=example,dc=com
- dc:
- example
description:
- This is a line longer than 79 characters, so LDIF breaks it up over multiple lines
o:
- example.com
objectClass:
- dcObject
- organization
- - ou=people,dc=example,dc=com
- objectClass:
- organizationalUnit
ou:
- people
- - cn=Jane Doe,ou=people,dc=example,dc=com
- cn:
- Jane Doe
mail:
- [email protected]
objectClass:
- inetOrgPerson
sn:
- Doe
- - cn=John Doe,ou=people,dc=example,dc=com
- cn:
- John Doe
mail:
- [email protected]
objectClass:
- inetOrgPerson
sn:
- Doe
- - ou=groups,dc=example,dc=com
- objectClass:
- organizationalUnit
ou:
- groups
- - cn=users,ou=groups,dc=example,dc=com
- cn:
- users
member:
- cn=Jane Doe,ou=people,dc=example,dc=com
- cn=John Doe,ou=people,dc=example,dc=com
objectClass:
- groupOfNames- name: "Convert dictionary to LDIF while writing it to /tmp/test.ldif using 'to_ldif' filter"
copy:
content: "{{ dictionary | to_ldif }}"
dest: "/tmp/test.ldif"Convert LDIF to JSON
.. code:: yaml
---
- name: "Create multi-line string variable with LDIF data"
set_fact:
ldif: |
dn: dc=example,dc=com
dc: example
description: This is one line which is longer than
79 characters, so LDIF breaks it up over multiple lines
objectClass: dcObject
objectClass: organization
o: example.comdn: ou=people,dc=example,dc=com
objectClass: organizationalUnit
ou: peopledn: cn=Jane Doe,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
cn: Jane Doe
sn: Doe
mail: [email protected]dn: cn=John Doe,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
cn: John Doe
sn: Doe
mail: [email protected]dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groupsdn: cn=users,ou=groups,dc=example,dc=com
objectClass: groupOfNames
cn: users
member: cn=Jane Doe,ou=people,dc=example,dc=com
member: cn=John Doe,ou=people,dc=example,dc=com- name: "Convert string to JSON while writing it to /tmp/test.json using 'from_ldif' filter"
copy:
content: "{{ (ldif | from_ldif) | to_nice_json }}"
dest: "/tmp/test.json"Build dependencies
------------------Install the following OS development packages first.
::
sudo apt-get install libssl-dev libldap2-dev libsasl2-dev python2-dev python3-dev
mkvirtualenv --python=/usr/bin/python3 python3-development
pip install --requirement requirements.txt
gem install travis fryLicense
-------`GPLv3 `_.