Install and configure any app on any OS with Tiny Puppet
1. tp install anything [anywhere(*)]
by Alessandro Franceschi @alvaganteâ¨
Founder and CTO @example42
at #cfgmgmtcamp 2017
1
2. Tiny Puppet needs Puppet 4 (**)
⢠If Puppet is not installed, just feel reckless and run:â¨
wget -O - https://bit.ly/installpuppet |
sudo bash
⢠Script removes old versions, detects OS, installs ofďŹcial
Puppet repos and then Puppet 4 agent
⢠(**) tp is optimised for Puppet4 but has deďŹnes compatible with Puppet 3:
tp::install3, tp::conf3, tp::dir3
2
3. "Piping the internet to my shell !?!?!"
⢠The https://bit.ly/installpuppet URL
redirects to a script in example42 control-repo:â¨
â¨
https://raw.githubusercontent.com/example42/control-
repo/production/bin/puppet_install.sh
⢠Take your time to review it or just ďŹre and forget
â¨
â¨
.â¨
â¨
3
4. Install Tiny Puppet
⢠Usage from shellâ¨
puppet module install example42/tpâ¨
puppet tp setupâ¨
tpâ¨
⢠In PuppetďŹle for usage in manifests:â¨
mod "example42/tp"â¨
mod "example42/tinydata"
4
5. Yet Another Universal Installer
⢠al@localhost$ [sudo] tp install app
⢠It supports any applicationâ¨
on any operating system (*)
⢠It manages package repositories and other
dependencies
5
6. (*) Any Opeating System?
⢠RedHat and Debian derivatives always supported
⢠Suse, Alpine and other Linux distros need more tiny data
⢠Solaris, BSD, Darwin support partial but possible (may
miss data, tests and some features)
⢠Windows: WIP. Currently not supported
6
8. All the supported apps
⢠By default TP uses tinydata as source for data about
applications
⢠Missing support for apps or OS is just a matter ofâ¨
missing data
⢠github.com/example42/tinydata/
⢠You can use your own data module
8
9. Usage on cli: tp test to show apps status
⢠al@localhost$ tp test [app]
⢠Show status of all the applications managed by tp
⢠Can be automated in CI and testing
⢠Custom checks can be easily created
⢠If any of the apps fails, the global exit code is 1â¨
9
10. Usage on cli: tp log to show apps logs
⢠al@localhost$ tp log [app]
⢠tail -f the log[s] of all or the written application
⢠Useful for quick debugging when unaware of log paths
⢠Customisations:
tp::install { 'redis':
settings_hash => {â¨
log_file_path => '/opt/redis/redis.logs',â¨
log_dir_path => '/opt/redis'â¨
},
}â¨
10
11. Usage on cli: tp list - tp uninstall
⢠al@localhost$ tp uninstall <app>
⢠Removes package and eventually repo ďŹle of an app
⢠al@localhost$ tp list
⢠List all the applications tp can installâ¨
â¨
11
14. Usage on manifests: Test installed apps
⢠Testing of application can be enable by either one of:
tp::test { 'redis': }â¨
tp::install { 'redis':
test_enable => true,â¨
test_template => 'site/test/nginx.erb',
}
⢠A custom test script is created in /etc/tp/test/$appâ¨
Default tests use data from /etc/tp/app/$app
14
15. Essential acceptance tests
⢠TP be able to test an app (alternatives)
â¨
git clone https://github.com/example42/tp-acceptance
cd tp-acceptance
r10k puppetfile install
vagrant status
# Test munin on all supported OS
bin/test_app.sh munin all acceptance
# Test all apps on a specific OS
bin/test_app.sh all Centos7 acceptance
# Test all appas on all supporte OSâ¨
bin/test_app.sh all all acceptance
Compatibility Matrix
15
16. It's all about Tiny Data
⢠Data to manage apps on different OS is on separated tinydata
module
⢠Currently 149 applications supported (ls -1 data/ | wc -l)
⢠For each application a data/$app/hiera.yaml ďŹle deďŹne the
hierarchy to use for data lookup (erm, no, Hiera is not actually used):
â¨
---
:hierarchy:
- "%{title}/operatingsystem/%{operatingsystem}-%{operatingsystemmajrelease}"
- "%{title}/operatingsystem/%{operatingsystem}"
- "%{title}/osfamily/%{osfamily}"
- "%{title}/default"
- default
16
17. It's all about Tiny Data
⢠Eash data ďŹle, in YAML format, contains the info tp uses
to manage applications:â¨
---
redis::settings:
package_name: 'redis'
service_name: 'redis'
config_file_path: '/etc/redis/redis.conf'
config_dir_path: '/etc/redis'
tcp_port: '6379'
pid_file_path: '/var/run/redis.pid'
log_file_path: '/var/log/redis.log'
log_dir_path: ''
process_user: 'redis'
process_group: 'redis'
17
18. Use cases - In manifests
⢠In local site proďŹles, when we have to conďŹgure
applications we know how to conďŹgure
⢠In component modules, with local tiny data
⢠tp can replace or coexist with component modules
18
19. Use cases - On the command line
⢠Quickly install applications
⢠Check if installed apps are working correctly:â¨
monitoring, CI, runtime tests.
⢠Troubleshoot locally problems by quickly accessing logs
19