From 88e61076c9c63926000a6c5ea83fb6efe1cf5c28 Mon Sep 17 00:00:00 2001
From: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com>
Date: Thu, 12 Dec 2024 17:03:01 -0500
Subject: [PATCH 1/3] Update OBJ tests and examples (#633)
* Update version of the AWS Collection
* Update obj tests
---
.github/workflows/integration-tests-pr.yml | 9 +--------
.github/workflows/integration-tests.yml | 2 +-
.github/workflows/nightly-smoke-tests.yml | 2 +-
.github/workflows/release.yml | 2 +-
.../obj_static_site/roles/static_site/tasks/main.yml | 7 ++++---
tests/integration/targets/object_basic/tasks/main.yaml | 10 +++++++---
.../targets/object_keys_basic/tasks/main.yaml | 10 +++++++---
7 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/.github/workflows/integration-tests-pr.yml b/.github/workflows/integration-tests-pr.yml
index e10b9145..19743f0f 100644
--- a/.github/workflows/integration-tests-pr.yml
+++ b/.github/workflows/integration-tests-pr.yml
@@ -39,13 +39,6 @@ jobs:
fetch-depth: 0
submodules: 'recursive'
- # Install deps
- - name: update packages
- run: sudo apt-get update -y
-
- - name: install make
- run: sudo apt-get install -y build-essential
-
- name: setup python 3
uses: actions/setup-python@v5
with:
@@ -55,7 +48,7 @@ jobs:
run: make deps
- name: install ansible dependencies
- run: ansible-galaxy collection install amazon.aws:==6.0.1
+ run: ansible-galaxy collection install amazon.aws:==9.1.0
- name: install collection
run: make install
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
index 49fbfb0b..051ea283 100644
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -52,7 +52,7 @@ jobs:
run: make deps
- name: Install ansible dependencies
- run: ansible-galaxy collection install amazon.aws:==6.0.1
+ run: ansible-galaxy collection install amazon.aws:==9.1.0
- name: Install Collection
run: make install
diff --git a/.github/workflows/nightly-smoke-tests.yml b/.github/workflows/nightly-smoke-tests.yml
index da150285..888aae95 100644
--- a/.github/workflows/nightly-smoke-tests.yml
+++ b/.github/workflows/nightly-smoke-tests.yml
@@ -40,7 +40,7 @@ jobs:
run: make deps
- name: Install ansible dependencies
- run: ansible-galaxy collection install amazon.aws:==6.0.1
+ run: ansible-galaxy collection install amazon.aws:==9.1.0
- name: Install Collection
run: make install
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 785c5993..f5cd811b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -33,7 +33,7 @@ jobs:
run: make deps
- name: install ansible dependencies
- run: ansible-galaxy collection install amazon.aws:==6.0.1
+ run: ansible-galaxy collection install amazon.aws:==9.1.0
- name: inject docs using specdoc
run: make inject
diff --git a/examples/obj_static_site/roles/static_site/tasks/main.yml b/examples/obj_static_site/roles/static_site/tasks/main.yml
index 6e0b2c7d..68a62ee0 100644
--- a/examples/obj_static_site/roles/static_site/tasks/main.yml
+++ b/examples/obj_static_site/roles/static_site/tasks/main.yml
@@ -12,15 +12,15 @@
- name: Create an Object Storage bucket
amazon.aws.s3_bucket:
name: "{{ bucket_name }}"
- s3_url: "https://{{ cluster_info.clusters[0].domain }}/"
+ endpoint_url: "https://{{ cluster_info.clusters[0].domain }}/"
aws_access_key: "{{ obj_key.key.access_key }}"
aws_secret_key: "{{ obj_key.key.secret_key }}"
state: present
- name: Upload the static site files
- amazon.aws.aws_s3:
- s3_url: "https://{{ cluster_info.clusters[0].domain }}/"
+ amazon.aws.s3_object:
+ endpoint_url: "https://{{ cluster_info.clusters[0].domain }}/"
aws_access_key: "{{ obj_key.key.access_key }}"
aws_secret_key: "{{ obj_key.key.secret_key }}"
@@ -29,6 +29,7 @@
src: "{{ item }}"
mode: put
permission: public-read
+ ceph: true
with_fileglob: 'roles/static_site/files/public/*.html'
- name: Configure the Object Storage Bucket as a website with index and error pages
diff --git a/tests/integration/targets/object_basic/tasks/main.yaml b/tests/integration/targets/object_basic/tasks/main.yaml
index 9cf48616..b4e3f052 100644
--- a/tests/integration/targets/object_basic/tasks/main.yaml
+++ b/tests/integration/targets/object_basic/tasks/main.yaml
@@ -39,10 +39,12 @@
- name: Create an S3 bucket
amazon.aws.s3_bucket:
- s3_url: 'http://{{ info_by_id.clusters[0].domain }}/'
+ endpoint_url: 'https://{{ info_by_id.clusters[0].domain }}/'
aws_access_key: '{{ create_key.key.access_key }}'
aws_secret_key: '{{ create_key.key.secret_key }}'
name: 'test-ansible-bucket-{{ r }}'
+ ceph: true
+ region: "default"
state: present
register: create_bucket
@@ -77,14 +79,16 @@
- create_access.key.bucket_access[1].permissions == 'read_only'
always:
- - ignore_errors: yes
+ - ignore_errors: true
block:
- name: Delete the S3 bucket
amazon.aws.s3_bucket:
- s3_url: 'http://{{ info_by_id.clusters[0].domain }}/'
+ endpoint_url: 'https://{{ info_by_id.clusters[0].domain }}/'
aws_access_key: '{{ create_key.key.access_key }}'
aws_secret_key: '{{ create_key.key.secret_key }}'
name: '{{ create_bucket.name }}'
+ ceph: true
+ region: "default"
state: absent
register: delete_bucket
diff --git a/tests/integration/targets/object_keys_basic/tasks/main.yaml b/tests/integration/targets/object_keys_basic/tasks/main.yaml
index b40fd7c7..fabff4e9 100644
--- a/tests/integration/targets/object_keys_basic/tasks/main.yaml
+++ b/tests/integration/targets/object_keys_basic/tasks/main.yaml
@@ -58,11 +58,13 @@
- name: Create an S3 bucket using the key
amazon.aws.s3_bucket:
- s3_url: "https://{{ update.key.regions[0].s3_endpoint }}/"
+ endpoint_url: "https://{{ update.key.regions[0].s3_endpoint }}/"
aws_access_key: "{{ create.key.access_key }}"
aws_secret_key: "{{ create.key.secret_key }}"
name: "test-ansible-bucket-{{ r }}"
state: present
+ ceph: true
+ region: "default"
register: create_bucket
- name: Assert bucket was created
@@ -137,14 +139,16 @@
failed_when: "'`access` is not an updatable field' not in update_scoped.msg"
always:
- - ignore_errors: yes
+ - ignore_errors: true
block:
- name: Delete the OBJ bucket
amazon.aws.s3_bucket:
- s3_url: "https://{{ update.key.regions[0].s3_endpoint }}//"
+ endpoint_url: "https://{{ update.key.regions[0].s3_endpoint }}//"
aws_access_key: "{{ create.key.access_key }}"
aws_secret_key: "{{ create.key.secret_key }}"
name: "{{ create_bucket.name }}"
+ ceph: true
+ region: "default"
state: absent
register: delete_bucket
From 997487070633aac016532ccbb7f5241062705039 Mon Sep 17 00:00:00 2001
From: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com>
Date: Fri, 20 Dec 2024 17:11:15 -0500
Subject: [PATCH 2/3] Add security workflows (#634)
* Add security workflows
* Remove apt install steps in all workflows
---
.github/workflows/codeql.yml | 39 +++++++++++++++++++++++
.github/workflows/dependency-review.yml | 19 +++++++++++
.github/workflows/docs.yml | 12 -------
.github/workflows/integration-tests.yml | 3 --
.github/workflows/nightly-smoke-tests.yml | 3 --
5 files changed, 58 insertions(+), 18 deletions(-)
create mode 100644 .github/workflows/codeql.yml
create mode 100644 .github/workflows/dependency-review.yml
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 00000000..de49ed0c
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,39 @@
+name: "CodeQL Advanced"
+
+on:
+ push:
+ branches: [ "dev", "main", "proj/*" ]
+ pull_request:
+ branches: [ "dev", "main", "proj/*" ]
+ schedule:
+ - cron: '0 13 * * 5'
+
+jobs:
+ analyze:
+ name: Analyze (${{ matrix.language }})
+ runs-on: ubuntu-latest
+ permissions:
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - language: python
+ build-mode: none
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v3
+ with:
+ languages: ${{ matrix.language }}
+ build-mode: ${{ matrix.build-mode }}
+ queries: security-and-quality
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v3
+ with:
+ category: "/language:${{matrix.language}}"
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
new file mode 100644
index 00000000..bf9f46d8
--- /dev/null
+++ b/.github/workflows/dependency-review.yml
@@ -0,0 +1,19 @@
+name: 'Dependency review'
+on:
+ pull_request:
+ branches: [ "dev", "main", "proj/*" ]
+
+permissions:
+ contents: read
+ pull-requests: write
+
+jobs:
+ dependency-review:
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Checkout repository'
+ uses: actions/checkout@v4
+ - name: 'Dependency Review'
+ uses: actions/dependency-review-action@v4
+ with:
+ comment-summary-in-pr: on-failure
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 754d0506..1df2f9d5 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -17,12 +17,6 @@ jobs:
with:
path: .ansible/collections/ansible_collections/linode/cloud
- - name: update packages
- run: sudo apt-get update -y
-
- - name: install packages
- run: sudo apt-get install -y make
-
- name: setup python 3
uses: actions/setup-python@v5
with:
@@ -60,12 +54,6 @@ jobs:
with:
path: .ansible/collections/ansible_collections/linode/cloud
- - name: update packages
- run: sudo apt-get update -y
-
- - name: install packages
- run: sudo apt-get install -y make
-
- name: setup python 3
uses: actions/setup-python@v5
with:
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
index 051ea283..64f6a45d 100644
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -40,9 +40,6 @@ jobs:
fetch-depth: 0
submodules: 'recursive'
- - name: Update packages
- run: sudo apt-get update -y
-
- name: Setup Python 3
uses: actions/setup-python@v5
with:
diff --git a/.github/workflows/nightly-smoke-tests.yml b/.github/workflows/nightly-smoke-tests.yml
index 888aae95..9e503542 100644
--- a/.github/workflows/nightly-smoke-tests.yml
+++ b/.github/workflows/nightly-smoke-tests.yml
@@ -28,9 +28,6 @@ jobs:
fetch-depth: 0
submodules: 'recursive'
- - name: Update packages
- run: sudo apt-get update -y
-
- name: Setup Python 3
uses: actions/setup-python@v5
with:
From 4da84f0c09e7606293939e0955ed531317315ad8 Mon Sep 17 00:00:00 2001
From: Ye Chen <127243817+yec-akamai@users.noreply.github.com>
Date: Tue, 7 Jan 2025 11:04:51 -0500
Subject: [PATCH 3/3] new: Support IP module to allocate a new IP (#628)
* ip module
* simplify test
* address comments
* fix lint&doc
* handle absent
---
README.md | 1 +
docs/modules/ip.md | 38 +++++
plugins/module_utils/doc_fragments/ip.py | 25 ++++
plugins/modules/ip.py | 137 ++++++++++++++++++
.../targets/ip_basic/tasks/main.yaml | 53 +++++++
5 files changed, 254 insertions(+)
create mode 100644 docs/modules/ip.md
create mode 100644 plugins/module_utils/doc_fragments/ip.py
create mode 100644 plugins/modules/ip.py
create mode 100644 tests/integration/targets/ip_basic/tasks/main.yaml
diff --git a/README.md b/README.md
index 49e15ab1..15a1da13 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,7 @@ Name | Description |
[linode.cloud.firewall_device](./docs/modules/firewall_device.md)|Manage Linode Firewall Devices.|
[linode.cloud.image](./docs/modules/image.md)|Manage a Linode Image.|
[linode.cloud.instance](./docs/modules/instance.md)|Manage Linode Instances, Configs, and Disks.|
+[linode.cloud.ip](./docs/modules/ip.md)|Allocates a new IPv4 Address on your Account. The Linode must be configured to support additional addresses - please Open a support ticket requesting additional addresses before attempting allocation.|
[linode.cloud.ip_assign](./docs/modules/ip_assign.md)|Assign IPs to Linodes in a given Region.|
[linode.cloud.ip_rdns](./docs/modules/ip_rdns.md)|Manage a Linode IP address's rDNS.|
[linode.cloud.ip_share](./docs/modules/ip_share.md)|Manage the Linode shared IPs.|
diff --git a/docs/modules/ip.md b/docs/modules/ip.md
new file mode 100644
index 00000000..f9175fce
--- /dev/null
+++ b/docs/modules/ip.md
@@ -0,0 +1,38 @@
+# ip
+
+Allocates a new IPv4 Address on your Account. The Linode must be configured to support additional addresses - please Open a support ticket requesting additional addresses before attempting allocation.
+
+- [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.
It can be exposed by the environment variable `LINODE_API_TOKEN` instead.
See details in [Usage](https://github.com/linode/ansible_linode?tab=readme-ov-file#usage). |
+
+## Examples
+
+```yaml
+- name: Allocate IP to Linode
+ linode.cloud.ip:
+ linode_id: 123
+ public: true
+ type: ipv4
+ state: present
+```
+
+
+## Parameters
+
+| Field | Type | Required | Description |
+|-----------|------|----------|------------------------------------------------------------------------------|
+| `state` |