Hi,
I've been struggling getting cloudinit to write out multiple files on a Windows guest. I followed practically every example I've found on the web and whatever I do cloud init will only write out one file, it ignores the rest. The syntax is in the blueprint YAML and looks something like this.
cloudConfig: |
write_files:
-path c:\sources\Configure.PS1
content: |
Powershell written here
-path c:\sources\Configure-another-thing.PS1
content: |
Powershell written here.
Whatever indentation and order I have tried only writes the first or last file. I previously had the path at the end of the content section. This then writes out only the last file. Never both files. I've tried all the syntax examples I've found across the web to no avail!
Anyone written out multiple files on Windows Guests with vRA 8.1 Blueprints?
Cheers
Having same issue with 8.4
cloudConfig: |
write_files:
- content: |
Powershell1 written here
path c:\sources\Configure.PS1
- content: |
Powershell2 written here.
path c:\sources\Configure-another-thing.PS1
Thanks
I'll try, but it didn't work 3 days ago 😀
It worked.
https://cloudinit.readthedocs.io/en/latest/topics/modules.html#write-files
I had tested (not working)
writefiles:
content: |
test 1
path: C:\dl\file 1.ps1
content: |
test 2
path: C:\dl\file 2.ps1
But changing to (worked)
writefiles:
- content: |
test 1
path: C:\dl\file 1.ps1
- content: |
test 2
path: C:\dl\file 2.ps1
like my suggestion. 🙂
first content with a dash and then path without a dash.
You say that the readthecods.io link example did not work, but I think you did not follow it correctly.
As far as I see, it does contain the working example:
write_files:
- content: |
15 * * * * root ship_logs
path: /etc/crontab
append: true
Link worked. just not placed optimal in text 😀