Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] refactor: created separate file with common module parts #188

Merged
merged 44 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a878acd
refactor: created separate file with common module parts
rmocanu-ionos Nov 23, 2023
4d2ad1c
test: change test order
rmocanu-ionos Nov 24, 2023
5d389b8
test: change how we import module in tests
rmocanu-ionos Nov 27, 2023
839b161
refactor: refactor info module and options
rmocanu-ionos Nov 27, 2023
c489671
delete compile module
rmocanu-ionos Nov 27, 2023
cba8d3a
fix: docs_generator and update_descriptions fix
rmocanu-ionos Nov 28, 2023
e4b870a
refactor: add info main to module_utils
rmocanu-ionos Dec 4, 2023
1bb516d
refactor: include main methods in module_utils
rmocanu-ionos Dec 5, 2023
19a854b
doc: possible fix for galaxy docs
rmocanu-ionos Dec 6, 2023
5ede36b
added script to updated DOCUMENTATION and EXAMPLES on modules
rmocanu-ionos Dec 8, 2023
dfd4649
changed some new modules, moved _get_request_id to methods
rmocanu-ionos Dec 11, 2023
43312c6
refactored alb modules, changed default module to use a list of clients
rmocanu-ionos Dec 12, 2023
a87ebbe
Merge branch 'master' into refactor/module-utils
rmocanu-ionos Jan 3, 2024
538afc1
refactor: change more info modules
rmocanu-ionos Jan 4, 2024
141ba49
refactor: change more info modules
rmocanu-ionos Jan 4, 2024
fcb4aac
refactor: change remaining info modules
rmocanu-ionos Jan 5, 2024
ceb54d8
refactor: changed some regular modules
rmocanu-ionos Jan 11, 2024
1bd9846
refactor: changed more modules, fixed case for multiple user agents
rmocanu-ionos Jan 12, 2024
3fac2cd
refactor: changed remaining modules, updated vm_autoscaling_group as …
rmocanu-ionos Jan 15, 2024
e94574c
test: updated tests, change user agents attribute type
rmocanu-ionos Jan 16, 2024
4908bba
doc: updated module documentations
rmocanu-ionos Jan 16, 2024
6b8ac2c
fix: fixed sonar bugs
rmocanu-ionos Jan 16, 2024
08ada97
docs: generated docs, fixed some sonar issues
rmocanu-ionos Jan 17, 2024
7dc5aad
fix: fixed some sonar issues
rmocanu-ionos Jan 17, 2024
3ad9e76
test: removed old test
rmocanu-ionos Jan 18, 2024
fb402b2
fix: user email to check user identity
rmocanu-ionos Jan 18, 2024
c118533
fix: wrong constant name
rmocanu-ionos Jan 18, 2024
7b92b8f
test: update dataplatform version
rmocanu-ionos Jan 18, 2024
878150d
Merge branch 'master' into refactor/module-utils
rmocanu-ionos Jan 19, 2024
9993075
fix workflow
rmocanu-ionos Jan 19, 2024
802cdd0
fix workflow auth
rmocanu-ionos Jan 19, 2024
f888bab
test: added dataplatform to cleanup
rmocanu-ionos Jan 22, 2024
a509225
fix: do_not_replace default value for vm_autoscaling group, error in …
rmocanu-ionos Jan 22, 2024
53c81bf
fix: recover transfer_object method, uncomment some tests
rmocanu-ionos Jan 26, 2024
746370c
fix: error in dns_secondary_zone module
rmocanu-ionos Jan 26, 2024
7613ac7
fix: error in group module
rmocanu-ionos Jan 26, 2024
5d52eb6
fix: fix mongo modules
rmocanu-ionos Jan 29, 2024
9ad1700
test: increate wait timeout
rmocanu-ionos Jan 31, 2024
a71c316
fix: fix indent in snapshot and missing user agent in alb rule
rmocanu-ionos Feb 7, 2024
b489e14
test: uncomment tests
rmocanu-ionos Feb 8, 2024
716b7a4
test: random names for container registries
rmocanu-ionos Feb 8, 2024
6c51a97
test: increase timeout
rmocanu-ionos Feb 9, 2024
1bf9629
fix: overwrite some methods for mongo user module, regenerate docs
rmocanu-ionos Feb 14, 2024
46ce580
chore: update version, added changelog, using galaxy to build local p…
rmocanu-ionos Feb 26, 2024
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
4 changes: 4 additions & 0 deletions .github/scripts/cleanup/delete-all-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


