2024-05-14 10:40:33 +00:00
|
|
|
# choose a node for tasks that should only run on (any) one node, e.g. when writing to /etc/pve
|
2024-05-18 16:35:41 +00:00
|
|
|
- name: Select the primary node
|
2024-05-14 10:40:33 +00:00
|
|
|
set_fact:
|
2024-08-28 10:37:41 +00:00
|
|
|
is_primary: '{{ nodes is defined and inventory_hostname == (nodes | map(attribute="inventory_hostname") | sort | first) }}'
|
|
|
|
|
|
|
|
- name: Set hostname
|
|
|
|
hostname:
|
|
|
|
name: '{{ inventory_hostname }}'
|
|
|
|
|
|
|
|
- name: Set up hosts file
|
|
|
|
template:
|
|
|
|
dest: /etc/hosts
|
|
|
|
src: hosts.j2
|
|
|
|
|
|
|
|
- name: Set up resolv.conf
|
|
|
|
template:
|
|
|
|
dest: /etc/resolv.conf
|
|
|
|
src: resolv.conf.j2
|
|
|
|
mode: 0644
|
|
|
|
|
|
|
|
- include_tasks: network.yml
|
2024-05-14 10:40:33 +00:00
|
|
|
|
2023-07-14 12:17:44 +00:00
|
|
|
- name: Disable enterprise repositories
|
|
|
|
apt_repository:
|
|
|
|
repo: '{{ item }}'
|
|
|
|
state: absent
|
2024-08-28 10:37:41 +00:00
|
|
|
update_cache: no
|
2023-07-14 12:17:44 +00:00
|
|
|
loop:
|
|
|
|
- 'deb https://enterprise.proxmox.com/debian/pve {{ ansible_distribution_release }} pve-enterprise'
|
|
|
|
- 'deb https://enterprise.proxmox.com/debian/ceph-quincy {{ ansible_distribution_release }} enterprise'
|
2024-08-28 10:37:41 +00:00
|
|
|
notify: update package cache
|
2023-07-14 12:17:44 +00:00
|
|
|
|
|
|
|
- name: Enable no-subscription repository
|
|
|
|
apt_repository:
|
|
|
|
repo: 'deb http://download.proxmox.com/debian/pve {{ ansible_distribution_release }} pve-no-subscription'
|
2024-08-28 10:37:41 +00:00
|
|
|
update_cache: no
|
|
|
|
notify: update package cache
|
|
|
|
|
|
|
|
- meta: flush_handlers
|
|
|
|
|
|
|
|
- name: Install essential packages
|
|
|
|
package:
|
|
|
|
name:
|
|
|
|
- git
|
|
|
|
- vim
|
|
|
|
- tmux
|
2023-07-14 12:17:44 +00:00
|
|
|
|
2024-04-05 07:26:06 +00:00
|
|
|
- name: Set up sysctls
|
|
|
|
copy:
|
|
|
|
dest: /etc/sysctl.d/local.conf
|
|
|
|
src: sysctl.conf
|
|
|
|
|
2024-09-04 14:54:47 +00:00
|
|
|
- name: Set domain for ACME certificate renewals
|
|
|
|
command:
|
|
|
|
cmd: 'pvenode config set --acme domains={{ interfaces | selectattr("name", "==", "lo")
|
|
|
|
| map(attribute="ip_addresses") | flatten | map(attribute="dns_name")
|
|
|
|
| sort | unique | join(";") }}'
|
|
|
|
changed_when: false # maybe write a proper check if certificate requests are ever ansibled
|
|
|
|
|
2024-09-10 08:11:13 +00:00
|
|
|
- name: Set SMTP relay
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/postfix/main.cf
|
|
|
|
regexp: '^relayhost ='
|
|
|
|
line: 'relayhost = {{ mail_relay }}'
|
|
|
|
notify: reload postfix
|
|
|
|
when: mail_relay is defined
|
|
|
|
|
2024-04-05 04:00:50 +00:00
|
|
|
- include_tasks: firewall.yml
|
|
|
|
|
2024-05-14 10:04:35 +00:00
|
|
|
- include_tasks: user.yml
|