Grid環境構築用のChefリポジトリです。
Revision | c3bf4f785bd57e2a41f83bc49fe23d8432aed498 (tree) |
---|---|
Time | 2017-01-01 13:20:07 |
Author | whitestar <whitestar@gaea...> |
Commiter | whitestar |
adds Samba schema setup feature.
@@ -1,5 +1,9 @@ | ||
1 | 1 | # CHANGELOG for openldap-grid |
2 | 2 | |
3 | +0.2.3 | |
4 | +----- | |
5 | +- adds Samba schema setup feature. | |
6 | + | |
3 | 7 | 0.2.2 |
4 | 8 | ----- |
5 | 9 | - refactoring. |
@@ -31,9 +31,12 @@ Attributes | ||
31 | 31 | |`['openldap']['nss-ldapd']['base']`|String||`dc=example,dc=net`| |
32 | 32 | |`['openldap']['nss-ldapd']['<nscd.conf key>']`|String|other nscd.conf key|| |
33 | 33 | |`['openldap']['ldap_lookup_nameservices']`|Array|['passwd', 'group']|`empty`| |
34 | +|`['openldap']['server']['extra_schema']['samba']`|Boolean|add the schema for Samba (ver. 0.2.3 or later)|`false`| | |
34 | 35 | |`['openldap']['server']['ldaps']`|Boolean|enable ldaps (ver. 0.1.2 or later)|`false`| |
35 | 36 | |`['openldap']['server']['KRB5_KTNAME']`|String|e.g. `'/etc/krb5.keytab'` (ver. 0.1.2 or later)|`nil`| |
36 | 37 | |
38 | +['openldap']['extra_schema'] | |
39 | + | |
37 | 40 | Usage |
38 | 41 | ----- |
39 | 42 |
@@ -45,5 +45,8 @@ default['openldap']['nss-ldapd']['base'] = 'dc=example,dc=net' | ||
45 | 45 | default['openldap']['ldap_lookup_nameservices'] = [] # e.g. ['passwd', 'group'] |
46 | 46 | #default['openldap'][''] = |
47 | 47 | |
48 | +default['openldap']['server']['extra_schema'] = { | |
49 | + 'samba' => false, | |
50 | +} | |
48 | 51 | default['openldap']['server']['ldaps'] = false |
49 | 52 | default['openldap']['server']['KRB5_KTNAME'] = nil # e.g. '/etc/krb5.keytab' |
@@ -5,7 +5,7 @@ maintainer_email '' | ||
5 | 5 | license 'Apache 2.0' |
6 | 6 | description 'Installs/Configures openldap' |
7 | 7 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) |
8 | -version '0.2.2' | |
8 | +version '0.2.3' | |
9 | 9 | source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git' |
10 | 10 | issues_url 'https://osdn.jp/projects/metasearch/ticket' |
11 | 11 |
@@ -102,3 +102,41 @@ You must setup OpenLDAP configurations in the first installation: | ||
102 | 102 | edit /etc/openldap/slap.d configurations |
103 | 103 | $ sudo service slapd restart |
104 | 104 | EOM |
105 | + | |
106 | +schema_dir = '/etc/ldap/schema' | |
107 | +if node['openldap']['server']['extra_schema']['samba'] | |
108 | + pkg = 'samba' | |
109 | + resources(package: pkg) rescue package pkg do | |
110 | + action :install | |
111 | + end | |
112 | + | |
113 | + code_str = '' | |
114 | + case node['platform_family'] | |
115 | + when 'debian' | |
116 | + code_str = <<-"EOH" | |
117 | + cp /usr/share/doc/samba/examples/LDAP/samba.schema.gz #{schema_dir}/ | |
118 | + cp /usr/share/doc/samba/examples/LDAP/samba.ldif.gz #{schema_dir}/ | |
119 | + gunzip #{schema_dir}/samba.schema.gz | |
120 | + gunzip #{schema_dir}/samba.ldif.gz | |
121 | + EOH | |
122 | + when 'rhel' | |
123 | + code_str = <<-"EOH" | |
124 | + cp /usr/share/doc/samba-*/LDAP/samba.schema #{schema_dir}/ | |
125 | + cp /usr/share/doc/samba-*/LDAP/samba.ldif #{schema_dir}/ | |
126 | + EOH | |
127 | + end | |
128 | + | |
129 | + bash 'cp_samba_schema_files' do | |
130 | + code code_str | |
131 | + action :run | |
132 | + not_if { File.exist?("#{schema_dir}/samba.schema") } | |
133 | + not_if { File.exist?("#{schema_dir}/samba.ldif") } | |
134 | + end | |
135 | + | |
136 | + log <<-EOM | |
137 | +Note: | |
138 | +You must add the schema for Samba only once: | |
139 | + $ sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/samba.ldif | |
140 | + $ sudo ldapsearch -Y EXTERNAL -H ldapi:/// -LLL -b "cn=schema,cn=config" dn | |
141 | + EOM | |
142 | +end |