Skip to main content

Dynamic ansible inventory for Synnefo IaaS nodes

Project description

snfinv is a a simplistic virtual machine provision and dynamic ansible inventory tool to be used on Synnefo IaaS deployments.

Install

Install using pip:

$ pip install snfinv

Provisioning

Create an inventory.yml and define your nodes configuration:

provision:
    networks:
        priv1:
            type: MAC_FILTERED
            cidr: 10.12.21.0/24

    coreos_node1:
        project: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx
        flavour:
            cpu: 2
            ram: 1024
            disk: 10
        image: b9236d02-0904-4d00-8967-3279f0053d18 // CoreOS image
        floating_ips: [auto, 83.212.221.53]
        groups: ['sql']
        keys: ['/home/user/.ssh/id_rsa.pub']
        users: ['core']
        networks:
            priv1:
                ip: 10.12.21.1
        vars:
            ansible_var1: 'value'

    coreos_node2:
        project: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx
        flavour:
            cpu: 2
            ram: 1024
            disk: 10
        image: b9236d02-0904-4d00-8967-3279f0053d18 // CoreOS image
        floating_ips: [auto]
        groups: ['web']
        keys: ['/home/user/.ssh/id_rsa.pub']
        users: ['core']
        networks:
            priv1:
                ip: 10.12.21.1
        vars:
            ansible_var1: 'value'

You can then provision the above specification by running within the directory the file above was created:

$ snfinv --provision

Provision script is reentrant and it won’t try to recreate existing resources but it is not smart enough to delicately re-assemble flimsy configuration changes such as changes of vm flavor/ips/keys etc.

Ansible inventory

snfinv tool provides the required command line interface to be able to use is as a dynamic ansible inventory:

$ ansible `which snfinv` "coreos_node2" -m shell -a ls

Additional arguments

  • –dry

    Used in conjuction with –provision. If set no calls will be sent to the synnefo api endpoints.

  • –list-hosts

    Outputs /etc/hosts friendly list of the available nodes.

  • –config=<path-to-inventory.yml>

    Provide a custom inventory.yml file. By default ./inventory.yml is used. SNFINV_CONFIG environment variable may also be used to declare the path to the provision configuration file.

  • –kamaki-config

    Use a custom location for the kamaki config file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snfinv-0.1.2.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file snfinv-0.1.2.tar.gz.

File metadata

  • Download URL: snfinv-0.1.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for snfinv-0.1.2.tar.gz
Algorithm Hash digest
SHA256 49013741cd1c3daa03f848183de8127f4c535483fa2540a43925b09a469e31c3
MD5 17bd2553e93ef795de07a8118cc39f52
BLAKE2b-256 403a57091bf86e59368fa4a1e553b6ad54059d6596787478ca723edadc007407

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page