equinix-labs / ansible-collection-equinix

Ansible content to help automate the management of Equinix resources
https://deploy.equinix.com/labs/ansible-collection-equinix/
GNU General Public License v3.0
2 stars 8 forks source link

metal_plan_info #136

Closed t0mk closed 4 months ago

t0mk commented 7 months ago

Module for listing plans

https://deploy.equinix.com/developers/api/metal/#tag/Plans/operation/findPlans

We had sth like that in the old collection:

https://github.com/equinix/ansible-collection-metal/blob/main/docs/equinix.metal.plan_info_module.rst

t0mk commented 7 months ago

Ansible wrapper of https://github.com/equinix-labs/metal-python/blob/main/equinix_metal/equinix_metal/api/plans_api.py#L50

which is a wrapper of: https://deploy.equinix.com/developers/api/metal/#tag/Plans/operation/findPlans

sth like

- name: List plans
  hosts: localhost
  tasks:
    - equinix.cloud.metal_plan_info:
       categories: ["aaa", "bb", "vv"]
       type: "sometype"
       slug: "m3.small"   
      register: selected_plans
    - name: Print plans
      ansible.builtin.debug:
        msg: {{ selected_plans.resources }}

    - equinix.cloud.metal_plan_info:  
        # calls find_plans_by_project. project_id conflicts with categories, type and slug   
        project_id: "{{ test_project.id}}"
      register: project_available_plans
    - name: Print project plans
      ansible.builtin.debug:
        msg: {{ project_available_plans.resources }}
antoninrykalsky commented 4 months ago

Resolved, I'm closing