From d0b8dfd16f12d0d3092893c534d4d3ecb15fab7a Mon Sep 17 00:00:00 2001 From: rasmus Date: Sat, 2 Aug 2025 15:57:42 +0300 Subject: [PATCH] pve init --- inventory.yaml | 16 ++++++++-------- proxmox/general.yaml | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 proxmox/general.yaml diff --git a/inventory.yaml b/inventory.yaml index e0fd3db..ff5c9e2 100644 --- a/inventory.yaml +++ b/inventory.yaml @@ -38,21 +38,21 @@ all: # https://wiki.k-space.ee/hosting/proxmox proxmox: hosts: - pve1: + pve1.proxmox.infra.k-space.ee: ansible_host: 172.21.20.1 - pve2: + pve2.proxmox.infra.k-space.ee: ansible_host: 172.21.20.2 - pve8: + pve8.proxmox.infra.k-space.ee: ansible_host: 172.21.20.8 - pve9: + pve9.proxmox.infra.k-space.ee: ansible_host: 172.21.20.9 - pve90: + pve90.proxmox.infra.k-space.ee: ansible_host: 172.21.20.90 - pve91: + pve91.proxmox.infra.k-space.ee: ansible_host: 172.21.20.91 - pve92: + pve92.proxmox.infra.k-space.ee: ansible_host: 172.21.20.92 - pve93: + pve93.proxmox.infra.k-space.ee: ansible_host: 172.21.20.93 bgp: children: diff --git a/proxmox/general.yaml b/proxmox/general.yaml new file mode 100644 index 0000000..3c6d24a --- /dev/null +++ b/proxmox/general.yaml @@ -0,0 +1,27 @@ +--- +- name: PVE base configuration + hosts: proxmox + tasks: + - name: Generate ipid + set_fact: + new_fact: "{{ inventory_hostname | regex_replace('pve', '') }}" + + - name: UI primary IP (/etc/hosts) + tags: network + ansible.builtin.lineinfile: + path: /etc/hosts + regexp: ' {{ inventory_hostname_short }}$' + line: '2001:bb8:4008:21:20::{{ ipid }} {{ inventory_hostname }} {{ inventory_hostname_short }}' + + - name: /etc/network/interfaces + tags: network + ansible.builtin.template: + src: templates/network.interfaces.j2 + dest: /etc/network/interfaces + notify: reload networking + + handlers: + - name: reload networking + ansible.builtin.systemd_service: + name: networking.service + state: reloaded