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
32 changes: 29 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ jobs:
runs-on: ubuntu-latest
needs: [integration-tests]
if: ${{ (success() || failure()) && github.repository == 'linode/ansible_linode' }}
outputs:
summary: ${{ steps.set-test-summary.outputs.summary }}

steps:
- name: Checkout code
Expand Down Expand Up @@ -127,6 +129,18 @@ jobs:
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}

- name: Generate test summary and save to output
id: set-test-summary
run: |
filename=$(ls | grep -E '^[0-9]{12}_ansible_merged\.xml$')
test_output=$(python3 e2e_scripts/tod_scripts/generate_test_summary.py "${filename}")
echo "$test_output"
{
echo 'summary<<EOF'
echo "$test_output"
echo EOF
} >> "$GITHUB_OUTPUT"

apply-calico-rules:
runs-on: ubuntu-latest
needs: [integration-tests]
Expand Down Expand Up @@ -186,11 +200,12 @@ jobs:

notify-slack:
runs-on: ubuntu-latest
needs: [integration-tests]
needs: [integration-tests, process-upload-report]
if: ${{ (success() || failure()) && github.repository == 'linode/ansible_linode' }} # Run even if integration tests fail and only on main repository

steps:
- name: Notify Slack
id: main_message
uses: slackapi/slack-github-action@v2.0.0
with:
method: chat.postMessage
Expand All @@ -201,7 +216,7 @@ jobs:
- type: section
text:
type: mrkdwn
text: ":rocket: *${{ github.workflow }} Completed in: ${{ github.repository }}* :white_check_mark:"
text: ":rocket: *${{ github.workflow }} Completed in: ${{ github.repository }}* ${{ needs.integration-tests.result == 'success' && ':white_check_mark:' || ':failed:' }}"
- type: divider
- type: section
fields:
Expand All @@ -219,4 +234,15 @@ jobs:
- type: context
elements:
- type: mrkdwn
text: "Triggered by: :bust_in_silhouette: `${{ github.actor }}`"
text: "Triggered by: :bust_in_silhouette: `${{ github.actor }}`"

- name: Test summary thread
if: success()
uses: slackapi/slack-github-action@v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
thread_ts: "${{ steps.main_message.outputs.ts }}"
text: "${{ needs.process-upload-report.outputs.summary }}"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Name | Description |
[linode.cloud.database_mysql](./docs/modules/database_mysql.md)|Manage a Linode MySQL database.|
[linode.cloud.database_mysql_v2](./docs/modules/database_mysql_v2.md)|Create, read, and update a Linode MySQL database.|
[linode.cloud.database_postgresql](./docs/modules/database_postgresql.md)|Manage a Linode PostgreSQL database.|
[linode.cloud.database_postgresql_v2](./docs/modules/database_postgresql_v2.md)|Create, read, and update a Linode PostgreSQL database.|
[linode.cloud.domain](./docs/modules/domain.md)|Manage Linode Domains.|
[linode.cloud.domain_record](./docs/modules/domain_record.md)|Manage Linode Domain Records.|
[linode.cloud.firewall](./docs/modules/firewall.md)|Manage Linode Firewalls.|
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/database_mysql_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Create, read, and update a Linode MySQL database.
| `day_of_week` | <center>`int`</center> | <center>**Required**</center> | The day to perform maintenance. 1=Monday, 2=Tuesday, etc. **(Choices: `1`, `2`, `3`, `4`, `5`, `6`, `7`)** |
| `duration` | <center>`int`</center> | <center>**Required**</center> | The maximum maintenance window time in hours. |
| `hour_of_day` | <center>`int`</center> | <center>**Required**</center> | The hour to begin maintenance based in UTC time. |
| `frequency` | <center>`str`</center> | <center>Optional</center> | Whether maintenance occurs on a weekly or monthly basis. **(Choices: `weekly`, `monthly`; Default: `weekly`)** |
| `frequency` | <center>`str`</center> | <center>Optional</center> | The frequency at which maintenance occurs. **(Choices: `weekly`; Default: `weekly`)** |

## Return Values

Expand Down
178 changes: 178 additions & 0 deletions docs/modules/database_postgresql_v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# database_postgresql_v2

Create, read, and update a Linode PostgreSQL database.