# load delete functions
source ./delete-dataplatform-resources.sh
source ./delete-backup-resources.sh
source ./delete-dbaas-resources.sh
source ./delete-user-management-resources.sh
Expand All @@ -18,6 +19,9 @@ source ./delete-nlb-resources.sh
source ./print-utils.sh


echo_step "starting cleanup on Data Platform resources"
delete_dataplatform_resources

echo_step "starting cleanup on Managed Backup resources"
delete_backup_resources

Expand Down
15 changes: 15 additions & 0 deletions .github/scripts/cleanup/delete-dataplatform-resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# ENV Vars:
# IONOS_USERNAME - username for IONOS Cloud APIs
# IONOS_PASSWORD - password for IONOS Cloud APIs
# IONOS_TOKEN - token for IONOS Cloud APIs

delete_all_args='--all --force'

function delete_dataplatform_resources() {
ionosctl dataplatform nodepool delete $delete_all_args
ionosctl dataplatform cluster delete $delete_all_args

echo_step_completed
}
1 change: 1 addition & 0 deletions .github/scripts/cleanup/delete-dbaas-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ delete_all_args='--all --force'

function delete_dbaas_resources() {
ionosctl dbaas postgres cluster delete $delete_all_args -W
ionosctl dbaas mongo cluster delete $delete_all_args

echo_step_completed
}
9 changes: 6 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:
env:
IONOS_USERNAME: ${{ secrets.IONOS_USER_V6 }}
IONOS_PASSWORD: ${{ secrets.IONOS_PASSWORD_V6 }}
IONOS_TOKEN: ${{ secrets.IONOS_PASSWORD_V6 }}
IONOSCTL_VERSION: 6.1.7
IONOS_TOKEN: ${{ secrets.IONOS_TOKEN_V6 }}
IONOSCTL_VERSION: 6.7.4
steps:
- name: Checking out module-ansible
uses: actions/checkout@v2
Expand Down Expand Up @@ -167,9 +167,12 @@ jobs:
python3 -m pip install ionoscloud-logging
python3 -m pip install ionoscloud-vm-autoscaling

- name: Install Ansible
- name: Install Ansible and IONOS module
run: |
python3 -m pip install ansible
ansible-galaxy collection build /home/runner/work/module-ansible/module-ansible/
ansible-galaxy collection install ionoscloudsdk-ionoscloud-$(grep version: galaxy.yml | cut -c10-).tar.gz --force
rm ionoscloudsdk-ionoscloud-$(grep version: galaxy.yml | cut -c10-).tar.gz

- name: Debug pip packages
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ on:

