diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-06-22 12:35:05 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-06-22 12:35:05 +0200 |
| commit | f4977c88f9bef271fdb7f4e972c2a6dfa8124d33 (patch) | |
| tree | 8d6b3d8db06a7f86f1874efd0b8b6fc9cd9f0acb /roles/pve/tasks | |
| parent | a270d065688b4f78047708f32322a5b96312e8fa (diff) | |
Rename proxmox-ve role to pve
Diffstat (limited to 'roles/pve/tasks')
| -rw-r--r-- | roles/pve/tasks/main.yml | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/roles/pve/tasks/main.yml b/roles/pve/tasks/main.yml new file mode 100644 index 00000000..f58f62db --- /dev/null +++ b/roles/pve/tasks/main.yml @@ -0,0 +1,89 @@ +--- +- name: "Install proxmox-ve" + become: true + ansible.builtin.apt: + name: "proxmox-ve" + state: "present" + update_cache: true + tags: + # Since proxmox-ve package setups network and configure grub/kernel hooks which doesn't work in containers + - "molecule-notest" + +- name: "Configure Proxmox repos" + become: true + when: pve_repo == "no-subscription" + block: + - name: "Configure no-subscription repos" + ansible.builtin.apt_repository: + repo: "deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription" + state: "present" + filename: "pve-no-subscription" + mode: "0644" + + - name: "Remove Proxmox enterprise repo" + become: true + ansible.builtin.file: + path: "/etc/apt/sources.list.d/pve-enterprise.list" + state: "absent" + + - name: "Ensure sources.list is world-readable" + become: true + ansible.builtin.file: + path: "/etc/apt/sources.list" + mode: "0644" + tags: + - molecule-notest + +- name: "Set management IP in /etc/hosts for PVE cert generation" + become: true + ansible.builtin.lineinfile: + path: "/etc/hosts" + regexp: "^{{ network_ipv4_address }}" + line: "{{ network_ipv4_address }} {{ ansible_facts['hostname'] }}" + state: present + notify: "Restart pveproxy" + tags: + # Since container doesn't have network ip address, skipping this test + - "molecule-notest" + +- name: "Create PVE admin user" + become: true + ansible.builtin.command: + cmd: "pveum user add {{ pve_admin_user }}@pve" + register: pveum_user_add + changed_when: pveum_user_add.rc == 0 + failed_when: pveum_user_add.rc != 0 and 'already exists' not in pveum_user_add.stderr + tags: + - "molecule-notest" + +- name: "Set PVE admin user password" + become: true + no_log: true + ansible.builtin.command: + cmd: "pveum passwd {{ pve_admin_user }}@pve --password {{ pve_admin_password }}" + changed_when: true + tags: + - "molecule-notest" + +- name: "Grant PVE Administrator role" + become: true + ansible.builtin.command: + cmd: "pveum acl modify / --roles Administrator --users {{ pve_admin_user }}@pve" + changed_when: true + tags: + - "molecule-notest" + +- name: "Enable and start Proxmox VE services" + become: true + ansible.builtin.systemd_service: + name: "{{ item }}" + enabled: true + state: "started" + loop: + - "pve-cluster" + - "pvedaemon" + - "pveproxy" + - "pvestatd" + tags: + # Since proxmox-ve package was ignored from testing, we need to ignore this too + - "molecule-notest" |
