Skip to content

Commit

Permalink
documentation for hardare reservation move
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mk committed Oct 9, 2023
1 parent 977eb5e commit 2aa283c
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/modules/metal_hardware_reservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,30 @@ It doesn't allow to create or update hardware_reservations.

```

```yaml
# Move hardware reservation between projects
- name: fetch hw reservation resource
equinix.cloud.metal_hardware_reservation:
id: "{{ metal_hardware_reservation_id }}"
register: hwres

- name: create new project to move the hw res to
equinix.cloud.metal_project:
name: "destination-project"
register: project

- name: move hw reservation to new project
equinix.cloud.metal_hardware_reservation:
id: "{{ metal_hardware_reservation_id }}"
project_id: "{{ project.id }}"

- name: move hw reservation to original project
equinix.cloud.metal_hardware_reservation:
id: "{{ metal_hardware_reservation_id }}"
project_id: "{{ hwres.project_id }}"

```




Expand All @@ -36,6 +60,7 @@ It doesn't allow to create or update hardware_reservations.
| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `id` | <center>`str`</center> | <center>**Required**</center> | UUID of the hardware_reservation. |
| `project_id` | <center>`str`</center> | <center>Optional</center> | UUID of parent project containing the hardware_reservation. It can be changed. **(Updatable)** |



Expand Down
43 changes: 43 additions & 0 deletions plugins/modules/metal_hardware_reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
- UUID of the hardware_reservation.
required: true
type: str
project_id:
description:
- UUID of parent project containing the hardware_reservation. It can be changed.
required: false
type: str
requirements: null
short_description: Lookup a single hardware_reservation by ID in Equinix Metal
'''
Expand All @@ -29,6 +34,22 @@
tasks:
- equinix.cloud.metal_hardware_reservation:
id: 7624f0f7-75b6-4271-bc64-632b80f87de2
- name: fetch hw reservation resource
equinix.cloud.metal_hardware_reservation:
id: '{{ metal_hardware_reservation_id }}'
register: hwres
- name: create new project to move the hw res to
equinix.cloud.metal_project:
name: destination-project
register: project
- name: move hw reservation to new project
equinix.cloud.metal_hardware_reservation:
id: '{{ metal_hardware_reservation_id }}'
project_id: '{{ project.id }}'
- name: move hw reservation to original project
equinix.cloud.metal_hardware_reservation:
id: '{{ metal_hardware_reservation_id }}'
project_id: '{{ hwres.project_id }}'
'''
RETURN = '''
metal_hardware_reservation:
Expand Down Expand Up @@ -82,6 +103,28 @@
- equinix.cloud.metal_hardware_reservation:
id: 7624f0f7-75b6-4271-bc64-632b80f87de2
''',
'''
# Move hardware reservation between projects
- name: fetch hw reservation resource
equinix.cloud.metal_hardware_reservation:
id: "{{ metal_hardware_reservation_id }}"
register: hwres
- name: create new project to move the hw res to
equinix.cloud.metal_project:
name: "destination-project"
register: project
- name: move hw reservation to new project
equinix.cloud.metal_hardware_reservation:
id: "{{ metal_hardware_reservation_id }}"
project_id: "{{ project.id }}"
- name: move hw reservation to original project
equinix.cloud.metal_hardware_reservation:
id: "{{ metal_hardware_reservation_id }}"
project_id: "{{ hwres.project_id }}"
'''
]

result_sample = ['''
Expand Down

0 comments on commit 2aa283c

Please sign in to comment.