Append with cloud-init write_files
Asked Answered
P

2

17

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!"
  }
]
Payne answered 28/11, 2018 at 23:13 Comment(0)
C
24

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
Culpable answered 26/1, 2020 at 4:19 Comment(0)
F
20

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.

Fisherman answered 2/12, 2018 at 11:14 Comment(2)
Awesome! Thanks. Looking forward to using the change in the future.Payne
I think the functionality as been released already since the link says merged to master on 2018-12-06 ? It would be good if you can edit your answer as the documentation seems not up to dateOver

© 2022 - 2024 — McMap. All rights reserved.