Skip to content

Instantly share code, notes, and snippets.

@tlehman
Last active January 2, 2024 23:28
Show Gist options
  • Save tlehman/ffde3cba30ca41343445754ae829cb87 to your computer and use it in GitHub Desktop.
Save tlehman/ffde3cba30ca41343445754ae829cb87 to your computer and use it in GitHub Desktop.
Introduction to Puppet Part 1 Manifest
# introduced in https://tlehman.blog/p/introduction-to-puppet
# refined in https://tlehman.blog/p/introduction-to-puppet-part-2
node default {
# Ensure the required packages are installed
package { ['nginx', 'ruby', 'ruby-railties']:
ensure => installed,
}
# Configure Nginx to listen on port 80 and proxy to port 3000
file { '/etc/nginx/sites-available/default':
ensure => file,
content => template('modulename/nginx.conf.erb'),
require => Package['nginx'],
notify => Service['nginx'],
}
# Ensure Nginx service is running and enabled
service { 'nginx':
ensure => running,
enable => true,
}
# Define a systemd service for the Rails app
file { '/etc/systemd/system/railsapp.service':
ensure => file,
content => template('modulename/railsapp.service.erb'),
notify => Service['railsapp'],
}
# Ensure the Rails app service is running and enabled
service { 'railsapp':
ensure => running,
enable => true,
require => File['/etc/systemd/system/railsapp.service'],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment