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:


-   content: |

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


    path: /tmp/macvlan.service
    permissions: '777'

-   sudo mv /tmp/ /etc/init.d/
-   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 ./

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?