Ubuntu – Can juju add-machine be used to prepare a machine for service deployment

juju

I'm using juju 1.16.3 and I am attempting to use juju add-machine to get a MaaS node ready for a service deployment. I want to get Ubuntu installed and ready so service deployment takes less time. The machine is started and the OS installed, and the agent-state is "started". However, when I deploy a service, it decideds to start a new machine anyway and ignores the one already started.

When I deploy the service without doing add-machine beforehand, then a new machine is automatically allocated from MaaS and the service deploys to it just fine. The ONLY difference is that when I do juju add-machine prior to deploying the service, it won't deploy to that machine.

Am I misunderstanding the purpose of add-machine? If so, what is the proper method for preparing a machine with a base OS prior to service deployment?

Best Answer

If you're using constraints at all, I think you've hit a consequence of this bug -- none of the existing machines will be matched.

You can work around it with the --to parameter to deploy or add-unit:

$ juju deploy mysql --to 3
$ juju add-unit mysql --to 4
Related Question