Giter VIP home page Giter VIP logo

ansible-role-slapd's Introduction

CI

Ansible Role: slapd

RHEL/CentOS, Debian/Ubuntu サーバに slapd をインストールし、基本的な設定を行います。

この role では次のことを行います。

  • LDAP サーバのインストール
  • LDAP サーバの基本設定
  • BaseDN の設定
  • 管理者権限の設定
  • スキーマのインポート
  • モジュールのインポート

この role では次のことを行いません。

  • アカウントやグループなどのエントリ情報の登録

Requirements

この role には特別な要件はありません。

Role Variables

# Set this to the slapd global configurations.
slapd_loglevel: stats
# slapd_idletimeout: 86400
# slapd_sizelimit: 500
# slapd_referral: on

OpenLDAP Software 2.4 Administrator's Guide: Configuring slapd

# Users credential.
slapd_passwd_scheme: '{SSHA}'
ldap_root_passwd: "root_passwd"
ldap_admin: "cn=admin"
# Set this if different from the ldap_basedn.
# ldap_admin_base: "dc=example,dc=com"
ldap_admin_passwd: "admin_passwd"
# If you want to reduce the number of tasks
# that are "Changed", specify the hash
# that you generated beforehand using the following slappasswd command.
# $ slappasswd -h '{SSHA}'
# ldap_root_hashed_passwd: '{SSHA}WA/exo2HKC1H4EsOUxGbWU6mW0eT1A1K'
# ldap_admin_hashed_passwd: '{SSHA}a5gsMFahundHCuqNYeVrhX3QO6ZXCI+/'

slapd の管理権限を設定します。

# Select whether or not to install the schemas.
slapd_install_schema_cosine: true
slapd_install_schema_nis: true
slapd_install_schema_samba3: true
slapd_install_schema_misc: false
slapd_install_schema_ssh_lpk: false
slapd_install_schema_sudo: false

インストールするスキーマを指定します。

true に設定することでスキーマがインストールされます。 false に設定するとスキーマはインストールされません。

一度インストールしたスキーマは、 false に設定してもアンインストールされません。

slapd_schema_cosine_dn: null
slapd_schema_misc_dn: null
slapd_schema_nis_dn: null
slapd_schema_samba3_dn: null
slapd_schema_lpk_dn: null
slapd_schema_sudo_dn: null

インストールするスキーマの DN を指定します。

デフォルトでは自動的に適切な DN を選択します。 何らかの不都合がある場合にのみ指定してください。

# Select whether or not to install the modules.
slapd_install_module_refint: false
slapd_install_module_memberof: false
slapd_install_module_syncprov: false

インストールするモジュールを指定します。 RHEL/CentOS 7 ではタスクに失敗するのでこれらの変数を true に設定してはいけません。

true に設定することでモジュールがインストールされます。 false に設定するとモジュールはインストールされません。

一度インストールしたモジュールは、 false に設定してもアンインストールされません。

slapd_module_memberof_dn: null
slapd_overlay_memberof_dn: null
slapd_module_refint_dn: null
slapd_overlay_refint_dn: null
slapd_module_syncprov_dn: null
slapd_overlay_syncprov_config_dn: null
slapd_overlay_syncprov_dn: null

インストールするモジュールの DN を指定します。

デフォルトでは自動的に適切な DN を選択します。 何らかの不都合がある場合にのみ指定してください。

Replication

LDAP サーバのレプリケーションを設定します。 この role では N-Way Multi-Provider 方式のレプリケーションに対応しています。

slapd_replication: false

レプリケーションを設定する場合は slapd_replicationtrue を指定してください。 RHEL/CentOS 7 ではタスクに失敗するのでこの変数を true に設定してはいけません。

slapd_replication_group: 'slapd'

レプリケーションを実施するホストの Ansible Inventory のグループ名を指定してください。 この role は、ここで指定されたグループ内のホストでレプリケーションを構成します。

# slapd_replication_target_list:
#   - id: 1
#     url: "ldap://ldap01.example.com"
#   - id: 2
#     url: "ldap://ldap02.example.com"

