Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
working-directory: .ansible/collections/ansible_collections/linode/cloud
steps:
- name: checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: .ansible/collections/ansible_collections/linode/cloud

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
working-directory: .ansible/collections/ansible_collections/linode/cloud
steps:
- name: checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: .ansible/collections/ansible_collections/linode/cloud

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

# Check out merge commit
- name: Checkout PR
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.sha }}
path: .ansible/collections/ansible_collections/linode/cloud
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
working-directory: .ansible/collections/ansible_collections/linode/cloud
steps:
- name: Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: .ansible/collections/ansible_collections/linode/cloud
fetch-depth: 0
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
Expand All @@ -101,7 +101,7 @@ jobs:
run: mkdir -p tests/output/junit

- name: Download test report
uses: actions/download-artifact@v4
uses: actions/download-artifact@v5
with:
name: xml-test-reports # Specify the artifact name from the 'run-tests' job
path: tests/output/junit
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
-
name: Run Labeler
uses: crazy-max/ghaction-github-labeler@24d110aa46a59976b8a7f35518cb7f14f434c916
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: setup python 3
uses: actions/setup-python@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
working-directory: .ansible/collections/ansible_collections/linode/cloud
steps:
- name: Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: .ansible/collections/ansible_collections/linode/cloud
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
working-directory: .ansible/collections/ansible_collections/linode/cloud
steps:
- name: checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: .ansible/collections/ansible_collections/linode/cloud

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
working-directory: .ansible/collections/ansible_collections/linode/cloud
steps:
- name: checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: .ansible/collections/ansible_collections/linode/cloud

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Name | Description |
[linode.cloud.instance_type_list](./docs/modules/instance_type_list.md)|**NOTE: This module has been deprecated in favor of `type_list`.**|
[linode.cloud.lke_type_list](./docs/modules/lke_type_list.md)|List and filter on LKE Types.|
[linode.cloud.lke_version_list](./docs/modules/lke_version_list.md)|List and filter on LKE Versions.|
[linode.cloud.maintenance_policy_list](./docs/modules/maintenance_policy_list.md)|List and filter on Maintenance Policies.|
[linode.cloud.network_transfer_prices_list](./docs/modules/network_transfer_prices_list.md)|List and filter on Network Transfer Prices.|
[linode.cloud.nodebalancer_list](./docs/modules/nodebalancer_list.md)|List and filter on Node Balancers.|
[linode.cloud.nodebalancer_type_list](./docs/modules/nodebalancer_type_list.md)|List and filter on Node Balancer Types.|
Expand Down
4 changes: 3 additions & 1 deletion docs/modules/account_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Returns information related to your Account settings.
| `backups_enabled` | <center>`bool`</center> | <center>Optional</center> | Account-wide backups default. If true, all Linodes created will automatically be enrolled in the Backups service. If false, Linodes will not be enrolled by default, but may still be enrolled on creation or later. |
| `longview_subscription` | <center>`str`</center> | <center>Optional</center> | The Longview Pro tier you are currently subscribed to. The value must be a Longview subscription ID or null for Longview Free. |
| `network_helper` | <center>`bool`</center> | <center>Optional</center> | Enables network helper across all users by default for new Linodes and Linode Configs. |
| `maintenance_policy` | <center>`str`</center> | <center>Optional</center> | The Slug of the maintenance policy associated with the account. NOTE: This field is under v4beta. **(Choices: `linode/migrate`, `linode/power_off_on`)** |

## Return Values

