docs: Add granular Proxmox API token permissions to README and fix inventory file paths in LXC playbooks.
This commit is contained in:
@@ -36,7 +36,10 @@ ansible-galaxy collection install community.general
|
|||||||
2. **Create Token**: Go to **API Tokens**, add a token for `ansible@pve` (e.g., `ansible-token`). **Save the Secret!**
|
2. **Create Token**: Go to **API Tokens**, add a token for `ansible@pve` (e.g., `ansible-token`). **Save the Secret!**
|
||||||
3. **Permissions**: Go to **Permissions**, add User Permission for `ansible@pve`:
|
3. **Permissions**: Go to **Permissions**, add User Permission for `ansible@pve`:
|
||||||
- Path: `/`
|
- Path: `/`
|
||||||
- Role: `Administrator` (or a custom role with VM/CT creation privileges).
|
- Role: `Administrator` (Easiest)
|
||||||
|
- **OR** Granular Roles:
|
||||||
|
- Path: `/` -> `PVEVMAdmin` + `Sys.Audit`
|
||||||
|
- Path: `/storage/local` (or your storage ID) -> `Datastore.AllocateSpace` + `Datastore.Audit`
|
||||||
|
|
||||||
### 3. Configure Secrets
|
### 3. Configure Secrets
|
||||||
Update your `secrets.yml` (do not commit this file!) with the credentials:
|
Update your `secrets.yml` (do not commit this file!) with the credentials:
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
- name: Add new host to local hosts.ini file (persistency)
|
- name: Add new host to local hosts.ini file (persistency)
|
||||||
ansible.builtin.blockinfile:
|
ansible.builtin.blockinfile:
|
||||||
path: "{{ inventory_dir }}/hosts.ini"
|
path: "{{ playbook_dir }}/../inventory/hosts.ini"
|
||||||
block: |
|
block: |
|
||||||
{{ container_name }} ansible_host={{ container_ip_cidr | split('/') | first }} ansible_user=root
|
{{ container_name }} ansible_host={{ container_ip_cidr | split('/') | first }} ansible_user=root
|
||||||
insertafter: "^\\[new\\]"
|
insertafter: "^\\[new\\]"
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Remove host from the [new] group
|
- name: Remove host from the [new] group
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ inventory_dir }}/hosts.ini"
|
path: "{{ playbook_dir }}/../inventory/hosts.ini"
|
||||||
regexp: "^{{ item }}\\s" # Match the start of the line with the hostname
|
regexp: "^{{ item }}\\s" # Match the start of the line with the hostname
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ groups['new'] }}" # Loop over all hosts in the 'new' group
|
loop: "{{ groups['new'] }}" # Loop over all hosts in the 'new' group
|
||||||
|
|||||||
Reference in New Issue
Block a user