cloudbase / cloudbase-init

Cross-platform instance initialization
http://openstack.org
Apache License 2.0
427 stars 150 forks source link

Implement cloud-config 'write_files' support #25

Closed ader1990 closed 4 years ago

ader1990 commented 4 years ago

Currently, cloud-config 'write_files' has partial support in cloudbase-init.

The following sub-features are not implemented:

Cloud-init docs for 'write_files': https://cloudinit.readthedocs.io/en/latest/topics/examples.html#writing-out-arbitrary-files

Example cloud-config userdata to be supported:

#cloud-config
write_files:
  -
    encoding: b64
    content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4
    owner: Administrator
    path: 'C:\\test_file'
    permissions: '0644'
  -
    content: "# Example ps1 file\necho 'test'\n"
    path: 'C:\\test_file.ps1'
  -
    encoding: gzip
    content: null
    path: 'C:\\test_binary'
    permissions: '0555'
  -
    content: "added to file\n"
    path: 'C:\\test_append'
    append: true

The key 'owner' will not be implemented on Windows, as there is of little use. The owner of the file will be LocalSystem or the user under which cloudbase-init service runs (defaults to cloudbase-init user, which is an Administrator).