Skip to content

Commit

Permalink
Project: Image Services Gen2 (#560)
Browse files Browse the repository at this point in the history
* new: Support tagging in image module; Migrate `image_info` to use InfoModule (#535)

* init

* lint

* new: Support replication in `image` module (#539)

* replication

* register action

* add LA note

* small fix

* lint

* rename

* oops

* restrict replica_regions; add wait_for_replications.
  • Loading branch information
yec-akamai authored Aug 13, 2024
1 parent c860c0a commit 3b24671
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 135 deletions.
41 changes: 37 additions & 4 deletions docs/modules/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Manage a Linode Image.
label: my-image
description: Created using Ansible!
disk_id: 12345
tags:
- test
state: present
```
Expand All @@ -29,6 +31,22 @@ Manage a Linode Image.
label: my-image
description: Created using Ansible!
source_file: myimage.img.gz
tags:
- test
state: present
```
```yaml
- name: Replicate an image
linode.cloud.image:
label: my-image
description: Created using Ansible!
disk_id: 12345
tags:
- test
replica_regions:
- us-east
- us-central
state: present
```
Expand All @@ -54,6 +72,9 @@ Manage a Linode Image.
| `source_file` | <center>`str`</center> | <center>Optional</center> | An image file to create this image with. **(Conflicts With: `disk_id`)** |
| `wait` | <center>`bool`</center> | <center>Optional</center> | Wait for the image to have status `available` before returning. **(Default: `True`)** |
| `wait_timeout` | <center>`int`</center> | <center>Optional</center> | The amount of time, in seconds, to wait for an image to have status `available`. **(Default: `600`)** |
| `tags` | <center>`list`</center> | <center>Optional</center> | A list of customized tags of this new Image. **(Updatable)** |
| `replica_regions` | <center>`list`</center> | <center>Optional</center> | A list of regions that customer wants to replicate this image in. At least one available region must be provided and only core regions allowed. Existing images in the regions not passed will be removed. NOTE: Image replication may not currently be available to all users. **(Updatable)** |
| `wait_for_replications` | <center>`bool`</center> | <center>Optional</center> | Wait for the all the replications `available` before returning. **(Default: `False`)** |

## Return Values

Expand All @@ -64,19 +85,31 @@ Manage a Linode Image.
{
"capabilities": [],
"created": "2021-08-14T22:44:02",
"created_by": "linode",
"created_by": "my-account",
"deprecated": false,
"description": "Example Image description.",
"eol": "2026-07-01T04:00:00",
"expiry": null,
"id": "linode/debian11",
"id": "private/123",
"is_public": true,
"label": "Debian 11",
"label": "my-image",
"size": 2500,
"status": null,
"type": "manual",
"updated": "2021-08-14T22:44:02",
"vendor": "Debian"
"vendor": "Debian",
"tags": ["test"],
"total_size": 5000,
"regions": [
{
"region": "us-east",
"status": "available"
},
{
"region": "us-central",
"status": "pending"
}
]
}
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-image) for a list of returned fields
Expand Down
26 changes: 19 additions & 7 deletions docs/modules/image_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,43 @@ Get info about a Linode Image.
| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `id` | <center>`str`</center> | <center>Optional</center> | The ID of the image. **(Conflicts With: `label`)** |
| `label` | <center>`str`</center> | <center>Optional</center> | The label of the image. **(Conflicts With: `id`)** |
| `label` | <center>`str`</center> | <center>Optional</center> | The label of the Image to resolve. **(Conflicts With: `id`)** |
| `id` | <center>`str`</center> | <center>Optional</center> | The ID of the Image to resolve. **(Conflicts With: `label`)** |

## Return Values

- `image` - The image in JSON serialized form.
- `image` - The returned Image.

- Sample Response:
```json
{
"capabilities": [],
"created": "2021-08-14T22:44:02",
"created_by": "linode",
"created_by": "my-account",
"deprecated": false,
"description": "Example Image description.",
"eol": "2026-07-01T04:00:00",
"expiry": null,
"id": "linode/debian11",
"id": "private/123",
"is_public": true,
"label": "Debian 11",
"label": "my-image",
"size": 2500,
"status": null,
"type": "manual",
"updated": "2021-08-14T22:44:02",
"vendor": "Debian"
"vendor": "Debian",
"tags": ["test"],
"total_size": 5000,
"regions": [
{
"region": "us-east",
"status": "available"
},
{
"region": "us-central",
"status": "pending"
}
]
}
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-image) for a list of returned fields
Expand Down
23 changes: 17 additions & 6 deletions docs/modules/image_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,31 @@ List and filter on Images.
[
{
"created":"2021-08-14T22:44:02",
"created_by":"linode",
"created_by":"my-account",
"deprecated":false,
"description":"Example Image description.",
"eol":"2026-07-01T04:00:00",
"expiry":null,
"id":"linode/debian11",
"is_public":true,
"label":"Debian 11",
"id":"private/123",
"is_public":false,
"label":"test",
"size":2500,
"status":null,
"type":"manual",
"updated":"2021-08-14T22:44:02",
"vendor":"Debian"
}
"vendor":"Debian",
"tags": ["test"],
"total_size": 5000,
"regions": [
{
"region": "us-east",
"status": "available"
},
{
"region": "us-central",
"status": "pending"
}]
}
]
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-images) for a list of returned fields
Expand Down
35 changes: 31 additions & 4 deletions plugins/module_utils/doc_fragments/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@
label: my-image
description: Created using Ansible!
disk_id: 12345
tags:
- test
state: present''', '''
- name: Create a basic image from a file
linode.cloud.image:
label: my-image
description: Created using Ansible!
source_file: myimage.img.gz
tags:
- test
state: present''', '''
- name: Replicate an image
linode.cloud.image:
label: my-image
description: Created using Ansible!
disk_id: 12345
tags:
- test
replica_regions:
- us-east
- us-central
state: present''', '''
- name: Delete an image
linode.cloud.image:
label: my-image
Expand All @@ -21,17 +36,29 @@
result_image_samples = ['''{
"capabilities": [],
"created": "2021-08-14T22:44:02",
"created_by": "linode",
"created_by": "my-account",
"deprecated": false,
"description": "Example Image description.",
"eol": "2026-07-01T04:00:00",
"expiry": null,
"id": "linode/debian11",
"id": "private/123",
"is_public": true,
"label": "Debian 11",
"label": "my-image",
"size": 2500,
"status": null,
"type": "manual",
"updated": "2021-08-14T22:44:02",
"vendor": "Debian"
"vendor": "Debian",
"tags": ["test"],
"total_size": 5000,
"regions": [
{
"region": "us-east",
"status": "available"
},
{
"region": "us-central",
"status": "pending"
}
]
}''']
23 changes: 17 additions & 6 deletions plugins/module_utils/doc_fragments/image_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,29 @@
result_images_samples = ['''[
{
"created":"2021-08-14T22:44:02",
"created_by":"linode",
"created_by":"my-account",
"deprecated":false,
"description":"Example Image description.",
"eol":"2026-07-01T04:00:00",
"expiry":null,
"id":"linode/debian11",
"is_public":true,
"label":"Debian 11",
"id":"private/123",
"is_public":false,
"label":"test",
"size":2500,
"status":null,
"type":"manual",
"updated":"2021-08-14T22:44:02",
"vendor":"Debian"
}
"vendor":"Debian",
"tags": ["test"],
"total_size": 5000,
"regions": [
{
"region": "us-east",
"status": "available"
},
{
"region": "us-central",
"status": "pending"
}]
}
]''']
Loading

0 comments on commit 3b24671

Please sign in to comment.