Last active
August 29, 2015 14:22
-
-
Save beddari/012f2de16279f1a54692 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
bmcremote_defaults: | |
type: idrac8 | |
user: not_default | |
pass: password | |
bmcremote: | |
test-server-01: | |
ip: x.y.z.1 | |
settings: | |
set_1: | |
order: 01 | |
check: | |
idrac.ipv4.address: 1.2.3.4 | |
set: | |
idrac.ipv4.enable: Enabled | |
idrac.ipv4.dhcpenable: Disabled | |
idrac.ipv4.address: 1.2.3.4 | |
idrac.ipv4.gateway: 1.2.3.4 | |
idrac.ipv4.netmask: 1.2.3.4 | |
idrac.ipv6.enable: Disabled | |
exec: | |
{} | |
set_2: | |
order: 02 | |
check: | |
bios.biosbootsettings.bootmode: Bios | |
bios.biosbootsettings.bootseq: NIC.Integrated.1-3-1,HardDisk.List.1-1 | |
set: | |
bios.biosbootsettings.bootmode: Bios | |
bios.biosbootsettings.bootseq: NIC.Integrated.1-3-1,HardDisk.List.1-1 | |
exec: | |
- jobqueue create BIOS.Setup.1-1 | |
test-server-02: | |
ip: x.y.z.2 | |
settings: | |
set_1: | |
order: 01 | |
check: | |
idrac.ipv4.address: 1.2.3.4 | |
set: | |
idrac.ipv4.enable: Enabled | |
idrac.ipv4.dhcpenable: Disabled | |
idrac.ipv4.address: 1.2.3.4 | |
idrac.ipv4.gateway: 1.2.3.4 | |
idrac.ipv4.netmask: 1.2.3.4 | |
idrac.ipv6.enable: Disabled | |
exec: | |
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define bmcremote::host( | |
$type = 'idrac8', | |
$ip = '12.34.56.78', | |
$user = 'root', | |
$pass = 'calvin', | |
$settings = { | |
'name_of_settings_group' => { | |
'check' => {}, | |
'set' => {}, | |
'exec' => {}, | |
} | |
} | |
) { | |
case $type { | |
'idrac8': { | |
# device specific values if needed | |
} | |
default: { | |
fail("bmc device type ${type} not set or not supported") | |
} | |
} | |
concat { "bmcremote_${name}": | |
path => "/etc/bmcremote/hosts/${name}.sh": | |
owner => 'root', | |
group => 'root', | |
mode => '0700', | |
} | |
# fragment to setup env vars, passwords etc | |
concat::fragment {"bmcremote_header_${name}": | |
target => "bmcremote_${name}", | |
content => template("bmcremote/setup.erb"), | |
order => '00', | |
} | |
# Make resource names unique | |
$configset_keys = keys($settings) | |
$configset_resources = prefix($configset_keys, 'bmcremote_configset_') | |
bmcremote::configset { $configset_resources: | |
target => "bmcremote_${name}", | |
type => $type, | |
settings => $settings, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
define bmcremote::configset( | |
$target, | |
$type, | |
$settings, | |
) { | |
# Simplify looking up data with an index variable | |
$index = delete($name, 'bmcremote_configset_') | |
$order = $settings[$index]['order'] | |
$check = $settings[$index]['check'] | |
$set = $settings[$index]['set'] | |
$exec = $settings[$index]['exec'] | |
concat::fragment {"${name}_${order}": | |
target => $target, | |
content => template("bmcremote/${type}.erb"), | |
order => $order, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment