How can I configure multiple deployment environments for juju? [closed]
I want to be able to deploy charms both locally and to EC2. What's an example environments.yaml that has both entries?
And how can I switch between them so I can just deploy to EC2 and/or LXC?
You can have as many environments as you want in .juju/environments.yaml , and then set one as the default. Here is my sanitised environments.yaml with ec2, a private openstack cloud, and my local machine:
default: sample
environments:
sample:
type: ec2
control-bucket: juju-XXXXXXXXXXXXXXXXXXXXXXXXXXXX
admin-secret: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
secret-key: ZZZZZZZZZZZZZZZZZZZZZZZZZZ/2222222222
access-key: 0123456789ABCDEF
default-series: precise
openstack:
type: ec2
default-instance-type: m1.small
control-bucket: juju-XXXXXXXXXXXXXXXXXXXXXXXXXXXX
admin-secret: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
ec2-uri: http://my.private.cloud:8773/services/Cloud
s3-uri: http://my.private.s3:3333
default-image-id: ami-000000ab
access-key: random-uuid-follows-1fc1f05e-1c37-4594-8e5e:me_project
secret-key: 4a75192b-2478-4acf-a6e8-aa60bbaf1e28
default-series: precise
local:
type: local
default-series: precise
data-dir: /home/clint/.juju/data
admin-secret: 3d909951d4984b92963f1186c4b6cb16
control-bucket: foo
customer-one:
type: ec2
control-bucket: juju-XXXXXXXXXXXXXXXXXXXXXXXXXXXX
admin-secret: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
secret-key: ZZZZZZZZZZZZZZZZZZZZZZZZZZ/2222222222
access-key: 0123456789ABCDEF
default-series: precise
customer-two:
type: ec2
control-bucket: juju-XXXXXXXXXXXXXXXXXXXXXXXXXXXX
admin-secret: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
secret-key: ZZZZZZZZZZZZZZZZZZZZZZZZZZ/2222222222
access-key: 0123456789ABCDEF
default-series: precise
I can select the environment by appending the '--environment' or '-e' argument to any juju command, so
juju status -e customer-one
Returns different things than just
juju status
Also each environment has different configuration options depending on the provider, see the following sections of the juju documentation:
- https://juju.ubuntu.com/docs/provider-configuration-ec2.html
- https://juju.ubuntu.com/docs/provider-configuration-local.html
- https://juju.ubuntu.com/docs/provider-configuration-openstack.html