diff --git a/roles/pve-subscribe/files/pve-enterprise.list b/roles/pve-subscribe/files/pve-enterprise.list new file mode 100644 index 0000000..27c0fbc --- /dev/null +++ b/roles/pve-subscribe/files/pve-enterprise.list @@ -0,0 +1 @@ +deb https://enterprise.proxmox.com/debian/pve stretch pve-enterprise diff --git a/roles/pve-subscribe/files/pve-no-subscription.list b/roles/pve-subscribe/files/pve-no-subscription.list new file mode 100644 index 0000000..5c1ddaa --- /dev/null +++ b/roles/pve-subscribe/files/pve-no-subscription.list @@ -0,0 +1 @@ +deb http://download.proxmox.com/debian stretch pve-no-subscription diff --git a/roles/pve-subscribe/tasks/enterprise.yml b/roles/pve-subscribe/tasks/enterprise.yml new file mode 100644 index 0000000..0c593f1 --- /dev/null +++ b/roles/pve-subscribe/tasks/enterprise.yml @@ -0,0 +1,17 @@ +--- + +- name: Unset no-subscription repo + file: path=/etc/apt/sources.list.d/pve-no-subscription.list state=absent + +- name: Configuring enterprise repo + copy: src=pve-enterprise.list dest=/etc/apt/sources.list.d/pve-enterprise.list + +- name: Removing previously installed pve-subscribe hook for cron + cron: name=pve-subscribe special_time=reboot job=/etc/cron.d/pve-subscribe state=absent + +- name: Removing previously installed pve-subscribe hook for apt + file: path=/etc/apt/apt.conf.d/99pve-subscribe state=absent + +- name: Removing previously installed pve-subscribe script + file: path=/usr/local/bin/pve-subscribe state=absent + diff --git a/roles/pve-subscribe/tasks/main.yml b/roles/pve-subscribe/tasks/main.yml index babad5b..9f1452f 100644 --- a/roles/pve-subscribe/tasks/main.yml +++ b/roles/pve-subscribe/tasks/main.yml @@ -1,10 +1,9 @@ --- -- name: Installing pve-subscribe script - copy: src=pve-subscribe dest=/usr/local/bin/pve-subscribe mode=0755 owner=root +- name: Configuring pve for unsubscribed operation + import_tasks: no-subscription.yml + when: pve_enterprise | default(False) != True -- name: Configuring cron to run pve-subscribe hook after reboot - cron: name=pve-subscribe special_time=reboot job=/etc/cron.d/pve-subscribe - -- name: Configuring apt to run pve-subscribe hook - copy: src=apt-pve-subscribe dest=/etc/apt/apt.conf.d/99pve-subscribe mode=0644 +- name: Configuring pve for licensed operation + import_tasks: enterprise.yml + when: pve_enterprise | default(False) == True diff --git a/roles/pve-subscribe/tasks/no-subscription.yml b/roles/pve-subscribe/tasks/no-subscription.yml new file mode 100644 index 0000000..98f7613 --- /dev/null +++ b/roles/pve-subscribe/tasks/no-subscription.yml @@ -0,0 +1,16 @@ +--- + +- name: Unset enterprise repo + file: path=/etc/apt/sources.list.d/pve-enterprise.list state=absent + +- name: Configuring no-subscription repo + copy: src=pve-no-subscription.list dest=/etc/apt/sources.list.d/pve-no-subscription.list + +- name: Installing pve-subscribe script + copy: src=pve-subscribe dest=/usr/local/bin/pve-subscribe mode=0755 owner=root + +- name: Configuring cron to run pve-subscribe hook after reboot + cron: name=pve-subscribe special_time=reboot job=/etc/cron.d/pve-subscribe + +- name: Configuring apt to run pve-subscribe hook + copy: src=apt-pve-subscribe dest=/etc/apt/apt.conf.d/99pve-subscribe mode=0644 diff --git a/site.yml b/site.yml index 261b373..f6f0f0a 100644 --- a/site.yml +++ b/site.yml @@ -3,5 +3,5 @@ - name: Setup VM hosts hosts: all roles: - - vmhost - pve-subscribe + - vmhost