Skip to content

Conversation

@caladd
Copy link
Contributor

@caladd caladd commented Oct 23, 2020

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
    }
}

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
    }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants