2017 © Pedro Peláez
 

symfony-bundle proxmox-bundle

ProxmoxVE API integration in Symfony

image

monogramm/proxmox-bundle

ProxmoxVE API integration in Symfony

  • Sunday, April 8, 2018
  • by madmath03
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

MonogrammProxmoxBundle: Proxmox VE API integration in Symfony

This bundle integrates ZzAntares Proxmox's unoffical PHP client in the Symfony framework., (*1)

Build Status Scrutinizer Code Quality Latest version, (*2)

Installation

Use Composer to install the bundle:, (*3)

composer require monogramm/proxmox-bundle, (*4)

Then, update your app/config/AppKernel.php file:, (*5)

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Monogramm\ProxmoxBundle\MonogrammProxmoxBundle(),
            // ...
        );

        return $bundles;
    }

Configure the bundle in app/config/config.yml:, (*6)

monogramm_proxmox:
    hostname: "%proxmox_hostname%"
    username: "%proxmox_username%"
    password: "%proxmox_password%"
    realm:    "%proxmox_realm%"
    port:     "%proxmox_port%"

Finally, update your app/config/parameters.yml file to store your Proxmox VE API credentials:, (*7)

parameters:
    # ...
    proxmox_hostname: "proxmox.company.com"
    proxmox_username: "root"
    proxmox_password: "mysupersecretpassword"
    proxmox_realm:    "pam"
    proxmox_port:     "8006"

Usage

The bundle automatically registers a proxmox service in the Dependency Injection Container. That service is an instance of \ProxmoxVE\Proxmox., (*8)

Example usage in a controller:, (*9)

// ...

    public function nodesAction()
    {
        // Get all nodes
        $this
            ->get('proxmox')
            ->getNodes()
        ;

        // ...
    }

    public function createVmAction($targetnode, $id)
    {
        // Create an lxc container
        $this
            ->get('proxmox')
            ->create(
                "/nodes/$targetnode/lxc",
                [
                    'net0' => 'name=myct0,bridge=vmbr0',
                    'ostemplate' => 'local:vztmpl/debian-8.0-standard_8.0-1_amd64.tar.gz',
                    'vmid' => "$id",
                ]
            )
        ;

        // ...
    }


// ...

Contributing

See CONTRIBUTING file., (*10)

License

See LICENSE file., (*11)

Author(s)

Awesome Contributors

The Versions