moodle.ymlΒΆ

---
# Moodle custom-attribute LDAP schema. Three attributes that have
# no equivalent in core inetOrgPerson: phonetic given/family name
# and IANA timezone name.

- name: βœ… Ensure custom LDAP schema snippet via ldapsm (moodle)
  vars:
    schema_name: "moodle"
    attribute_defs:
      - "( 1.3.6.1.4.1.99999.10 NAME 'infinitoNamePhoneticGiven' DESC 'Phonetic given name (Moodle field firstnamephonetic)' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )"
      - "( 1.3.6.1.4.1.99999.11 NAME 'infinitoNamePhoneticFamily' DESC 'Phonetic family name (Moodle field lastnamephonetic)' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )"
      - "( 1.3.6.1.4.1.99999.12 NAME 'infinitoTimezone' DESC 'IANA timezone name (Moodle field timezone)' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
        SINGLE-VALUE )"
    objectclass_defs:
      - "( 1.3.6.1.4.1.99999.13 NAME 'infinitoMoodleUser' DESC 'Auxiliary class for Moodle-only user attributes' AUXILIARY MAY ( infinitoNamePhoneticGiven $ infinitoNamePhoneticFamily
        $ infinitoTimezone ) )"
  command:
    cmd: >
      {{ OPENLDAP_LDAPSM_COMMAND }}
        -s {{ OPENLDAP_SERVER_URI }}
        -D '{{ OPENLDAP_BIND_DN }}'
        -n {{ schema_name }}
        {% for at in attribute_defs %}
        -a "{{ at }}"
        {% endfor %}
        {% for oc in objectclass_defs %}
        -c "{{ oc }}"
        {% endfor %}
    stdin: "{{ OPENLDAP_BIND_PW }}"
  register: ldapsm_moodle_result
  changed_when: "'Created schema entry' in ldapsm_moodle_result.stdout"
  check_mode: false

- name: πŸ‘οΈ Show ldapsm output (moodle)
  debug:
    var: ldapsm_moodle_result.stdout_lines