Programmatic configuration via Ansible?

gstrong

New Member
Sep 24, 2023
6
0
1
I'm trying to keep my configuration of proxmox in code and versioned, so I'm using Ansible for reproducibility.

I configured my proxmox box to have another non-root user for the purposes of SSH and running ansible, added with `useradd`, and has a /home/foo/.ssh dir with authorized_keys; root login is not permitted via SSH. I also added foo to the www-data group so it would at least have read access to the files found in /etc/pve. I'm trying to render a new storage.cfg file to /etc/pve/storage.cfg, but obviously the permissions are preventing me from doing so. At this point I know I can hack up the permissions to make this work, but I'm thinking there has to be a more canonical way to do this.

I do not want to use the cli tools, generally this breaks a lot of the Ansible idempotency.

What is the recommended manner to go about this? If I do edit the files directly, what are the issues with that approach? After changing a config file, how is it reloaded?
 
What is the recommended manner to go about this?
doing it as root.

If I do edit the files directly, what are the issues with that approach?
Potentially break it if there is some kind of syntax error.

After changing a config file, how is it reloaded?
VM/LX(C) have to be restarted, all other should be instantanious (haven't tried all of them, yet edited them programmatically and they do all work).