razor - events.static.linuxfound.org › sites › events › ... · overview • intro to razor...

30
Razor Programmable provisioning David Lutterkort lutter @puppetlabs.com

Upload: others

Post on 29-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

Razor

Programmable provisioning

David [email protected]

Page 2: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

PXE provisioning - user satisfaction

Page 3: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

Overview• Intro to Razor• Examples

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

• Puppet Enterprise

Page 4: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

Razor in a nutshell• iPXE

• Node Discovery

• Stay focussed

Page 5: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

How it worksMicrokernel sends facts

Page 6: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

How it worksMatch Tags

Page 7: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

How it worksFind Policy

Page 8: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

How it worksExecute Policy

Page 9: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

How it worksBasic OS installed

Managed by Puppet

Page 10: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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 11: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

Examples

Page 12: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

Page 13: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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 14: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

Page 15: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

Page 16: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

Page 17: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

Page 18: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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 19: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

Page 20: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

Page 21: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

Brownfield deployments• protect_new_nodes setting in config.yaml

• register_node command

Page 22: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

Windows installation• Additional setup steps:

1. Build WinPE

2. Create Windows repo

3. Samba server

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

Page 23: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

Server locality (@virtualswede)• server role based on position

• talk to network equipment

• extend MK with LLDP facts

Page 24: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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 25: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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 26: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

• node-registered

• node-bound

• node-uninstalled

• node-deleted

Page 27: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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 28: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

PuppetEnterprise

Page 29: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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 30: Razor - events.static.linuxfound.org › sites › events › ... · Overview • Intro to Razor • Examples • Minimal setup • Direct provisioning • Brownfield • Windows

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

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