Skip to content

Commit

Permalink
Merge pull request #18 from serverscom/updating_ansible_version
Browse files Browse the repository at this point in the history
Updating ansible version
  • Loading branch information
amarao authored Jan 19, 2024
2 parents 167c4df + aea5d7f commit 0624dc8
Show file tree
Hide file tree
Showing 19 changed files with 104 additions and 87 deletions.
33 changes: 13 additions & 20 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: Test and build
push:
paths-ignore:
- ".github/**"
workflow_dispatch:

jobs:
lint:
Expand All @@ -22,10 +23,7 @@ jobs:
strategy:
matrix:
python_version:
- "3.8"
- "3.7"
- "3.6"
# - "3.10"
- "3.11"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -36,7 +34,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Sanity tests with dependencies
run: ansible-test sanity --requirements --python ${{ matrix.python_version }}
Expand All @@ -55,22 +52,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Configure integration tests
run: |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
env:
SC_TOKEN: "${{ secrets.SC_TOKEN }}"
- name: Integration tests
run: ansible-test integration --requirements --python 3.8
run: ansible-test integration --requirements --python 3.11
sc_ssh_key
sc_cloud_computing_flavors_info
sc_cloud_computing_regions_info
Expand Down Expand Up @@ -98,22 +94,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Configure integration tests
run: |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
env:
SC_TOKEN: "${{ secrets.SC_TOKEN }}"
- name: Integration tests
run: ansible-test integration --requirements --python 3.8
run: ansible-test integration --requirements --python 3.11
sc_ssh_key
sc_baremetal_locations_info
sc_baremetal_servers_info
Expand All @@ -136,22 +131,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Configure integration tests
run: |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
env:
SC_TOKEN: "${{ secrets.SC_TOKEN }}"
- name: Integration tests
run: ansible-test integration --requirements --python 3.8
run: ansible-test integration --requirements --python 3.11
sc_l2_segment
sc_l2_segment_aliases
sc_l2_segments_info
Expand All @@ -172,14 +166,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Remove tests from final distribution
run: rm -r tests/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

__metaclass__ = type

_ignored = DEFAULT_API_ENDPOINT # to silence pylint warning, it is reimported

CHANGED = True
NOT_CHANGED = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Retrive list of all existing dedicated baremetal servers.
notes:
- Not to be confused with M(sc_dedicated_servers_info).
- Not to be confused with M(serverscom.sc_api.sc_dedicated_servers_info).
- Includes information for both dedicated and other types of servers
(f.e. kubernetes baremetal node)
Expand Down Expand Up @@ -88,7 +88,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
required: true
description:
- Id of cloud computing region.
- Use I(sc_cloud_computing_regions_info) module to retrive list of
available regions.
- Use I(serverscom.sc_api.sc_cloud_computing_regions_info) module
to retrive list of available regions.
"""

RETURN = """
Expand Down Expand Up @@ -101,7 +101,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
required: true
description:
- Id of cloud computing region.
- Use I(sc_cloud_computing_regions_info) module to retrive list of
available regions.
- Use I(serverscom.sc_api.sc_cloud_computing_regions_info) module
to retrive list of available regions.
"""

RETURN = """
Expand Down Expand Up @@ -107,7 +107,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
type: int
description:
- Id of the cloud region for the instance
- Use M(sc_cloud_computing_regions_info) to get list of available
regions.
- Use M(serverscom.sc_api.sc_cloud_computing_regions_info) to get list
of available regions.
- Required for I(state)=C(present).
- May be used for other I(state) to narrow search to one region with
I(name).
Expand Down Expand Up @@ -162,8 +162,8 @@
type: str
description:
- Fingerprint of the public ssh key to use for user cloud-user.
- Fingerprint must be registered. Use M(sc_ssh_key) to register
public key.
- Fingerprint must be registered. Use M(serverscom.sc_api.sc_ssh_key)
to register public key.
- Mutually exclusive with I(ssh_key_name)
- Instance is created with password if no I(ssh_key_fingerprint)
or I(ssh_key_name) is used.
Expand Down Expand Up @@ -209,8 +209,8 @@
- Value C(0) is used to disable wait.
- If C(0) is set, module works in 'fire-and-forget' mode.
- ACTIVE state doesn't mean that instance is ready to accept ssh
connections. Use M(wait_for_connection) module wait until instance
finishes booting.
connections. Use M(ansible.builtin.wait_for_connection) module
to wait until instance finishes booting.
- wait time is independent for I(retry_on_conflicts) and status wait.
- If instance is in conflicting state, first module will retry up to
I(wait) seconds to delete it, and then wait for I(wait) seconds for
Expand Down Expand Up @@ -242,8 +242,8 @@
- Upgrades are autoconfirmed in 72 hours.
- Used only for I(state)=C(upgraded), ignored of other I(state).
- If instance is in the state AWAITING_UPGRADE_CONFIRM,
calling M(cloud_computing_instance) with I(state)=C(upgraded)
confirm upgrade.
calling M(serverscom.sc_api.cloud_computing_instance)
with I(state)=C(upgraded) confirm upgrade.
- If I(wait)=C(0) instance upgrage is not confirmed even if
I(confirm_upgrade)=C(true).
"""
Expand Down Expand Up @@ -376,15 +376,15 @@

EXAMPLES = """
- name: Delete instance by ID
sc_cloud_computing_instance:
serverscom.sc_api.sc_cloud_computing_instance:
token: '{{ sc_token }}'
instance_id: M7e5Ba2v
state: absent
wait: 60
update_interval: 5
- name: Delete instance by name in region 3
sc_cloud_computing_instance:
serverscom.sc_api.sc_cloud_computing_instance:
token: '{{ sc_token }}'
name: test
region_id: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
description: >
Allow to control power state and rescue mode for instance.
This module does not allow removal and creation of the instance,
use M(sc_cloud_computing_instance) with state=present/absent.
use M(serverscom.sc_api.sc_cloud_computing_instance)
with state=present/absent.
options:
endpoint:
Expand Down Expand Up @@ -111,9 +112,9 @@
- Value C(0) is used to disable wait.
- If C(0) is set, module works in 'fire-and-forget' mode.
- ACTIVE state doesn't mean that instance is ready to accept ssh
connections. Use M(wait_for_connection) module wait until instance
finishes booting. handlers or when statement may be used
to preserve idempotency.
connections. Use M(ansible.builtin.wait_for_connection) module
wait until instance finishes booting.
handlers or when statement may be used to preserve idempotency.
update_interval:
type: int
Expand Down Expand Up @@ -280,7 +281,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
type: int
description:
- Id of cloud computing region to filter.
- Use I(sc_cloud_computing_regions_info) module to retrive list of
available regions.
- Use I(serverscom.sc_api.sc_cloud_computing_regions_info) module
to retrive list of available regions.
- Module returns instances for all regions if I(region_id) is not
specified.
"""
Expand Down Expand Up @@ -178,7 +178,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
required: true
description:
- Id of cloud computing region.
- Use I(sc_cloud_computing_regions_info) module to retrive list of
available regions.
- Use I(serverscom.sc_api.sc_cloud_computing_regions_info) module
to retrive list of available regions.
"""