Expand All @@ -42,7 +43,8 @@ Returns information related to your Account settings.
"longview_subscription": "longview-3",
"managed": true,
"network_helper": false,
"object_storage": "active"
"object_storage": "active",
"maintenance_policy": "linode/migrate"
}
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-account-settings) for a list of returned fields
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Manage Linode Instances, Configs, and Disks.
| `image` | <center>`str`</center> | <center>Optional</center> | The image ID to deploy the instance disk from. **(Conflicts With: `disks`,`configs`)** |
| `authorized_keys` | <center>`list`</center> | <center>Optional</center> | A list of SSH public key parts to deploy for the root user. |
| `authorized_users` | <center>`list`</center> | <center>Optional</center> | A list of usernames. |
| `maintenance_policy` | <center>`str`</center> | <center>Optional</center> | The slug of the maintenance policy to apply during maintenance. NOTE: This field is under v4beta. **(Choices: `linode/migrate`, `linode/power_off_on`)** |
| `root_pass` | <center>`str`</center> | <center>Optional</center> | The password for the root user. If not specified, one will be generated. This generated password will be available in the task success JSON. |
| `stackscript_id` | <center>`int`</center> | <center>Optional</center> | The ID of the StackScript to use when creating the instance. See the [Linode API documentation](https://techdocs.akamai.com/linode-api/reference/get-stack-scripts). |
| `stackscript_data` | <center>`dict`</center> | <center>Optional</center> | An object containing arguments to any User Defined Fields present in the StackScript used when creating the instance. Only valid when a stackscript_id is provided. See the [Linode API documentation](https://techdocs.akamai.com/linode-api/reference/get-stack-scripts). |
Expand Down Expand Up @@ -352,6 +353,7 @@ Manage Linode Instances, Configs, and Disks.
"watchdog_enabled": true,
"disk_encryption": "enabled",
"lke_cluster_id": null,
"maintenance_policy": "linode/migrate",
"placement_group": {
"id": 123,
"label": "test",
Expand Down
1 change: 1 addition & 0 deletions docs/modules/instance_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Get info about a Linode Instance.
"watchdog_enabled": true,
"disk_encryption": "enabled",
"lke_cluster_id": null,
"maintenance_policy": "linode/migrate",
"placement_group": {
"id": 123,
"label": "test",
Expand Down
3 changes: 2 additions & 1 deletion docs/modules/instance_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ List and filter on Instances.
"updated": "2018-01-01T00:01:01",
"watchdog_enabled": true,
"disk_encryption": "enabled",
"lke_cluster_id": null
"lke_cluster_id": null,
"maintenance_policy": "linode/migrate"
}
]
```
Expand Down
72 changes: 72 additions & 0 deletions docs/modules/maintenance_policy_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# maintenance_policy_list

List and filter on Maintenance Policies.

WARNING! This module makes use of beta endpoints and requires the C(api_version) field be explicitly set to C(v4beta).

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
- [Return Values](#return-values)

## Minimum Required Fields
| Field | Type | Required | Description |
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `api_token` | `str` | **Required** | The Linode account personal access token. It is necessary to run the module. <br/>It can be exposed by the environment variable `LINODE_API_TOKEN` instead. <br/>See details in [Usage](https://github.com/linode/ansible_linode?tab=readme-ov-file#usage). |

## Examples

```yaml
- name: List all of the Linode Maintenance Policies
linode.cloud.maintenance_policy_list: {}
```

```yaml

```


## Parameters

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `order` | <center>`str`</center> | <center>Optional</center> | The order to list Maintenance Policies in. **(Choices: `desc`, `asc`; Default: `asc`)** |
| `order_by` | <center>`str`</center> | <center>Optional</center> | The attribute to order Maintenance Policies by. |
| [`filters` (sub-options)](#filters) | <center>`list`</center> | <center>Optional</center> | A list of filters to apply to the resulting Maintenance Policies. |
| `count` | <center>`int`</center> | <center>Optional</center> | The number of Maintenance Policies to return. If undefined, all results will be returned. |

### filters

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `name` | <center>`str`</center> | <center>**Required**</center> | The name of the field to filter on. Valid filterable fields can be found [here](https://techdocs.akamai.com/linode-api/reference/get-policies). |
| `values` | <center>`list`</center> | <center>**Required**</center> | A list of values to allow for this field. Fields will pass this filter if at least one of these values matches. |

## Return Values

- `maintenance_policies` - The returned Maintenance Policies.

- Sample Response:
```json
[
{
"slug": "linode/migrate",
"label": "Migrate",
"description": "Migrates the Linode to a new host while it remains fully operational. Recommended for maximizing availability.",
"type": "migrate",
"notification_period_sec": 300,
"is_default": true
},
{
"slug": "linode/power_off_on",
"label": "Power-off/on",
"description": "Powers off the Linode at the start of the maintenance event and reboots it once the maintenance finishes. Recommended for maximizing performance.",
"type": "power_off_on",
"notification_period_sec": 1800,
"is_default": false
}
]
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-policies) for a list of returned fields


3 changes: 2 additions & 1 deletion plugins/module_utils/doc_fragments/account_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"longview_subscription": "longview-3",
"managed": true,
"network_helper": false,
"object_storage": "active"
"object_storage": "active",
"maintenance_policy": "linode/migrate"
}''']
1 change: 1 addition & 0 deletions plugins/module_utils/doc_fragments/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"watchdog_enabled": true,
"disk_encryption": "enabled",
"lke_cluster_id": null,
"maintenance_policy": "linode/migrate",
"placement_group": {
"id": 123,
"label": "test",
Expand Down
5 changes: 3 additions & 2 deletions plugins/module_utils/doc_fragments/instance_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- name: label
values: myInstanceLabel''']

