Code cleanup with search

This commit is contained in:
Eric Renfro 2016-07-21 12:50:48 -04:00
parent 2336fcae1e
commit 33ef1f65c5
2 changed files with 315 additions and 319 deletions

View file

@ -17,11 +17,13 @@
# limitations under the License. # limitations under the License.
# #
include_recipe 'chef-vault'
node.set["freeipa"]["client"] = true
# become aware servers # become aware servers
if Chef::Config[:solo]
Chef::Log.warn('This recipe uses search. Chef solo does not support search.')
else
include_recipe 'chef-vault'
node.normal["freeipa"]["client"] = true
freeipa_servers = search("node", "freeipa_server:true") freeipa_servers = search("node", "freeipa_server:true")
freeipa_clients = search("node", "freeipa_client:true") freeipa_clients = search("node", "freeipa_client:true")
freeipa_masters = search("node", "freeipa_master:true") freeipa_masters = search("node", "freeipa_master:true")
@ -80,4 +82,5 @@ unless freeipa_servers.empty? then
# get http cert? # get http cert?
end end
end

View file

@ -22,24 +22,16 @@ include_recipe 'chef-vault'
node.normal["freeipa"]["server"] = true node.normal["freeipa"]["server"] = true
# become aware of clients and servers # become aware of clients and servers
if Chef::Config[:solo]
Chef::Log.warn('This recipe uses search. Chef solo does not support search.')
else
freeipa_servers = search(:node, "freeipa_server:true") freeipa_servers = search(:node, "freeipa_server:true")
freeipa_clients = search(:node, "freeipa_client:true") freeipa_clients = search(:node, "freeipa_client:true")
# gather data bag secrets # gather data bag secrets
#secret = Chef::EncryptedDataBagItem.load_secret("/home/psi-jack/.chef/encrypted_data_bag_secret")
#passwords = Chef::EncryptedDataBagItem.load("secrets", "passwords", secret)
passwords = chef_vault_item("freeipa", 'passwords') passwords = chef_vault_item("freeipa", 'passwords')
#ldap_server_admin_pwd = data_bag_item('secrets','ldap_server_admin_pwd')['value']
#kdc_database_master_key = data_bag_item('secrets','kdc_database_master_key')['value']
#ipa_user_pwd = data_bag_item('secrets','ipa_user_pwd')['value']
# packages # packages
#package "dbus"
#package "oddjob"
#package "ipa-client"
#package "ipa-server"
#package "rsync"
package 'ipa-server' do package 'ipa-server' do
case node["platform"] case node["platform"]
when 'redhat', 'centos' when 'redhat', 'centos'
@ -303,4 +295,5 @@ end
#service "oddjobd" do #service "oddjobd" do
# action [:enable,:start] # action [:enable,:start]
#end #end
end