Brad
Brad

Reputation: 163232

Append with cloud-init write_files

When using write_files with cloud-init, is it possible to append content? If so, how?

write_files: [
  {
    "path": "/home/user/some-file",
    "content": "\nLine to append!"
  }
]

Upvotes: 20

Views: 8779

Answers (2)

dangelsaurus
dangelsaurus

Reputation: 7532

per https://cloudinit.readthedocs.io/en/latest/topics/modules.html#write-files

write_files:
  - path: /home/user/some-file
    content: | 
       Line to append!
    append: true

Upvotes: 27

James Baxter
James Baxter

Reputation: 1246

It was not possible, but I added the functionality and raised a merge request which was subsequently approved.

The functionality is available from 18.5 onwards.

Upvotes: 20

Related Questions