レプリケーションを実施するホストをリストで指定します。 通常の場合は slapd_replication_group にて指定した Ansible Inventory のグループから自動的に定義されるので、指定する必要はありません。 接続先を Ansible に指定したホスト名ではなく、 IP で指定したい場合や、 Ansible 管轄外のホストとレプリケーションする場合などに指定が必要となるかもしれません。

id キーは rid として、 url キーは provider として指定されます。

Dependencies

None.

Example Playbook

- hosts: ldap-servers
  vars_files:
    - vars/main.yml
  roles:
    - slapd

Inside vars/main.yml :

ldap_basedn: dc=your,dc=domain,dc=example,dc=com
ldap_organization_name: Your Example Co., Ltd.

ldap_root_passwd: "root_passwd"
ldap_admin: "cn=Manager"
ldap_admin_passwd: "Manager_p@55w0rd"
ldap_base_head: your
ldap_domain: your.domain.example.com

これらの変数の値は ldap_basedn から自動的に計算されますが、別の値を利用したい場合は定義してください。

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

ansible-role-slapd's People

Contributors

ktooi avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

uprunning

ansible-role-slapd's Issues

config database の N-Way Multi-Provider を構成できない

下記でエラーになって config database の N-Way Multi-Provider を構成できない。

TASK [slapd : Ensure slapd of global config options included olcServerID] ***************************************************************************************************************************************************************************************************
changed: [ctrl01]
changed: [ctrl02]

TASK [slapd : Start up the provider and a consumer/s on the config database (1/2)] ******************************************************************************************************************************************************************************************
changed: [ctrl01]
changed: [ctrl02]

TASK [slapd : Start up the provider and a consumer/s on the config database (2/2)] ******************************************************************************************************************************************************************************************
fatal: [ctrl02]: FAILED! => {"changed": false, "details": "{'desc': 'Server is unwilling to perform', 'info': 'shadow context; no update referral'}", "msg": "Attribute action failed."}
fatal: [ctrl01]: FAILED! => {"changed": false, "details": "{'desc': 'Server is unwilling to perform', 'info': 'shadow context; no update referral'}", "msg": "Attribute action failed."}

Configure the database to under access control タスクで失敗する

RHEL 7/8/9 系のディストリビューションの場合、 Configure the database to under access control タスクで下記エラーが発生して失敗する。

  TASK [ktooi.slapd : Configure the database to under access control] ************
  fatal: [instance]: FAILED! => {"changed": false, "details": "{'msgtype': 103, 'msgid': 6, 'result': 80, 'desc': 'Other (e.g., implementation specific) error', 'ctrls': [], 'info': '<olcAccess> handler exited with 1'}", "msg": "Attribute action failed."}

暫定対処として、 RHEL 系ではこのタスクをスキップさせることで Playbook を完走できるようにする。

ubuntu2204 の idempotence で失敗する

ubuntu2204 の indempotence テストで下記のタスクに失敗する。

  TASK [ktooi.slapd : Start up the provider and a consumer/s on the backend (2/2)] ***
  fatal: [instance]: FAILED! => {"changed": false, "details": "{'desc': 'Type or value exists', 'info': 'modify/add: olcMultiProvider: value #0 already exists'}", "msg": "Attribute action failed."}

該当のタスクの内容は下記で、特に問題はないように見受けられる。

- name: Start up the provider and a consumer/s on the backend (2/2)
  become: true
  ldap_attrs:
    dn: '{{ slapd_olcDatabase_type_dn }}'
    attributes:
      olcMirrorMode: 'TRUE'
    state: exact
  tags:
    - slapd_replication

RHEL の場合、モジュールのインポートで失敗する

RHEL 系の場合、タスクでモジュールをインポートすることができない。

  TASK [ktooi.slapd : Ensure a module memberof.la was loaded] ********************
  An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ldap.OTHER: {'msgtype': 105, 'msgid': 3, 'result': 80, 'desc': 'Other (e.g., implementation specific) error', 'ctrls': [], 'info': '<olcModuleLoad> handler exited with 1'}
  fatal: [instance]: FAILED! => {"changed": false, "details": "{'msgtype': 105, 'msgid': 3, 'result': 80, 'desc': 'Other (e.g., implementation specific) error', 'ctrls': [], 'info': '<olcModuleLoad> handler exited with 1'}", "msg": "Entry action failed."}

暫定的にテスト時にはモジュールのインポートを行わないように設定する。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.