diff --git a/environments/prod/group_vars/gluster_nodes/mounts.yml b/environments/prod/group_vars/gluster_nodes/mounts.yml index 5c6fd10..51e260e 100644 --- a/environments/prod/group_vars/gluster_nodes/mounts.yml +++ b/environments/prod/group_vars/gluster_nodes/mounts.yml @@ -3,5 +3,6 @@ gluster_tls_certificate_validity_days: 7300 gluster_volume_mounts: - k8s-services + - k8s-services-db - k8s-monitoring - k8s-nvr diff --git a/environments/prod/host_vars/pve1.yml b/environments/prod/host_vars/pve1.yml index bcb8b95..ff4d52a 100644 --- a/environments/prod/host_vars/pve1.yml +++ b/environments/prod/host_vars/pve1.yml @@ -24,7 +24,7 @@ pve_vm_machines: shutdown_timeout_seconds: 120 nic_bridge: vmbr0 os_storage: local-zfs - os_disk_size: 128 + os_disk_size: 128G cpu_type: "cputype=host,flags=+aes" cpu_count: 2 cpu_cores_per_cpu: 20 diff --git a/playbooks/proxmox.yml b/playbooks/proxmox.yml index 29f5a78..23bbc39 100644 --- a/playbooks/proxmox.yml +++ b/playbooks/proxmox.yml @@ -71,6 +71,14 @@ name: homecentr.system.zfs_configuration tags: [ usbhid-quirk ] + - name: Configure local storage + ansible.builtin.import_role: + name: homecentr.proxmox.pve_local_storage + tags: [ vm, pve-storage ] + vars: + pve_local_storage_api_user: root@pam + pve_local_storage_api_password: "{{ users_root_password }}" + - name: Flush handlers before starting the VMs ansible.builtin.meta: flush_handlers diff --git a/roles/pve_virtual_machines/tasks/main.yml b/roles/pve_virtual_machines/tasks/main.yml index e847f1b..353458f 100644 --- a/roles/pve_virtual_machines/tasks/main.yml +++ b/roles/pve_virtual_machines/tasks/main.yml @@ -3,10 +3,6 @@ name: python3-proxmoxer state: present -- name: Enable snippets in local storage - ansible.builtin.include_tasks: - file: snippets.yml - - name: Download installation cloud images ansible.builtin.include_tasks: file: images.yml diff --git a/roles/pve_virtual_machines/tasks/snippets.yml b/roles/pve_virtual_machines/tasks/snippets.yml deleted file mode 100644 index 7f16ca0..0000000 --- a/roles/pve_virtual_machines/tasks/snippets.yml +++ /dev/null @@ -1,25 +0,0 @@ -- name: Get local storage info - community.general.proxmox_storage_info: - api_user: root@pam - api_password: "{{ users_root_password }}" - api_host: 127.0.0.1 - name: local - register: pve_virtual_machines_local_storage - -- name: Update config - when: not 'snippets' in pve_virtual_machines_local_storage.proxmox_storages[0].content - ansible.builtin.lineinfile: - path: /etc/pve/storage.cfg - create: false - firstmatch: true - insertafter: "^\\W*dir:\\W*local$" - regex: "^\\W*content\\W*(.*)$" - line: " content {{ (pve_virtual_machines_local_storage.proxmox_storages[0].content + ['snippets']) | join(',') }}" - -- name: Create snippets directory - ansible.builtin.file: - path: "{{ pve_virtual_machines_local_storage.proxmox_storages[0].path }}/snippets" - state: directory - owner: root - group: root - mode: 0750 diff --git a/roles/pve_virtual_machines/tasks/vm.yml b/roles/pve_virtual_machines/tasks/vm.yml index 36003bb..5d64fb4 100644 --- a/roles/pve_virtual_machines/tasks/vm.yml +++ b/roles/pve_virtual_machines/tasks/vm.yml @@ -1,6 +1,6 @@ - name: Create cloud-init config ansible.builtin.copy: - dest: "{{ pve_virtual_machines_local_storage.proxmox_storages[0].path }}/snippets/{{ vm.vmid }}.yml" + dest: "{{ hostvars[inventory_hostname].pve_local_storage_path }}/snippets/{{ vm.vmid }}.yml" owner: root group: root mode: 0640