RETURN = """
Expand Down Expand Up @@ -132,7 +132,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@

EXAMPLES = """
- name: Get server info
sc_dedicated_server_info:
serverscom.sc_api.sc_dedicated_server_info:
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MzgxMjEsInR5cGUiOiJVc2VyIiwiYWNjZXNzX2dyYW50X2lkIjoyNjgwNywiZXhwIjoyMjI2OTk3NjMwfQ.rO4nGXNgXggjNmMJBLXovOh1coNrDWl4dGrGFupYXJE'
id: '0m592Zmn'
register: srv
Expand All @@ -259,7 +259,7 @@
msg: 'Server {{ srv.name }} has IP {{ srv.public_ipv4_address }}'
- name: Wait until server is ready
sc_dedicated_server_info:
serverscom.sc_api.sc_dedicated_server_info:
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MzgxMjEsInR5cGUiOiJVc2VyIiwiYWNjZXNzX2dyYW50X2lkIjoyNjgwNywiZXhwIjoyMjI2OTk3NjMwfQ.rO4nGXNgXggjNmMJBLXovOh1coNrDWl4dGrGFupYXJE'
id: '0m592Zmn'
register: srv
Expand All @@ -270,7 +270,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
elements: str
description:
- Array of fingerprints of public ssh keys to add for root user.
- Keys must be registered before use by module M(sc_ssh_key).
- Keys must be registered before use by module M(serverscom.sc_api.sc_ssh_key).
- Mutually exclusive with I(ssh_key_name).
- Server is reinstalled with root password only if no I(ssh_keys) or
I(ssh_key_name) specified.
Expand All @@ -181,8 +181,8 @@
- When server become 'ready' after reinstallation,
it can still be in booting state for some time
and do not answer ssh/ping request.
Use M(wait_for_connection) module to wait the server
to become available though ssh.
Use M(serverscom.sc_api.wait_for_connection) module
to wait the server to become available though ssh.
- Installation may start few minutes later than request,
during this time server is responding with 'old' ssh.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@


from ansible.module_utils.basic import AnsibleModule
import json
from ansible_collections.serverscom.sc_api.plugins.module_utils.modules import (
DEFAULT_API_ENDPOINT,
SCBaseError,
Expand Down
Loading

0 comments on commit 0624dc8

Please sign in to comment.