- [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: Create a basic PostgreSQL database
linode.cloud.database_postgresql_v2:
label: my-db
region: us-mia
engine: postgresql/16
type: g6-nanode-1
allow_list:
- 0.0.0.0/0
state: present
```

```yaml
- name: Create a PostgreSQL database with three nodes
linode.cloud.database_postgresql_v2:
label: my-db
region: us-mia
engine: postgresql/16
type: g6-standard-1
cluster_size: 3
allow_list:
- 0.0.0.0/0
state: present
```

```yaml
- name: Create a PostgreSQL database with an explicit maintenance schedule
linode.cloud.database_postgresql_v2:
label: my-db
region: us-mia
engine: postgresql/16
type: g6-nanode-1
updates:
duration: 4
frequency: weekly
hour_of_day: 16
day_of_week: 4
state: present
```

```yaml
- name: Create a PostgreSQL database forked from another database
linode.cloud.database_postgresql_v2:
label: my-db
region: us-mia
engine: postgresql/16
type: g6-nanode-1
fork:
source: 12345
state: present
```

```yaml
- name: Delete a PostgreSQL database
linode.cloud.database_postgresql_v2:
label: my-db
state: absent
```


## Parameters

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `state` | <center>`str`</center> | <center>**Required**</center> | The desired state of the Managed Database. **(Choices: `present`, `absent`)** |
| `allow_list` | <center>`list`</center> | <center>Optional</center> | A list of IP addresses and CIDR ranges that can access the Managed Database. **(Updatable)** |
| `cluster_size` | <center>`int`</center> | <center>Optional</center> | The number of Linode instance nodes deployed to the Managed Database. **(Updatable)** |
| `engine` | <center>`str`</center> | <center>Optional</center> | The Managed Database engine in engine/version format. **(Updatable)** |
| `label` | <center>`str`</center> | <center>Optional</center> | The label of the Managed Database. |
| `region` | <center>`str`</center> | <center>Optional</center> | The region of the Managed Database. |
| `type` | <center>`str`</center> | <center>Optional</center> | The Linode Instance type used by the Managed Database for its nodes. **(Updatable)** |
| [`fork` (sub-options)](#fork) | <center>`dict`</center> | <center>Optional</center> | Information about a database to fork from. |
| [`updates` (sub-options)](#updates) | <center>`dict`</center> | <center>Optional</center> | Configuration settings for automated patch update maintenance for the Managed Database. **(Updatable)** |
| `wait_timeout` | <center>`int`</center> | <center>Optional</center> | The maximum number of seconds a poll operation can take before raising an error. **(Default: `2700`)** |

### fork

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `restore_time` | <center>`str`</center> | <center>Optional</center> | The database timestamp from which it was restored. |
| `source` | <center>`int`</center> | <center>Optional</center> | The instance id of the database that was forked from. |

### updates

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `day_of_week` | <center>`int`</center> | <center>**Required**</center> | The day to perform maintenance. 1=Monday, 2=Tuesday, etc. **(Choices: `1`, `2`, `3`, `4`, `5`, `6`, `7`)** |
| `duration` | <center>`int`</center> | <center>**Required**</center> | The maximum maintenance window time in hours. |
| `hour_of_day` | <center>`int`</center> | <center>**Required**</center> | The hour to begin maintenance based in UTC time. |
| `frequency` | <center>`str`</center> | <center>Optional</center> | The frequency at which maintenance occurs. **(Choices: `weekly`; Default: `weekly`)** |

## Return Values

- `database` - The database in JSON serialized form.

- Sample Response:
```json
{
"allow_list": [
"10.0.0.3/32"
],
"cluster_size": 3,
"created": "2025-02-10T20:10:20",
"encrypted": true,
"engine": "postgresql",
"hosts": {
"primary": "a225891-akamai-prod-1798333-default.g2a.akamaidb.net",
"standby": "replica-a225891-akamai-prod-1798333-default.g2a.akamaidb.net"
},
"id": 12345,
"label": "my-db",
"members": {
"172.104.207.136": "primary",
"194.195.112.177": "failover",
"45.79.126.72": "failover"
},
"oldest_restore_time": "2025-02-10T20:15:07",
"platform": "rdbms-default",
"port": 11876,
"region": "ap-west",
"ssl_connection": true,
"status": "active",
"total_disk_size_gb": 30,
"type": "g6-standard-1",
"updated": "2025-02-10T20:25:55",
"updates": {
"day_of_week": 4,
"duration": 4,
"frequency": "weekly",
"hour_of_day": 16,
"pending": []
},
"used_disk_size_gb": 0,
"version": "8.0.35"
}
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-databases-postgre-sql-instance) for a list of returned fields


- `ssl_cert` - The SSL CA certificate for an accessible Managed PostgreSQL Database.

- Sample Response:
```json
{
"ca_certificate": "LS0tLS1CRUdJ...=="
}
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-databases-postgresql-instance-ssl) for a list of returned fields


- `credentials` - The root username and password for an accessible Managed PostgreSQL Database.

- Sample Response:
```json
{
"password": "s3cur3P@ssw0rd",
"username": "akmadmin"
}
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-databases-postgre-sql-instance-credentials) for a list of returned fields


