LoginSignup
2
2

More than 5 years have passed since last update.

itamae|Centos7で、ミラーリングしたldapサーバーを構築するレシピ

Last updated at Posted at 2016-08-30

概要

CentOS7のサーバにミラーリングしたldapサーバーを構築するレシピ

構築ネットワーク

▪️ 192.168.56.101
centos7-admin(管理サーバー)
ldapサーバーとitamae実行サーバーを兼ねる構築済みが前提
 本稿でミラーリングの設定を追加する

▪️ 192.168.56.104
centos7-adm2(管理サーバーのバックアップサーバー)
ldapサーバー構築済みが前提
 本稿でミラーリングの設定を追加する

▪️ 192.168.56.201 centos7−ldap(ldap用VIP)
管理サーバーの冗長運用時のVIP

前準備

Centos7でldapサーバーを構築するレシピで構築した、サーバーを2台準備する

本編

(※ パスワードやドメインなどは目的に応じて変更すること)
本編構築はこちらのサイトを参照した。

構築の概要としては

  • syncprovモジュールのロード設定追加 (レプリケーションならプロバイダ側、ミラーなので両側に設定する)
  • データベースの設定エントリの配下にプロバイダ設定用のエントリを追加 (レプリケーションならプロバイダ側、ミラーなので両側に設定する)
  • お互いのldapサーバーにミラーリングの設定を追加する

となり、その構築手順をitamaeのレシピに起こした


ldap_mirror.rb
# File copy
[
    "syncprov-module.ldif",
    "syncprov.ldif",
    "#{node[:name]}.ldif",
].each {| tmp |
    template "/etc/openldap/ldif_files/#{tmp}" do
        action :create
        owner  "root"
        group  "root"
        mode   "644"
        source "files/ldap-server/mirror/#{tmp}"
    end 
}

# ldapadd
[
    "syncprov-module.ldif",
    "syncprov.ldif",
].each {| file |
    execute "#{file}" do
        action  :run
        command "/bin/ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/ldif_files/#{file}"
    end
}

# ldapmodify
execute "#{node[:name]}" do
    action  :run
    command "/bin/ldapmodify -Y EXTERNAL -H ldapi:// -f /etc/openldap/ldif_files/#{node[:name]}.ldif"
end

(管理サーバーでitamaeを実行する)
▪️ 192.168.56.101側にレシピ実行
itamae local --node-json files/ldap-server/mirror/mirror1.json ldap_mirror.rb

▪️ 192.168.56.104側にレシピ実行
itamae ssh -u xxx -h 192.168.56.104 -i id_rsa_xxx --node-json files/ldap-server/mirror/mirror2.json ldap_mirror.rb

本稿使用した、レシピとその他必要なファイル類はgithubに上げてある

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2