infrastructure as data - puppetconf 2013
DESCRIPTION
"Infrastructure as Data" by Nick Lewis, Software Developer, Puppet Labs. Presentation Overview: We all know the benefits of infrastructure as code - version control, reusability, shareability, documentation, and so on. Another popular notion is that of code as data, by which code can be introspected, modified, and used for decision making. Combining the two ideas, the natural implication is that infrastructure is also data, and can be similarly introspected, modified, and used for decision making. In other words, we can do math on infrastructure. We'll look at some interesting ways this data can be filtered, combined, and applied to achieve results which would be difficult to describe directly in code. Speaker Bio: Nick Lewis is a software developer at Puppet Labs and one of the co-authors of PuppetDB.TRANSCRIPT
![Page 1: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/1.jpg)
Infrastructure as DataNick LewisDeveloper | Puppet Labs @nick_lewis
Friday, August 23, 13
![Page 2: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/2.jpg)
puppetconf.com #puppetconf
Infrastructure as Data
• Specified data• Manifests
• Hiera
• Node classification
• Observed data• Facts
• Generated/derived data• Catalogs
• Reports
Friday, August 23, 13
![Page 3: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/3.jpg)
puppetconf.com #puppetconf
as aminecraft addict
I would liketime to be correct on my computer
so thatI can stop playing minecraft and go to sleep
Friday, August 23, 13
![Page 4: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/4.jpg)
puppetconf.com #puppetconf
Infrastructure as Code
• tangible artifact
• easy to change
• documented
• repeatable
• idempotent
Friday, August 23, 13
![Page 5: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/5.jpg)
puppetconf.com #puppetconf
yum install -y ntpif ! grep 'server 0.pool.ntp.org' /etc/ntp.conf; then echo 'server 0.pool.ntp.org' >> /etc/ntp.conffi/etc/init.d/ntpd status || /etc/init.d/ntpd start
Friday, August 23, 13
![Page 6: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/6.jpg)
puppetconf.com #puppetconf
yum check-update ntpif [ $? -eq 100 ]; then yum install -y ntp && restart_ntp='y'fi
if ! grep 'server 0.pool.ntp.org' /etc/ntp.conf; then echo 'server 0.pool.ntp.org' >> /etc/ntp.conf restart_ntp='y'fi
if [ -n "$restart_ntp" ]; then /etc/init.d/ntpd restartelif ! /etc/init.d/ntpd status; then /etc/init.d/ntpd startfi
Friday, August 23, 13
![Page 7: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/7.jpg)
puppetconf.com #puppetconf
Infrastructure as Bash
• platform-specific
• imperative
• ad-hoc relationships
• brittle in the face of failure
Friday, August 23, 13
![Page 8: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/8.jpg)
puppetconf.com #puppetconf
if install_package ntp; then restart_ntp='y'fi
if add_file_line 'server 0.pool.ntp.org'; then /etc/ntp.conf && restart_ntp='y'fi
if [ 'y' = "$restart_ntp" ]; then restart_service ntpelse start_service ntpfi
Friday, August 23, 13
![Page 9: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/9.jpg)
puppetconf.com #puppetconf
Infrastructure as Bash
• platform-specific
• slightly less imperative
• ad-hoc relationships
• brittle in the face of failure
Friday, August 23, 13
![Page 10: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/10.jpg)
puppetconf.com #puppetconf
Infrastructure as Bash
• platform-specific
• slightly less imperative
• ad-hoc relationships
• brittle in the face of failure
Friday, August 23, 13
![Page 11: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/11.jpg)
puppetconf.com #puppetconf
package { 'ntp': ensure => 'present', notify => Service[ntp], } file_line { 'ntp server': path => '/etc/ntp.conf', line => 'server 0.pool.ntp.org', require => Package[ntp], notify => Service[ntp], } service { 'ntp': ensure => 'running', }
Friday, August 23, 13
![Page 12: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/12.jpg)
puppetconf.com #puppetconf
Infrastructure as Puppet
• platform-independent
• mostly declarative
• relationships are explicit
• understands failure
Friday, August 23, 13
![Page 13: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/13.jpg)
puppetconf.com #puppetconf
class ntp { package { 'ntp': ensure => 'present', notify => Service[ntp], } file_line { 'ntp server': path => '/etc/ntp.conf', line => 'server 0.pool.ntp.org', require => Package[ntp], notify => Service[ntp], } service { 'ntp': ensure => 'running', }
Friday, August 23, 13
![Page 14: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/14.jpg)
puppetconf.com #puppetconf
include ntp
Friday, August 23, 13
![Page 15: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/15.jpg)
puppetconf.com #puppetconf
tell me what you wantwhat you really really want
Friday, August 23, 13
![Page 16: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/16.jpg)
puppetconf.com #puppetconf
include magical_time_synchronization
Friday, August 23, 13
![Page 17: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/17.jpg)
puppetconf.com #puppetconf
configuration managementthe art of making your monitoring checks pass
Friday, August 23, 13
![Page 18: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/18.jpg)
puppetconf.com #puppetconf
abstractiongiving a name to something and then cutting it out of your life
Friday, August 23, 13
![Page 19: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/19.jpg)
puppetconf.com #puppetconf
class ntp { package { 'ntp': ensure => 'present', notify => Service[ntp], } file_line { 'ntp server': path => '/etc/ntp.conf', line => 'server 0.pool.ntp.org', require => Package[ntp], notify => Service[ntp], } service { 'ntp': ensure => 'running', }
Friday, August 23, 13
![Page 20: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/20.jpg)
puppetconf.com #puppetconf
package { 'ntp': }
file_line { 'ntp server': }
service { 'ntp': }
Friday, August 23, 13
![Page 21: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/21.jpg)
puppetconf.com #puppetconf
Friday, August 23, 13
![Page 22: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/22.jpg)
puppetconf.com #puppetconf
Friday, August 23, 13
![Page 23: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/23.jpg)
puppetconf.com #puppetconf
time sync
Friday, August 23, 13
![Page 24: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/24.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
Friday, August 23, 13
![Page 25: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/25.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package
Friday, August 23, 13
![Page 26: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/26.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
Friday, August 23, 13
![Page 27: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/27.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
yum
Friday, August 23, 13
![Page 28: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/28.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
yum
python
Friday, August 23, 13
![Page 29: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/29.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
yum
rpmpython
Friday, August 23, 13
![Page 30: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/30.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
yum
rpmpython
...
Friday, August 23, 13
![Page 31: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/31.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
yum
rpmpythonntp server...
Friday, August 23, 13
![Page 32: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/32.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
yum
rpmpython networkntp server...
Friday, August 23, 13
![Page 33: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/33.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
yum
rpmpython networkntp server...
...
Friday, August 23, 13
![Page 34: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/34.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
filesystem
yum
rpmpython networkntp server...
...
Friday, August 23, 13
![Page 35: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/35.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
filesystem
yum
rpmpython networkntp server...
......
Friday, August 23, 13
![Page 36: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/36.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
filesystem
yum
rpmpythonelectricity
networkntp server...
......
Friday, August 23, 13
![Page 37: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/37.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
filesystem
yum
rpmpythonelectricity
networkntp server...
...... ...
Friday, August 23, 13
![Page 38: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/38.jpg)
puppetconf.com #puppetconf
time sync
ntpd service
ntp package ntp.conf
filesystem
yum
rpmpythonelectricity
networkntp server...
...... ...
the very concept of time itself
Friday, August 23, 13
![Page 39: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/39.jpg)
puppetconf.com #puppetconf
if you wanna be my loveryou gotta apt-get with my
friends
Friday, August 23, 13
![Page 40: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/40.jpg)
puppetconf.com #puppetconf
requiresubscribe
Friday, August 23, 13
![Page 41: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/41.jpg)
puppetconf.com #puppetconf
Package installs ServiceFile is the source of PackageUser owns FileFile configures ServiceUser is a member of GroupFile is the directory of FileFile is executed by Exec
Friday, August 23, 13
![Page 42: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/42.jpg)
puppetconf.com #puppetconf
File / FileFile / UserFile / GroupUser / GroupCron / UserExec / FileExec / User
?
Friday, August 23, 13
![Page 43: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/43.jpg)
puppetconf.com #puppetconf
file { "/home/sweet/home": ensure => present, owner => sweet, require => User[sweet],}
user { "sweet": ensure => present,}
Friday, August 23, 13
![Page 44: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/44.jpg)
puppetconf.com #puppetconf
file { "/home/sweet/home": ensure => absent, owner => sweet, require => User[sweet],}
user { "sweet": ensure => absent,}
Friday, August 23, 13
![Page 45: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/45.jpg)
puppetconf.com #puppetconf
file { "/home/sweet/home": ensure => present, owner => sweet, require => User[sweet],}
user { "sweet": ensure => absent,}
Friday, August 23, 13
![Page 46: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/46.jpg)
puppetconf.com #puppetconf
file { "/home/sweet/home": ensure => present, owner => User[sweet],}
user { "sweet": ensure => absent,}
Friday, August 23, 13
![Page 47: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/47.jpg)
puppetconf.com #puppetconf
user { "sweet": ensure => absent,}
file { "/home/sweet/home": ensure => present,}
Friday, August 23, 13
![Page 48: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/48.jpg)
puppetconf.com #puppetconf
user { "sweet": ensure => absent,}
file { "/home/sweet/home": ensure => present,}
--ordering manifest
Friday, August 23, 13
![Page 49: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/49.jpg)
puppetconf.com #puppetconf
user { "sweet": ensure => absent,}
file { "/home/sweet/home": ensure => present,}
--ordering random
Friday, August 23, 13
![Page 50: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/50.jpg)
puppetconf.com #puppetconf
concat { "/etc/motd": }
concat::fragment { "motd_hello": target => "/etc/motd", content => "Hello PuppetConf!\n", order => 1,}
concat::fragment { "motd_goodbye": target => "/etc/motd", content => "Goodbye PuppetConf :(", order => 2,}
Friday, August 23, 13
![Page 51: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/51.jpg)
puppetconf.com #puppetconf
file { "/etc/motd": ensure => present, content => "Hello PuppetConf!\nGoodbye PuppetConf :(",}
Friday, August 23, 13
![Page 52: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/52.jpg)
puppetconf.com #puppetconf
concat::fragment { "motd_hello": target => "/etc/motd", content => "Hello PuppetConf!\n", order => 1,}
concat::fragment { "motd_goodbye": target => "/etc/motd", content => "Goodbye PuppetConf :(", order => 2,}
file { "/etc/motd": ensure => present, content => "Hello PuppetConf!\nGoodbyePuppetConf :(",
Friday, August 23, 13
![Page 53: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/53.jpg)
Thank YouNick LewisDeveloper | Puppet Labs @nick_lewis
Collaborate. Automate. Ship.
Friday, August 23, 13
![Page 54: Infrastructure as Data - PuppetConf 2013](https://reader033.vdocuments.us/reader033/viewer/2022060108/554f70b1b4c9058a148b5290/html5/thumbnails/54.jpg)
Follow us on Twitter @puppetlabs
youtube.com/puppetlabsinc
slideshare.net/puppetlabs
Collaborate. Automate. Ship.
Friday, August 23, 13