result_images_samples = ['''[
result_instances_samples = ['''[
{
"alerts": {
"cpu": 180,
Expand Down Expand Up @@ -55,6 +55,7 @@
"updated": "2018-01-01T00:01:01",
"watchdog_enabled": true,
"disk_encryption": "enabled",
"lke_cluster_id": null
"lke_cluster_id": null,
"maintenance_policy": "linode/migrate"
}
]''']
25 changes: 25 additions & 0 deletions plugins/module_utils/doc_fragments/maintenance_policy_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Documentation fragments for the maintenance_policy_list module"""

specdoc_examples = ['''
- name: List all of the Linode Maintenance Policies
linode.cloud.maintenance_policy_list: {}''', '''
''']

result_maintenance_policy_samples = ['''[
{
"slug": "linode/migrate",
"label": "Migrate",
"description": "Migrates the Linode to a new host while it remains fully operational. Recommended for maximizing availability.",
"type": "migrate",
"notification_period_sec": 300,
"is_default": true
},
{
"slug": "linode/power_off_on",
"label": "Power-off/on",
"description": "Powers off the Linode at the start of the maintenance event and reboots it once the maintenance finishes. Recommended for maximizing performance.",
"type": "power_off_on",
"notification_period_sec": 1800,
"is_default": false
}
]''']
10 changes: 9 additions & 1 deletion plugins/modules/account_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
"for new Linodes and Linode Configs."
],
),
"maintenance_policy": SpecField(
type=FieldType.string,
description=[
"The Slug of the maintenance policy associated with the account.",
"NOTE: This field is under v4beta.",
],
choices=["linode/migrate", "linode/power_off_on"],
),
}

SPECDOC_META = SpecDocMeta(
Expand All @@ -75,7 +83,7 @@
},
)

MUTABLE_FIELDS = {"backups_enabled", "network_helper"}
MUTABLE_FIELDS = {"backups_enabled", "network_helper", "maintenance_policy"}

DOCUMENTATION = r"""
"""
Expand Down
10 changes: 9 additions & 1 deletion plugins/modules/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,14 @@
element_type=FieldType.string,
description=["A list of usernames."],
),
"maintenance_policy": SpecField(
type=FieldType.string,
description=[
"The slug of the maintenance policy to apply during maintenance.",
"NOTE: This field is under v4beta.",
],
choices=["linode/migrate", "linode/power_off_on"],
),
"root_pass": SpecField(
type=FieldType.string,
no_log=True,
Expand Down Expand Up @@ -592,7 +600,7 @@
)

# Fields that can be updated on an existing instance
MUTABLE_FIELDS = {"group", "tags"}
MUTABLE_FIELDS = {"group", "tags", "maintenance_policy"}

linode_instance_config_mutable = {
"comments",
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/instance_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
endpoint_template="/linode/instances",
result_docs_url="https://techdocs.akamai.com/linode-api/reference/get-linode-instances",
examples=docs.specdoc_examples,
result_samples=docs.result_images_samples,
result_samples=docs.result_instances_samples,
)

SPECDOC_META = module.spec
Expand Down
Loading
Loading