jobs:
cleanup_test_account:
needs: check_runs
name: Cleanup test account
runs-on: ubuntu-latest
env:
IONOS_USERNAME: ${{ secrets.IONOS_USER_V6 }}
IONOS_PASSWORD: ${{ secrets.IONOS_PASSWORD_V6 }}
IONOS_TOKEN: ${{ secrets.IONOS_PASSWORD_V6 }}
IONOSCTL_VERSION: 6.1.7
IONOS_TOKEN: ${{ secrets.IONOS_TOKEN_V6 }}
IONOSCTL_VERSION: 6.7.4
steps:
- name: Checking out module-ansible
uses: actions/checkout@v2
Expand Down
35 changes: 5 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,37 +76,12 @@ pip install ionoscloud-cert-manager
git clone https://github.com/ionos-cloud/module-ansible
```

2. Ansible must be made aware of the new module path. This too can be accomplished a few different ways depending on your requirements and environment.
2. Install the collection with ansible-galaxy.

* Ansible configuration file: `ansible.cfg`
* Environment variable: `ANSIBLE_LIBRARY`
* Command line parameter: `ansible-playbook --module-path [path]`

2a. The preferred method is to update the Ansible configuration with the module path. To include the path globally for all users, edit the `/etc/ansible/ansible.cfg` file and add `library = /path/to/module/ionos_cloud` under the **\[default\]** section. For example:

```text
[default]
library = /path/to/ionos-module-ansible/ionos_cloud
```

Note that the Ansible configuration file is read from several locations in the following order:

* `ANSIBLE_CONFIG` environment variable path
* `ansible.cfg` from the current directory
* `.ansible.cfg` in the user home directory
* `/etc/ansible/ansible.cfg`

2b. The module path can also be set using an environment variable. This variable will be lost once the terminal session is closed:

```text
export ANSIBLE_LIBRARY=/path/to/ionos-module-ansible/ionos_cloud
```

2c. The module path can be overridden with an `ansible-playbook` command line parameter:

```text
ansible-playbook --module-path /path/to/ionos-module-ansible/ionos_cloud playbook.yml
```
```bash
ansible-galaxy collection build .
ansible-galaxy collection install ionoscloudsdk-ionoscloud-<module_version>.tar.gz
```

## FAQ

Expand Down
31 changes: 3 additions & 28 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,36 +63,11 @@ pip install ionoscloud-cert-manager
git clone https://github.com/ionos-cloud/module-ansible
```

2. Ansible must be made aware of the new module path. This too can be accomplished a few different ways depending on your requirements and environment.

* Ansible configuration file: `ansible.cfg`
* Environment variable: `ANSIBLE_LIBRARY`
* Command line parameter: `ansible-playbook --module-path [path]`

2a. The preferred method is to update the Ansible configuration with the module path. To include the path globally for all users, edit the `/etc/ansible/ansible.cfg` file and add `library = /path/to/module/ionos_cloud` under the **\[default\]** section. For example:

```conf
[default]
library = /path/to/ionos-module-ansible/ionos_cloud
```

Note that the Ansible configuration file is read from several locations in the following order:

* `ANSIBLE_CONFIG` environment variable path
* `ansible.cfg` from the current directory
* `.ansible.cfg` in the user home directory
* `/etc/ansible/ansible.cfg`

2b. The module path can also be set using an environment variable. This variable will be lost once the terminal session is closed:

```bash
export ANSIBLE_LIBRARY=/path/to/ionos-module-ansible/ionos_cloud
```

2c. The module path can be overridden with an `ansible-playbook` command line parameter:
2. Install the collection with ansible-galaxy.

```bash
ansible-playbook --module-path /path/to/ionos-module-ansible/ionos_cloud playbook.yml
ansible-galaxy collection build .
ansible-galaxy collection install ionoscloudsdk-ionoscloud-<module_version>.tar.gz
```

## FAQ
Expand Down
12 changes: 1 addition & 11 deletions docs/api/applicationloadbalancer/application_load_balancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This is a simple module that supports creating or removing Application Loadbalan
datacenter: DatacenterName
wait: true
state: absent

