Skip to content

Instantly share code, notes, and snippets.

@bgulla
Created January 13, 2020 17:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgulla/b1849ace6b1b123ef8550f958fd0f607 to your computer and use it in GitHub Desktop.
Save bgulla/b1849ace6b1b123ef8550f958fd0f607 to your computer and use it in GitHub Desktop.
Ansible-playbook to customize Proxmox installs
# _ _
# _ ____ _____ _ __ __ _| |_ ___| |__
# | '_ \ \ / / _ \_____| '_ \ / _` | __/ __| '_ \
# | |_) \ V / __/_____| |_) | (_| | || (__| | | |
# | .__/ \_/ \___| | .__/ \__,_|\__\___|_| |_|
# |_| |_|
#############
# TODO
# Generate Images (/usr/share/pve-patch/images/)
#############
# Can I test this with Vagrant? Can I vagrant up PromoxMox?
## /usr/share/pve-manager/images/ only copy the images if it doesnt exist
# intall gimp
# TODO: Make backup directory (/opt/pve-backup/{repos,images})
#- name: PROXMOX |
#- name: PROXMOX | create the backup directory
# file:
# path: /opt/pve-backup
# state: directory
# mode: '0755'
## generate images
## NOTE, if we generate, we need to figure out how to reference the hostname
#### of the slave box in the filename so we can run this across multiple agents.
##### inventoryfile variables should work here
# TODO: enable real vertificates? do i need to generate first?
# TODO:
- name: PROXMOX | enable qcow on local-lvm
command: sed "s/content vztmpl,iso,backup/content vztmpl,images,iso,backup/g" /etc/pve/storage.cfg
## TODO: image logo-128.png
- name: PROXMOX | image copy logo-128.png
copy:
src: files/logo-128.png
dest: /usr/share/pve-manager/images/logo-128.png
## TODO: image favicon.png
- name: PROXMOX | image copy favicon.png
copy:
src: files/favicon.png
dest: /usr/share/pve-manager/images/favicon.png
# update the postfix settings
- name: PROXMOX | check if the enterprise-repo exists
stat:
path: /etc/apt/sources.list.d/pve-enterprise.list
register: pve_enterprise_exists
# DONE
- name: PROXMOX | remove the enterprise-repo if it exists
command: rm -f /etc/apt/sources.list.d/pve-enterprise.list
when: pve_enterprise_exists.stat.exists == True
## TODO: proxmox_logo.png
- name: PROXMOX | image copy proxmox_logo.png
copy:
src: files/proxmox_logo.png
dest: /usr/share/pve-manager/images/proxmox_logo.png
# DONE
- name: PROXMOX | add the free-version APT repo
apt_repository:
repo: "deb http://download.proxmox.com/debian/pve {{ debian_release }} pve-no-subscription"
# validate_certs: no
state: present
## TODO: mv the enterprise repo to ${}/repos
# /etc/apt/sources.list.d/pve-enterprise.list
# DONE: sed command to disable the free-version popup
# sed -i.bak "s/data.status !== 'Active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
- name: PROXMOX | sed the javascript file to remove the popup
command: sed -i.bak "s/data.status !== 'Active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
#when: tmux_exists.stat.exists == False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment