From d44201be7c03af7ed01fe9240f2e644356c1b886 Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Wed, 6 Apr 2022 12:06:01 +0200 Subject: [PATCH] added playbook debian-to-pbs --- debian-to-pbs.yml | 11 +++++++++++ tasks/debian-general/hostname.yml | 4 ++++ tasks/debian-general/hosts-file.yml | 8 ++++++++ tasks/debian-general/resolv-conf.yml | 5 +++++ tasks/debian-to-pbs/pbs-server.yml | 8 ++++++++ tasks/debian-to-pbs/repositories.yml | 15 +++++++++++++++ 6 files changed, 51 insertions(+) create mode 100644 debian-to-pbs.yml create mode 100644 tasks/debian-general/hostname.yml create mode 100644 tasks/debian-general/hosts-file.yml create mode 100644 tasks/debian-general/resolv-conf.yml create mode 100644 tasks/debian-to-pbs/pbs-server.yml create mode 100644 tasks/debian-to-pbs/repositories.yml diff --git a/debian-to-pbs.yml b/debian-to-pbs.yml new file mode 100644 index 0000000..6b4c9d2 --- /dev/null +++ b/debian-to-pbs.yml @@ -0,0 +1,11 @@ +--- +- hosts: all + become: true + tasks: + - import_tasks: tasks/debian-general/hostname.yml + - import_tasks: tasks/debian-general/resolv-conf.yml + - import_tasks: tasks/debian-general/hosts-file.yml + - import_tasks: tasks/debian-general/repositories-bullseye.yml + - import_tasks: tasks/debian-to-pbs/repositories.yml + - import_tasks: tasks/debian-general/upgrade.yml + - import_tasks: tasks/debian-to-pbs/pbs-server.yml diff --git a/tasks/debian-general/hostname.yml b/tasks/debian-general/hostname.yml new file mode 100644 index 0000000..430a018 --- /dev/null +++ b/tasks/debian-general/hostname.yml @@ -0,0 +1,4 @@ +--- +- name: Ensure hostname is set + ansible.builtin.hostname: + name: "{{ HOSTNAME_SHORT }}" diff --git a/tasks/debian-general/hosts-file.yml b/tasks/debian-general/hosts-file.yml new file mode 100644 index 0000000..130c7a6 --- /dev/null +++ b/tasks/debian-general/hosts-file.yml @@ -0,0 +1,8 @@ +--- +- name: Ensure the hosts file is properly configured + ansible.builtin.copy: + dest: /etc/hosts + content: | + 127.0.0.1 localhost.localdomain localhost + ::1 localhost.localdomain localhost + {{ PUBLIC_IP }} {{ HOSTNAME }} {{ HOSTNAME_SHORT }} diff --git a/tasks/debian-general/resolv-conf.yml b/tasks/debian-general/resolv-conf.yml new file mode 100644 index 0000000..a7880c3 --- /dev/null +++ b/tasks/debian-general/resolv-conf.yml @@ -0,0 +1,5 @@ +--- +- name: Ensure /etc/resolv.conf is correct + ansible.builtin.copy: + dest: /etc/resolv.conf + content: "nameserver 1.1.1.1\nnameserver 1.0.0.1" diff --git a/tasks/debian-to-pbs/pbs-server.yml b/tasks/debian-to-pbs/pbs-server.yml new file mode 100644 index 0000000..21aa787 --- /dev/null +++ b/tasks/debian-to-pbs/pbs-server.yml @@ -0,0 +1,8 @@ +--- +- import_tasks: ../debian-general/update.yml +- name: Ensure PBS is installed and updated + ansible.builtin.apt: + update_cache: yes + cache_valid_time: 0 + name: proxmox-backup + state: latest diff --git a/tasks/debian-to-pbs/repositories.yml b/tasks/debian-to-pbs/repositories.yml new file mode 100644 index 0000000..3a983b7 --- /dev/null +++ b/tasks/debian-to-pbs/repositories.yml @@ -0,0 +1,15 @@ +--- +- name: Ensure the PBS Enterprise respository is disabled + ansible.builtin.copy: + dest: /etc/apt/sources.list.d/pbs-enterprise.list + content: | + #deb https://enterprise.proxmox.com/debian/pbs bullseye pbs-enterprise +- name: Ensure the correct Proxmox repositories are in place + ansible.builtin.copy: + dest: /etc/apt/sources.list.d/pbs-no-subscription.list + content: | + deb http://download.proxmox.com/debian/pbs bullseye pbs-no-subscription +- name: Ensure the Proxmox signing GPG key is present + ansible.builtin.get_url: + dest: /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg + url: https://enterprise.proxmox.com/debian/proxmox-release-bullseye.gpg