All Projects → engonzal → ansible_role_proxmox

engonzal / ansible_role_proxmox

Licence: other
Ansible role to provision containers in Proxmox VE virtualization

Programming Languages

Jinja
831 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ansible role proxmox

cv4pve-api-dotnet
Proxmox VE Client API .Net C#
Stars: ✭ 25 (-40.48%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
cv4pve-metrics
Metrics for Proxmox VE, Grafana with dasboard, InfluxDb
Stars: ✭ 38 (-9.52%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
proxmox-tools
📦 A collection of stuff that I and others wrote for Proxmox 📦
Stars: ✭ 112 (+166.67%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
cv4pve-botgram
Telegram Bot for Proxmox VE
Stars: ✭ 26 (-38.1%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
cv4pve-pepper
Launching SPICE remote-viewer for Proxmox VE
Stars: ✭ 48 (+14.29%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
cv4pve-api-php
Proxmox VE Client API for PHP
Stars: ✭ 45 (+7.14%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
dab templates
DAB Templates for Proxmox
Stars: ✭ 21 (-50%)
Mutual labels:  proxmox, proxmox-ve
pve-common
Proxmox Project's Common Perl Code
Stars: ✭ 33 (-21.43%)
Mutual labels:  proxmox, proxmox-ve
Proxmox-prepare
Preparing Proxmox VE after installation
Stars: ✭ 15 (-64.29%)
Mutual labels:  proxmox, proxmox-ve
ans-pve-win-templ
Ansible playbook to create Proxmox Windows VM templates
Stars: ✭ 49 (+16.67%)
Mutual labels:  proxmox, proxmox-ve
ansible-role-do-agent
Cross-distro installation of the DigitalOcean monitoring agent
Stars: ✭ 22 (-47.62%)
Mutual labels:  ansible-role, ansible-galaxy
pve exporter
Prometheus exporter for Proxmox VE.
Stars: ✭ 31 (-26.19%)
Mutual labels:  proxmox, proxmox-ve
ansible-role-bastille
An ansible role that helps configure a server as a BastilleBSD host
Stars: ✭ 15 (-64.29%)
Mutual labels:  ansible-role, ansible-galaxy
RHEL7-CIS
Ansible RHEL 7 - CIS Benchmark Hardening Script
Stars: ✭ 28 (-33.33%)
Mutual labels:  ansible-role, ansible-galaxy
ansible-role-zerotier
Ansible role to install Zerotier-One and join a Zerotier network
Stars: ✭ 64 (+52.38%)
Mutual labels:  ansible-role, ansible-galaxy
freenas-proxmox
ZFS over iSCSI to FreeNAS API's from Proxmox VE
Stars: ✭ 129 (+207.14%)
Mutual labels:  proxmox, proxmox-ve
proxmox-ve
Proxmox VE Vagrant Base Box
Stars: ✭ 70 (+66.67%)
Mutual labels:  proxmox, proxmox-ve
cis ubuntu 2004
💻 Ansible Role for applying CIS Benchmark for Ubuntu Linux 20.04 LTS (hardening).
Stars: ✭ 30 (-28.57%)
Mutual labels:  ansible-role, ansible-galaxy
ansible-kafka
Ansible role for installing and configuring Apache Kafka on RedHat and Debian platforms.
Stars: ✭ 56 (+33.33%)
Mutual labels:  ansible-role, ansible-galaxy
ansible-role-aptly
Install aptly debian respository manager and enable the REST API
Stars: ✭ 37 (-11.9%)
Mutual labels:  ansible-role, ansible-galaxy

Ansible Roles: Proxmox

This is a role to setup a new container. Note that you must have root ssh to a proxmox node configured. You must also have api access to your proxmox host/cluster.

This role will primarily run on the ansible localhost. Some tasks will use the "delegate_to" option to run on the remote Proxmox node.

Role Variables

Lots of variables are available to use for provisioning a container. Required will depend on your use case. Most are optional.

Simple Container:

pve_node: pve1
pve_apiuser: root@pam
pve_apipass: myAPIpassword
pve_hostname: "newhostname"
pve_template: local:vztmpl/debian-9.0-standard_9.5-1_amd64.tar.gz

Detailed example with bind mounts from the Proxmox node. I added a cephfs mount to my cluster, so it's mounted on each Proxmox node:

pve_node: pve1
pve_vmid: 114
pve_apiuser: engonzal@pve
pve_apipass: myAPIpassword
pve_api_host: pve1.domain.com
pve_hostname: "newhostname"
pve_template: local:vztmpl/debian-9.0-standard_9.5-1_amd64.tar.gz
pve_netif:
  net0: "name=eth0,gw=192.168.84.1,ip=192.168.84.20/24,bridge=vmbr0"
pve_cores: 2
pve_mem: 2048
pve_swap: "{{ pve_mem }}"
pve_guest_pass: myContainerRootPassword
pve_search: domain.com
pve_dns: '192.168.84.1'
pve_storage: ceph_storage_ct
pve_unprivileged: yes
pve_ssh: "ssh-rsa myPublicKey engonzal@hostname"
pve_custom_mounts:
  mp0: "/mnt/pve/cephfs_data/downloads/,mp=/downloads"
  mp1: "/mnt/pve/cephfs_data/media,mp=/media"

Example Playbooka

Ansible hosts inventory file

# hosts
[proxmox_containers]
test_server

Ansible playbook

# proxmox.yml
---
- hosts: plex_app
  connection: local
  user: root
  vars:
    pve_node: pve1
    pve_apiuser: root@pam
    pve_apipass: myAPIpassword
    pve_api_host: pve1.domain.com
    pve_hostname: "newhostname"
    pve_template: local:vztmpl/debian-9.0-standard_9.5-1_amd64.tar.gz
  roles:
    - engonzal.proxmoxct

Ansible run command

ansible-playbook -i hosts -l test_server proxmox.yml

Example Playbook (advanced)

You can also add a delay after your play if you have other plays to run after:

---
- hosts: plex_app
  connection: local
  user: root
  pre_tasks:
  - name: get current python interpreter (for pip virtualenvs)
    command: which python
    register: which_interpreter
    tags: always
    changed_when: False

  - name: Use the current python path instead of system python
    set_fact:
      ansible_python_interpreter: "{{ which_interpreter.stdout }}"
    tags: always

  roles:
    - name: engonzal.proxmoxct
      tags: pve
  post_tasks:
    - name: Allow container time to boot if started
      pause:
        seconds: 20
      when: pve_info_state.changed

- hosts: plex_app
  user: root
  vars:
    ansible_python_interpreter: /usr/bin/python3 # needed for bionic ct
    package_list:
      - vim
  roles:
    - engonzal.package

Other Examples

DHCP Example:

pve_node: pve1
pve_vmid: 114
pve_apiuser: engonzal@pve
pve_apipass: myAPIpassword
pve_api_host: pve1.domain.com
pve_state: present
pve_hostname: "newhostname"
pve_template: local:vztmpl/debian-9.0-standard_9.5-1_amd64.tar.gz
pve_netif:
  net0: "name=eth0,ip=dhcp,ip6=dhcp,bridge=vmbr0"
pve_storage: local-lvm
pve_custom_mounts:
  mp0: "/mnt/pve/cephfs_data/downloads/,mp=/downloads"
  mp1: "/mnt/pve/cephfs_data/media,mp=/media"

Organization

For my uses I organize the variables like this (using ansible vault to encrypt passwords):

# group_vars/all
pve_apiuser: engonzal@pve
pve_apipass: myAPIpassword
pve_api_host: pve1.domain.com
pve_guest_pass: myContainerRootPassword
pve_search: domain.com
pve_dns: '192.168.84.1'
pve_unprivileged: yes
pve_ssh: "ssh-rsa myPublicKey engonzal@hostname"

# group_vars/plex
pve_node: pve3
pve_vmid: 114
pve_hostname: "plex"
pve_netif:
  net0: "name=eth0,gw=192.168.84.1,ip=192.168.84.20/24,bridge=vmbr0"
pve_template: local:vztmpl/ubuntu-18.10-standard_18.10-1_amd64.tar.gz
pve_cores: 8
pve_mem: 4096
pve_custom_mounts:
  mp0: "/mnt/pve/cephfs_data/media,mp=/media"

License

BSD

Notes

Proxmox api info available at:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].