Skip to content

Instantly share code, notes, and snippets.

@gabidavila
Forked from svpernova09/Homestead.rb
Last active May 16, 2020 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabidavila/050e2cb6052dc4b89e3ab6ad46507b38 to your computer and use it in GitHub Desktop.
Save gabidavila/050e2cb6052dc4b89e3ab6ad46507b38 to your computer and use it in GitHub Desktop.
Ruby Array / Hash Logic to enable / disable Ubuntu Services
if settings.has_key?('services')
settings['services'].each do |service|
service['enabled'].each do |enable_service|
config.vm.provision "shell", inline: "sudo systemctl enable #{enable_service}"
end if service.include?('enabled')
service['disabled'].each do |disable_service|
config.vm.provision "shell", inline: "sudo systemctl disable #{disable_service}"
end if service.include?('disabled')
end
end
---
#snippet
services:
- enabled:
- "postgresql@12-main"
- "postgresql@11-main"
- disabled:
- "postgresql@10-main"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment