I'm looking for a way to automatically destroy the associated machine after destroying a service with:
juju destroy-service [service_name]
I know I can do:
juju destroy-machine --force [machine_number]
But this can't easily be automated with a script, as the script doesn't know the number of the machine.
Is there a way either to:
- have
destroy-service
also take the machine with it, or - get the machine number of my
[service_name]
with a simple bash command, to pass todestroy-machine
Currently, the above is the desired behaviour for Juju. the reasoning behind this is that a user may wish to remove a service, but there may still be value in data that is stored on the machine after the service is removed (e.g. log files etc). Additionally, in deployments where several services are deployed to the same machine (e.g. using containers), removing the machine would be... unfortunate. So the best way to overcome this problem is by scripting.
will return the status for a single service, so you could use this as a basis for a short script.