stacki icon indicating copy to clipboard operation
stacki copied to clipboard

FEATURE: Ansible module for appliance info

Open caladd opened this issue 4 years ago • 0 comments

An Ansible module for returning appliance info.

The module takes a single optional parameter: name for requesting the data for a specific appliance. If name is not provided, then the data for all appliances is returned.

The data returned is a list of appliances.

Example playbook:

---
- hosts: localhost
  tasks:
    - name: Get all appliance info
      stacki_appliance_info:
      register: result

    - name: All appliances output
      debug:
        var: result

    - name: Get info for appliance backend
      stacki_appliance_info:
        name: backend
      register: result

    - name: Appliance backend output
      debug:
        var: result

Output of the debug commands, showing the structure of the data returned:

TASK [All appliances output] ********************************************************************
ok: [localhost] => {
    "result": {
        "appliances": [
            {
                "appliance": "backend",
                "public": true
            },
            {
                "appliance": "barnacle",
                "public": false
            },
            {
                "appliance": "builder",
                "public": false
            },
            {
                "appliance": "external",
                "public": false
            },
            {
                "appliance": "frontend",
                "public": false
            },
            {
                "appliance": "hypervisor",
                "public": true
            },
            {
                "appliance": "replicant",
                "public": true
            },
            {
                "appliance": "switch",
                "public": false
            }
        ],
        "changed": false,
        "failed": false
    }
}

TASK [Appliance backend output] *****************************************************************
ok: [localhost] => {
    "result": {
        "appliances": [
            {
                "appliance": "backend",
                "public": true
            }
        ],
        "changed": false,
        "failed": false
    }
}

caladd avatar Oct 23 '20 18:10 caladd