bashcloud-initipmimaas

cloud-init runcmd (using MAAS)


I'm unable to run bash scripts in "runcmd:" that aren't inline.

runcmd:
    - [ bash, -c, echo "=========hello world=========" >>foo1.bar ]
    - [ bash, -c, echo "=========hello world=========" >>foo2.bar ]
    - [ bash, -c, /usr/local/bin/foo.sh ]

The first two lines are successfully run on the deployed Ubuntu instance. However, the foo.sh doesn't seem to run.

Here is /usr/local/bin/foo.sh:

#!/bin/bash
echo "=========hello world=========" >>foosh.bar

foo.sh has executable permissions for root and resides on the MAAS server.

I've looked at the following but they don't seem to sort out my issue:


Solution

  • Anything you run using runcmd must already exist on the filesystem. There is no provision for automatically fetching something from a remote host.

    You have several options for getting files there. Two that come to mind immediately are: