Need help with cloud init

Hi all,

I am new to this field. I am trying to install ansible, clone the git repo which holds a
playbook and run the playbooks through cloud-init user data script on ubuntu host deploy through maas. I also want to know how I can automate the API calls for a new machine provisioning.

It would be great if someone could provide a raw yml script to understand the process.

Thank you!


  1. the usual way to run a playbook is during deployment is through curtin. Any reason for doing it through cloud-init?
  2. the CLI is just a wrapper for the MAAS REST API, so any operation you can do through the CLI can be automated by an external agent calling the API.

You can use curtin write_files to write your script to a file in the host, and then use late_commands to execute this script.

    path: /root/
    content: |
      echo blabla
      ... very long bash script
    permissions: '0755'

  00-cmd: ["curtin", "in-target", "--", "/bin/bash", "/root/"]


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.