```

&nbsp;
Expand Down Expand Up @@ -140,11 +140,6 @@ This is a simple module that supports creating or removing Application Loadbalan
<td>The ID or name of the datacenter.</td>
</tr>
<tr>
<td>allow_replace<br/><mark style="color:blue;">bool</mark></td>
<td align="center">False</td>
<td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br />Default: False</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
<td align="center">False</td>
<td>The Ionos API base URL.</td>
Expand Down Expand Up @@ -337,11 +332,6 @@ This is a simple module that supports creating or removing Application Loadbalan
<td>The ID or name of the Application Loadbalancer.</td>
</tr>
<tr>
<td>allow_replace<br/><mark style="color:blue;">bool</mark></td>
<td align="center">False</td>
<td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br />Default: False</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
<td align="center">False</td>
<td>The Ionos API base URL.</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This is a simple module that supports creating or removing Application Loadbalan
application_load_balancer: AppLoadBalancerName
flowlog: FlowlogName
state: absent

```

&nbsp;
Expand Down Expand Up @@ -138,11 +138,6 @@ This is a simple module that supports creating or removing Application Loadbalan
<td>The ID or name of the Application Loadbalancer.</td>
</tr>
<tr>
<td>allow_replace<br/><mark style="color:blue;">bool</mark></td>
<td align="center">False</td>
<td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br />Default: False</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
<td align="center">False</td>
<td>The Ionos API base URL.</td>
Expand Down Expand Up @@ -342,11 +337,6 @@ This is a simple module that supports creating or removing Application Loadbalan
<td>The ID or name of the Flowlog.</td>
</tr>
<tr>
<td>allow_replace<br/><mark style="color:blue;">bool</mark></td>
<td align="center">False</td>
<td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br />Default: False</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
<td align="center">False</td>
<td>The Ionos API base URL.</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ This is a simple module that supports listing Flowlogs.
<td>The ID or name of the Application Loadbalancer.</td>
</tr>
<tr>
<td>filters<br/><mark style="color:blue;">dict</mark></td>
<td>depth<br/><mark style="color:blue;">int</mark></td>
<td align="center">False</td>
<td>Filter that can be used to list only objects which have a certain set of propeties. Filters should be a dict with a key containing keys and value pair in the following format:'properties.name': 'server_name'</td>
<td>The depth used when retrieving the items.<br />Default: 1</td>
</tr>
<tr>
<td>depth<br/><mark style="color:blue;">int</mark></td>
<td>filters<br/><mark style="color:blue;">dict</mark></td>
<td align="center">False</td>
<td>The depth used when retrieving the items.<br />Default: 1</td>
<td>Filter that can be used to list only objects which have a certain set of propeties. Filters should be a dict with a key containing keys and value pair in the following format: 'properties.name': 'server_name'</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# application_load_balancer_forwardingrule

This is a simple module that supports creating or removing Application Loadbalancer Flowlog rules.
This is a simple module that supports creating or removing Application Loadbalancer Forwarding rules.

## Example Syntax

Expand Down Expand Up @@ -48,7 +48,7 @@ This is a simple module that supports creating or removing Application Loadbalan
application_load_balancer: AppLoadBalancerName
forwarding_rule: "RuleName - UPDATED"
state: absent

