proxmox ansible bootstrapping

This commit is contained in:
plasmagoat 2025-06-07 19:41:15 +02:00
parent 2d1a363a50
commit bdf3bc6b02
20 changed files with 481 additions and 4 deletions

View file

@ -0,0 +1,57 @@
- name: Backup current /etc/network/interfaces before making changes
ansible.builtin.copy:
src: /etc/network/interfaces
dest: "/etc/network/interfaces.bak_ansible_{{ ansible_date_time.iso8601_basic }}"
remote_src: yes
owner: root
group: root
mode: "0644"
delegate_to: "{{ inventory_hostname }}" # Ensure this runs on the remote host
- name: Render and deploy /etc/network/interfaces from template
ansible.builtin.template:
src: interfaces.j2
dest: /etc/network/interfaces
owner: root
group: root
mode: "0644"
notify: Restart networking
# - name: Ensure network interfaces file exists
# ansible.builtin.copy:
# content: |
# source /etc/network/interfaces.d/*
# dest: /etc/network/interfaces
# owner: root
# group: root
# mode: '0644'
# - name: Configure bond0
# ansible.builtin.copy:
# content: |
# auto bond0
# iface bond0 inet manual
# bond-slaves eno1 eno2 # Replace with your actual interfaces
# bond-mode active-backup
# bond-miimon 100
# bond-primary eno1
# dest: /etc/network/interfaces.d/bond0
# owner: root
# group: root
# mode: '0644'
# notify: Restart networking
# - name: Configure vmbr0 using bond0
# ansible.builtin.copy:
# content: |
# auto vmbr0
# iface vmbr0 inet static
# address 192.168.1.10/24
# gateway 192.168.1.1
# bridge-ports bond0
# bridge-stp off
# bridge-fd 0
# dest: /etc/network/interfaces.d/vmbr0_bond
# owner: root
# group: root
# mode: '0644'
# notify: Restart networking