Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set System Wide Environment Variable in Cloud Config File on Digital Ocean

I am pretty new to setting up remote servers, but I was playing around today and was hoping that I could leverage a Cloud Config file upon setup in order to set a few environment variables as the server spins up.

How can I set my environment variables programmatically when spinning up a machine on Digital Ocean? The key is that I want to automate the setup and avoid interactively defining these variables.

Thanks in advance.

like image 825
Btibert3 Avatar asked Jun 26 '16 23:06

Btibert3


1 Answers

This is what I did with for ubuntu

write_files:
- path: /etc/environment
  content: |
    FOO="BAR"
  append: true
like image 109
dangel Avatar answered Sep 23 '22 15:09

dangel