MaaS: Use Cloud-Init to automatically customize deployment process

I’m trying to do the following for a week with no luck! I’d like to create a MACVLAN during machine deployment process. I’ve already provided a code for this process using Cloud-Init syntax:

#cloud-config

write_files:
-   content: |
        #!/bin/bash

        sudo ip link add eth0 link enp0s3 type macvlan mode bridge
        sudo ifconfig eth0 up
    path: /tmp/macvlan.sh
    permissions: '777'
-   content: |
        [Unit]
        Description=macvlan setup service

        [Service]
        ExecStart=/etc/init.d/macvlan.sh

        [Install]
        WantedBy=multi-user.target
    path: /tmp/macvlan.service
    permissions: '777'

runcmd:
-   sudo mv /tmp/macvlan.sh /etc/init.d/macvlan.sh
-   sudo mv /tmp/macvlan.service /etc/systemd/system/macvlan.service
-   systemctl enable macvlan
-   systemctl start macvlan

So now I’d like to know how to use this code automatically during deployment process ? I know there is a way to manually use the code as the following:

maas $PROFILE machine deploy $SYSTEM_ID user_data=$(base64 ./import_key.sh)

But I want the MaaS to do it for all machines automatically (because I’m using Juju controller to deploy new machines and I can’t do it manually). If it is not possible to use Cloud-Init then is it possible to use Curtin? How?