Added conditional repo config to pve-subscribe

This commit introduces a new inventory host variable:
 pve_enterprise=False
If set to True, apt sources and environment on the target is configured for
subscribed operation. If set to False annoying "subscribe me" popups are
disabled and apt sources are configured to the no-subscription
repositorys. The default value is False.

Proxmox's default state after installation is similar to
pve_enterprise=True.

This Role must be called before first apt call.
This commit is contained in:
Jan 2019-01-05 22:52:41 +01:00
parent e916da0667
commit 17eac6723b
6 changed files with 42 additions and 8 deletions

View File

@ -0,0 +1 @@
deb https://enterprise.proxmox.com/debian/pve stretch pve-enterprise

View File

@ -0,0 +1 @@
deb http://download.proxmox.com/debian stretch pve-no-subscription

View File

@ -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

View File

@ -1,10 +1,9 @@
--- ---
- name: Installing pve-subscribe script - name: Configuring pve for unsubscribed operation
copy: src=pve-subscribe dest=/usr/local/bin/pve-subscribe mode=0755 owner=root import_tasks: no-subscription.yml
when: pve_enterprise | default(False) != True
- name: Configuring cron to run pve-subscribe hook after reboot - name: Configuring pve for licensed operation
cron: name=pve-subscribe special_time=reboot job=/etc/cron.d/pve-subscribe import_tasks: enterprise.yml
when: pve_enterprise | default(False) == True
- name: Configuring apt to run pve-subscribe hook
copy: src=apt-pve-subscribe dest=/etc/apt/apt.conf.d/99pve-subscribe mode=0644

View File

@ -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

View File

@ -3,5 +3,5 @@
- name: Setup VM hosts - name: Setup VM hosts
hosts: all hosts: all
roles: roles:
- vmhost
- pve-subscribe - pve-subscribe
- vmhost