3 changes: 2 additions & 1 deletion docs/modules/lke_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ Manage Linode LKE clusters.
| `region` | <center>`str`</center> | <center>Optional</center> | This Kubernetes cluster’s location. |
| `tags` | <center>`list`</center> | <center>Optional</center> | An array of tags applied to the Kubernetes cluster. |
| `high_availability` | <center>`bool`</center> | <center>Optional</center> | Defines whether High Availability is enabled for the Control Plane Components of the cluster. **(Default: `False`; Updatable)** |
| [`acl` (sub-options)](#acl) | <center>`dict`</center> | <center>Optional</center> | The ACL configuration for this cluster's control plane. NOTE: Control Plane ACLs may not currently be available to all users. **(Updatable)** |
| [`acl` (sub-options)](#acl) | <center>`dict`</center> | <center>Optional</center> | The ACL configuration for this cluster's control plane. **(Updatable)** |
| [`node_pools` (sub-options)](#node_pools) | <center>`list`</center> | <center>Optional</center> | A list of node pools to configure the cluster with **(Updatable)** |
| `skip_polling` | <center>`bool`</center> | <center>Optional</center> | If true, the module will not wait for all nodes in the cluster to be ready. **(Default: `False`)** |
| `wait_timeout` | <center>`int`</center> | <center>Optional</center> | The period to wait for the cluster to be ready in seconds. **(Default: `600`)** |
| `apl_enabled` | <center>`bool`</center> | <center>Optional</center> | Whether this cluster should use APL. NOTE: This endpoint is in beta. **(Default: `False`)** |

### acl

Expand Down
95 changes: 95 additions & 0 deletions plugins/module_utils/doc_fragments/database_postgresql_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"""Documentation fragments for the database_postgresql_v2 module"""

specdoc_examples = ['''
- name: Create a basic PostgreSQL database
linode.cloud.database_postgresql_v2:
label: my-db
region: us-mia
engine: postgresql/16
type: g6-nanode-1
allow_list:
- 0.0.0.0/0
state: present''', '''
- name: Create a PostgreSQL database with three nodes
linode.cloud.database_postgresql_v2:
label: my-db
region: us-mia
engine: postgresql/16
type: g6-standard-1
cluster_size: 3
allow_list:
- 0.0.0.0/0
state: present''', '''
- name: Create a PostgreSQL database with an explicit maintenance schedule
linode.cloud.database_postgresql_v2:
label: my-db
region: us-mia
engine: postgresql/16
type: g6-nanode-1
updates:
duration: 4
frequency: weekly
hour_of_day: 16
day_of_week: 4
state: present''', '''
- name: Create a PostgreSQL database forked from another database
linode.cloud.database_postgresql_v2:
label: my-db
region: us-mia
engine: postgresql/16
type: g6-nanode-1
fork:
source: 12345
state: present''', '''
- name: Delete a PostgreSQL database
linode.cloud.database_postgresql_v2:
label: my-db
state: absent''']

result_database_samples = ['''{
"allow_list": [
"10.0.0.3/32"
],
"cluster_size": 3,
"created": "2025-02-10T20:10:20",
"encrypted": true,
"engine": "postgresql",
"hosts": {
"primary": "a225891-akamai-prod-1798333-default.g2a.akamaidb.net",
"standby": "replica-a225891-akamai-prod-1798333-default.g2a.akamaidb.net"
},
"id": 12345,
"label": "my-db",
"members": {
"172.104.207.136": "primary",
"194.195.112.177": "failover",
"45.79.126.72": "failover"
},
"oldest_restore_time": "2025-02-10T20:15:07",
"platform": "rdbms-default",
"port": 11876,
"region": "ap-west",
"ssl_connection": true,
"status": "active",
"total_disk_size_gb": 30,
"type": "g6-standard-1",
"updated": "2025-02-10T20:25:55",
"updates": {
"day_of_week": 4,
"duration": 4,
"frequency": "weekly",
"hour_of_day": 16,
"pending": []
},
"used_disk_size_gb": 0,
"version": "8.0.35"
}''']

result_credentials_samples = ['''{
"password": "s3cur3P@ssw0rd",
"username": "akmadmin"
}''']

result_ssl_cert_samples = ['''{
"ca_certificate": "LS0tLS1CRUdJ...=="
}''']
6 changes: 2 additions & 4 deletions plugins/module_utils/linode_database_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@
),
"frequency": SpecField(
type=FieldType.string,
choices=["weekly", "monthly"],
choices=["weekly"],
default="weekly",
description=[
"Whether maintenance occurs on a weekly or monthly basis."
],
description=["The frequency at which maintenance occurs."],
),
"hour_of_day": SpecField(
type=FieldType.integer,
Expand Down
Loading
Loading