proxmox ansible bootstrapping
This commit is contained in:
parent
2d1a363a50
commit
bdf3bc6b02
20 changed files with 481 additions and 4 deletions
14
roles/proxmox_setup/handlers/main.yml
Normal file
14
roles/proxmox_setup/handlers/main.yml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
- name: Restart networking
|
||||
ansible.builtin.service:
|
||||
name: networking
|
||||
state: restarted
|
||||
|
||||
- name: Restart systemd-resolved
|
||||
ansible.builtin.service:
|
||||
name: systemd-resolved
|
||||
state: restarted
|
||||
|
||||
- name: Restart pveproxy
|
||||
ansible.builtin.service:
|
||||
name: pveproxy
|
||||
state: restarted
|
||||
82
roles/proxmox_setup/tasks/main.yml
Normal file
82
roles/proxmox_setup/tasks/main.yml
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
- name: Remove enterprise repository
|
||||
ansible.builtin.apt_repository:
|
||||
update_cache: false
|
||||
repo: deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise
|
||||
state: absent
|
||||
when: not proxmox_enterprise_repo_enabled
|
||||
|
||||
- name: Remove enterprise pbs repository
|
||||
ansible.builtin.apt_repository:
|
||||
update_cache: false
|
||||
repo: deb https://enterprise.proxmox.com/debian/pbs bookworm InRelease
|
||||
state: absent
|
||||
when: not proxmox_enterprise_repo_enabled
|
||||
|
||||
- name: Remove enterprise ceph repository
|
||||
ansible.builtin.apt_repository:
|
||||
update_cache: false
|
||||
repo: deb https://enterprise.proxmox.com/debian/ceph-quincy bookworm enterprise
|
||||
state: absent
|
||||
when: not proxmox_enterprise_repo_enabled
|
||||
|
||||
- name: Add community repository
|
||||
ansible.builtin.apt_repository:
|
||||
update_cache: true
|
||||
repo: deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription
|
||||
state: present
|
||||
when: proxmox_no_subscription_repo_enabled
|
||||
|
||||
- name: Update apt cache after repo changes
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Ensure Proxmox VE packages are up-to-date
|
||||
ansible.builtin.apt:
|
||||
name: proxmox-ve
|
||||
state: latest
|
||||
update_cache: yes
|
||||
|
||||
- name: Install common Proxmox tools
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- proxmox-backup-client
|
||||
- smartmontools
|
||||
- zfsutils-linux
|
||||
state: present
|
||||
# Example: Configure network bridge if not already done (adjust for your network)
|
||||
# - name: Configure network bridge vmbr0
|
||||
# ansible.builtin.copy:
|
||||
# content: |
|
||||
# auto vmbr0
|
||||
# iface vmbr0 inet static
|
||||
# address 192.168.1.10/24
|
||||
# gateway 192.168.1.1
|
||||
# bridge-ports eno1 # Replace eno1 with your actual physical interface
|
||||
# bridge-stp off
|
||||
# bridge-fd 0
|
||||
# dest: /etc/network/interfaces.d/vmbr0
|
||||
# owner: root
|
||||
# group: root
|
||||
# mode: '0644'
|
||||
# notify: Restart networking
|
||||
|
||||
# Example: Configure DNS (optional, Proxmox sets up systemd-resolved by default)
|
||||
# - name: Configure /etc/resolv.conf
|
||||
# ansible.builtin.copy:
|
||||
# content: |
|
||||
# nameserver 1.1.1.1
|
||||
# nameserver 8.8.8.8
|
||||
# dest: /etc/resolv.conf
|
||||
# owner: root
|
||||
# group: root
|
||||
# mode: '0644'
|
||||
# notify: Restart systemd-resolved # if using systemd-resolved
|
||||
|
||||
# - name: Disable subscription nag (optional, for no-subscription users)
|
||||
# ansible.builtin.replace:
|
||||
# path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
|
||||
# regexp: '^(.*)Ext\.Msg\.show\(\{(.*)$\n^(.*)No valid subscription(.*)$'
|
||||
# replace: '\1void({\2\n\3No valid subscription\4'
|
||||
# when: not proxmox_enterprise_repo_enabled
|
||||
# notify: Restart pveproxy
|
||||
Loading…
Add table
Add a link
Reference in a new issue