```

&nbsp;
Expand Down Expand Up @@ -206,11 +206,6 @@ This is a simple module that supports creating or removing Application Loadbalan
<td>The ID or name of the Application Loadbalancer.</td>
</tr>
<tr>
<td>allow_replace<br/><mark style="color:blue;">bool</mark></td>
<td align="center">False</td>
<td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br />Default: False</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
<td align="center">False</td>
<td>The Ionos API base URL.</td>
Expand Down Expand Up @@ -433,11 +428,6 @@ This is a simple module that supports creating or removing Application Loadbalan
<td>The ID or name of the Application Loadbalancer forwarding rule.</td>
</tr>
<tr>
<td>allow_replace<br/><mark style="color:blue;">bool</mark></td>
<td align="center">False</td>
<td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br />Default: False</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
<td align="center">False</td>
<td>The Ionos API base URL.</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ This is a simple module that supports listing Forwarding Rules.
<td>The ID or name of the Application Loadbalancer.</td>
</tr>
<tr>
<td>filters<br/><mark style="color:blue;">dict</mark></td>
<td>depth<br/><mark style="color:blue;">int</mark></td>
<td align="center">False</td>
<td>Filter that can be used to list only objects which have a certain set of propeties. Filters should be a dict with a key containing keys and value pair in the following format:'properties.name': 'server_name'</td>
<td>The depth used when retrieving the items.<br />Default: 1</td>
</tr>
<tr>
<td>depth<br/><mark style="color:blue;">int</mark></td>
<td>filters<br/><mark style="color:blue;">dict</mark></td>
<td align="center">False</td>
<td>The depth used when retrieving the items.<br />Default: 1</td>
<td>Filter that can be used to list only objects which have a certain set of propeties. Filters should be a dict with a key containing keys and value pair in the following format: 'properties.name': 'server_name'</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ This is a simple module that supports listing Application Load Balancers.
<td>The ID or name of the datacenter.</td>
</tr>
<tr>
<td>filters<br/><mark style="color:blue;">dict</mark></td>
<td>depth<br/><mark style="color:blue;">int</mark></td>
<td align="center">False</td>
<td>Filter that can be used to list only objects which have a certain set of propeties. Filters should be a dict with a key containing keys and value pair in the following format:'properties.name': 'server_name'</td>
<td>The depth used when retrieving the items.<br />Default: 1</td>
</tr>
<tr>
<td>depth<br/><mark style="color:blue;">int</mark></td>
<td>filters<br/><mark style="color:blue;">dict</mark></td>
<td align="center">False</td>
<td>The depth used when retrieving the items.<br />Default: 1</td>
<td>Filter that can be used to list only objects which have a certain set of propeties. Filters should be a dict with a key containing keys and value pair in the following format: 'properties.name': 'server_name'</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
Expand Down
12 changes: 1 addition & 11 deletions docs/api/applicationloadbalancer/target_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This is a simple module that supports creating or removing Target Groups.
wait: true
wait_timeout: 2000
state: absent

```

&nbsp;
Expand Down Expand Up @@ -184,11 +184,6 @@ This is a simple module that supports creating or removing Target Groups.
<td>Array of items in the collection.</td>
</tr>
<tr>
<td>allow_replace<br/><mark style="color:blue;">bool</mark></td>
<td align="center">False</td>
<td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br />Default: False</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
<td align="center">False</td>
<td>The Ionos API base URL.</td>
Expand Down Expand Up @@ -375,11 +370,6 @@ This is a simple module that supports creating or removing Target Groups.
<td>The ID or name of the Target Group.</td>
</tr>
<tr>
<td>allow_replace<br/><mark style="color:blue;">bool</mark></td>
<td align="center">False</td>
<td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br />Default: False</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
<td align="center">False</td>
<td>The Ionos API base URL.</td>
Expand Down
8 changes: 4 additions & 4 deletions docs/api/applicationloadbalancer/target_group_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ This is a simple module that supports listing Target Groups.
</thead>
<tbody>
<tr>
<td>filters<br/><mark style="color:blue;">dict</mark></td>
<td>depth<br/><mark style="color:blue;">int</mark></td>
<td align="center">False</td>
<td>Filter that can be used to list only objects which have a certain set of propeties. Filters should be a dict with a key containing keys and value pair in the following format:'properties.name': 'server_name'</td>
<td>The depth used when retrieving the items.<br />Default: 1</td>
</tr>
<tr>
<td>depth<br/><mark style="color:blue;">int</mark></td>
<td>filters<br/><mark style="color:blue;">dict</mark></td>
<td align="center">False</td>
<td>The depth used when retrieving the items.<br />Default: 1</td>
<td>Filter that can be used to list only objects which have a certain set of propeties. Filters should be a dict with a key containing keys and value pair in the following format: 'properties.name': 'server_name'</td>
</tr>
<tr>
<td>api_url<br/><mark style="color:blue;">str</mark></td>
Expand Down
Loading
Loading