blob: 39998cb74dba546cb3496827abd1c5f6f158c711 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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: pve_user_add
changed_when: pve_user_add.rc == 0
failed_when: pve_user_add.rc != 0 and 'already exists' not in pve_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"
|