Razor, the Provisioning Toolbox - PuppetConf 2014

25
Razor David Lutterkort Principal Engineer | Puppet Labs @lutterkort

description

Razor, the Provisioning Toolbox - David Lutterkort, Puppet Labs

Transcript of Razor, the Provisioning Toolbox - PuppetConf 2014

Page 1: Razor, the Provisioning Toolbox - PuppetConf 2014

RazorDavid LutterkortPrincipal Engineer | Puppet Labs@lutterkort

Page 2: Razor, the Provisioning Toolbox - PuppetConf 2014

PXE provisioning - user satisfaction

Page 3: Razor, the Provisioning Toolbox - PuppetConf 2014

Overview• Intro to Razor• Examples

• Minimal setup• Direct provisioning• Brownfield• Windows• Server locality

• Puppet Enterprise

Page 4: Razor, the Provisioning Toolbox - PuppetConf 2014

Razor in a nutshell• iPXE

• Node Discovery

• Stay focussed

Page 5: Razor, the Provisioning Toolbox - PuppetConf 2014

Moving pieces

Repo What to install ISO contents

Task How to install Installer scripts

Broker How to manage PE agent install

Tag Where to install Named match rule

Policy Combine it all Ordered table

Page 6: Razor, the Provisioning Toolbox - PuppetConf 2014

Examples

Page 7: Razor, the Provisioning Toolbox - PuppetConf 2014

Minimal setup> razor create-repo --name centos6 \ --iso-url http://example.org/centos-6.5.iso \ --task centos

Page 8: Razor, the Provisioning Toolbox - PuppetConf 2014

Minimal setup> razor create-repo --name centos6 \ --iso-url http://example.org/centos-6.5.iso \ --task centos

From http://razor:8080/api/collections/repos/centos6:

name: centos6 iso_url: http://example.org/centos-6.5.iso url: — task: centos command: http://razor:8080/api/collections/commands/74

Page 9: Razor, the Provisioning Toolbox - PuppetConf 2014

Minimal setup> razor create-broker --name pe --broker-type puppet-pe \ --configuration server=puppet-master.example.org

Page 10: Razor, the Provisioning Toolbox - PuppetConf 2014

Minimal setup> razor create-tag --name test --rule '["=", 1, 1]'

Page 11: Razor, the Provisioning Toolbox - PuppetConf 2014

Minimal setup> razor create-policy --name demo \ --repo centos6 \ --hostname 'host${id}.example.com' \ --root-password 'geheim' \ --broker pe --tag test

Page 12: Razor, the Provisioning Toolbox - PuppetConf 2014

MAC-based provisioning> razor update-tag-rule --name test --force \ --rule '["in", ["fact", "macaddress"], "00:00:de:ad:be:ef"]'

Page 13: Razor, the Provisioning Toolbox - PuppetConf 2014

MAC-based provisioning> razor update-tag-rule --name test --force \ --rule '["in", ["fact", "macaddress"], "00:00:de:ad:be:ef", "00:00:8b:ad:f0:0d"]'

Page 14: Razor, the Provisioning Toolbox - PuppetConf 2014

Using node metadata> razor update-tag-rule --name test --force \ --rule '["=", ["metadata", "os"] "centos"]'

Page 15: Razor, the Provisioning Toolbox - PuppetConf 2014

Using node metadata> razor update-node-metadata --node node42 \ --key os \ --value centos

Page 16: Razor, the Provisioning Toolbox - PuppetConf 2014

Brownfield deployments• protect_new_nodes setting in config.yaml

• register_node command

Page 17: Razor, the Provisioning Toolbox - PuppetConf 2014

Windows installation• Additional setup steps:

1. Build WinPE

2. Create Windows repo

3. Samba server

• Supported: Windows 8, Windows 2012R2, 2008R2 WIP

Page 18: Razor, the Provisioning Toolbox - PuppetConf 2014

Server locality (@virtualswede)

• server role based on position

• talk to network equipment

• extend MK with LLDP facts

Page 19: Razor, the Provisioning Toolbox - PuppetConf 2014

LLDP facts> razor nodes node1 factsFrom http://localhost:8080/api/collections/nodes/node1:… ipaddress_ens2f0: 192.168.1.107 macaddress_ens2f0: 00:1e:67:4d:c2:06 netmask_ens2f0: 255.255.255.0… lldp_neighbor_portid_ens2f0: Ethernet17 lldp_neighbor_sysname_ens2f0: razor-switch1 lldp_neighbor_mngaddr_ipv4_ens2f0: 192.168.1.254…

Page 20: Razor, the Provisioning Toolbox - PuppetConf 2014

Microkernel extensions> tree extension

extension/├── bin/├── lib/│   └── ruby/│   └── facter/└── facts.d/

> cd extension && zip -r ../mk-extension.zip *> cp mk-extension.zip $extension-zip

Page 21: Razor, the Provisioning Toolbox - PuppetConf 2014

Hook scripts• Called at predefined points in a node’s lifecycle

• node-registered

• node-bound

• node-uninstalled

• node-deleted

Page 22: Razor, the Provisioning Toolbox - PuppetConf 2014

Hook scriptsjson=$(< /dev/stdin)

name=$(jq '.hook.name' <<< $json)value=$(( $(jq '.hook.config.value' <<< $json) + 1 ))

cat <<EOF{ "hook": { "config": { "value": $value } }, "metadata": { $name: $value }}EOF

Page 23: Razor, the Provisioning Toolbox - PuppetConf 2014

PuppetEnterprise

Page 24: Razor, the Provisioning Toolbox - PuppetConf 2014

Razor and Puppet Enterprise• In Tech Preview since PE 3.2

• Major updates in PE 3.3

• Ongoing work to support fully

• Vagrant stack:https://github.com/npwalker/pe-razor-vagrant-stack

Page 25: Razor, the Provisioning Toolbox - PuppetConf 2014

Questions ?https://github.com/puppetlabs/razor-server

http://virtualswede.files.wordpress.com/2012/07/puppet-plus-razor-is-good.png