Cloud config not working at all with APIv2 on Ubuntu 18.04

July 14, 2019 237 views
Configuration Management Ubuntu 18.04

Cloud config is not working at all from the command line with APIv2 on Ubuntu 18.04. Anyone experience this? Even this simple script doesn’t work:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $MY_TOKEN" -d '{
        "name": "myserver", 
        "region": "sfo2", 
        "size": "s-1vcpu-1gb", 
        "image": "ubuntu-18-04-x64",
        "ssh_keys": ["XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX"],
        "user_data": "#cloud-config 
            write_files:
              - content |
                  This is a test file
                path: /etc/cloud-config-test
                permissions: '0600'
                owner: root:root"
}' "https://api.digitalocean.com/v2/droplets"

At first glance, examining /var/log/cloud-init.log, and /var/log/cloud-init-output.log, reveals nothing about the ‘user-data:#cloud-config’ entry in my APIv2 POST. Due to their size I left them out. I would be happy to share them if needed.

Thanks

1 comment
  • Running the same script below from the GUI does work, but from the command line in an http request as shown above it does not.

    
    #cloud-config
    write_files:
      - path: /etc/cloud-config-test
        permissions: '0600'
        owner: root:root
        content: |
            This is a test file.
    

    Thanks

Be the first one to answer this question.