Skip to content

Commit

Permalink
ironic: barclamp for Ironic Bare Metal Service
Browse files Browse the repository at this point in the history
New barclamp to handle deployment and configuration of Ironic service.
  • Loading branch information
skazi0 committed May 29, 2017
1 parent 27bdb0a commit 5e159e9
Show file tree
Hide file tree
Showing 36 changed files with 1,221 additions and 9 deletions.
22 changes: 22 additions & 0 deletions bin/crowbar_ironic
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env ruby
#
# Copyright 2016, SUSE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require File.join(File.expand_path(File.dirname(__FILE__)), "barclamp_lib")
@barclamp = "ironic"
@timeout = 3600

main
26 changes: 26 additions & 0 deletions chef/cookbooks/ironic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
DESCRIPTION
===========
Chef Cookbook to install and configure Ironic

REQUIREMENTS
============
TBD


License
=======
Author:: Jacek Tomasiak <[email protected]>

Copyright:: 2016 SUSE

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
72 changes: 72 additions & 0 deletions chef/cookbooks/ironic/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2016, SUSE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

case node[:platform_family]
when "rhel", "suse"
default[:ironic][:platform] = {
packages: [
"openstack-ironic",
"openstack-ironic-api",
"openstack-ironic-conductor",
"python-ironicclient",
"python-openstackclient"
],
services: [
"openstack-ironic-api",
"openstack-ironic-conductor"
],
driver_dependencies: {
pxe_ssh: ["python-paramiko"]
}
}
default[:ironic][:api][:service_name] = "openstack-ironic-api"
default[:ironic][:conductor][:service_name] = "openstack-ironic-conductor"

when "debian"
default[:ironic][:platform] = {
packages: [
"ironic-api",
"ironic-conductor",
"python-ironicclient",
"python-openstackclient"
],
services: [
"ironic-api",
"ironic-api-conductor"
],
driver_dependencies: {
pxe_ssh: ["python-paramiko"]
}
}
default[:ironic][:api][:service_name] = "ironic-api"
default[:ironic][:conductor][:service_name] = "ironic-conductor"
end

default[:ironic][:debug] = false
default[:ironic][:verbose] = false
default[:ironic][:max_header_line] = 16384

default[:ironic][:user] = "ironic"
default[:ironic][:group] = "ironic"

default[:ironic][:db][:database] = "ironic"
default[:ironic][:db][:user] = "ironic"
default[:ironic][:db][:password] = "" # Set by Crowbar

default[:ironic][:service_user] = "ironic"
default[:ironic][:service_password] = "" # Set by Crowbar

default[:ironic][:api][:protocol] = "http"
default[:ironic][:api][:port] = 6385
15 changes: 15 additions & 0 deletions chef/cookbooks/ironic/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name "ironic"
maintainer "Crowbar project"
maintainer_email "[email protected]"
license "Apache 2.0"
description "Installs/Configures Ironic"
long_description IO.read(File.join(File.dirname(__FILE__), "README.md"))
version "0.1"

depends "crowbar-openstack"
depends "database"
depends "keystone"
depends "rabbitmq"
depends "neutron"
depends "glance"
depends "utils"
27 changes: 27 additions & 0 deletions chef/cookbooks/ironic/recipes/monitor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true
return unless node["roles"].include?("nagios-client")

svcs = []
ports = {}
node[:ironic][:platform][:services].each { |svc| svcs << svc }
node[:ironic][:api].each do |k, v|
next if k !~ /port*/
ports[k] = v
end

log "Will monitor ironic services: #{svcs.inspect}"

include_recipe "nagios::common"

template "/etc/nagios/nrpe.d/ironic_nrpe.cfg" do
source "ironic_nrpe.cfg.erb"
mode "0644"
group node[:nagios][:group]
owner node[:nagios][:user]
variables(
ironic_services: svcs,
ironic_ports: ports,
ironic_ip: node.ipaddress
)
notifies :restart, "service[nagios-nrpe-server]"
end
21 changes: 21 additions & 0 deletions chef/cookbooks/ironic/recipes/role_ironic_server.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true
# Copyright 2016, SUSE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

if CrowbarRoleRecipe.node_state_valid_for_role?(node, "ironic", "ironic-server")
include_recipe "ironic::server"
include_recipe "ironic::monitor"
include_recipe "ironic::tftp"
end
Loading

0 comments on commit 5e159e9

Please sign in to comment.