-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathproxmox.yml
86 lines (72 loc) · 2.43 KB
/
proxmox.yml
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
---
- hosts: managed_servers
gather_facts: true
become: true
tasks:
- name: Test for Proxmox
stat:
path: /etc/pve
register: is_proxmox
- name: Fail if not Debian
fail:
msg: This Playbook is not intended for {{ hostvars[inventory_hostname].TYPE }} hosts
when: not hostvars[inventory_hostname].TYPE == "debian"
- name: Add the Proxmox VE repository
lineinfile:
path: /etc/apt/sources.list.d/pve-install-repo.list
line: deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription
create: yes
- name: Add the Proxmox VE repository key
ansible.builtin.get_url:
url: https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg
dest: /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg
mode: '0644'
- name: Update your repository and system
become: true
apt:
upgrade: full
update_cache: yes
register: needed_update
- name: reboot the machine if any packages were installed during update
ansible.builtin.reboot:
when: needed_update.changed
- name: Install the Proxmox VE packages
ansible.builtin.apt:
name:
- proxmox-ve
- postfix
- open-iscsi
- chrony
state: latest
register: packages_installed
- name: Remove the Debian Kernel
ansible.builtin.apt:
name:
- linux-image-amd64
- 'linux-image-6.1*'
state: absent
- name: update-grub if Proxmox VE package were just installed
shell: update-grub
when: packages_installed.changed
- name: Remove os-prober per Proxmox recomendation
ansible.builtin.apt:
name:
- os-prober
state: absent
- name: Fix enterprise repo to remove enterprise sub
ansible.builtin.replace:
path: /etc/apt/sources.list.d/pve-enterprise.list
regexp: '^deb'
replace: '#deb'
- name: Install bridge-utils package
apt:
name: bridge-utils
state: present
- name: Configure interfaces file to default setting with single Linux bridge enabled
template:
src: roles/pxeboot/templates/interfaces.j2
dest: /etc/network/interfaces
register: interfaces_file
- name: reboot the machine if interfaces file altered
ansible.builtin.reboot:
when: interfaces_file.changed