2020-05-12 10:20:09 -05:00
|
|
|
#!/usr/bin/python
|
2022-07-28 09:19:14 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2020-05-12 10:20:09 -05:00
|
|
|
|
|
|
|
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
module: server_info
|
|
|
|
short_description: Retrieve information about one or more compute instances
|
2020-06-17 12:35:09 -05:00
|
|
|
author: OpenStack Ansible SIG
|
2020-05-12 10:20:09 -05:00
|
|
|
description:
|
|
|
|
- Retrieve information about server instances from OpenStack.
|
|
|
|
notes:
|
|
|
|
- The result contains a list of servers.
|
|
|
|
options:
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
name:
|
2020-04-23 14:39:26 +03:00
|
|
|
description:
|
|
|
|
- restrict results to servers with names or UUID matching
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
this glob expression such as web*.
|
|
|
|
aliases: ['server']
|
2020-04-23 14:39:26 +03:00
|
|
|
type: str
|
|
|
|
detailed:
|
|
|
|
description:
|
|
|
|
- when true, return additional detail about servers at the expense
|
|
|
|
of additional API calls.
|
|
|
|
type: bool
|
2023-02-21 09:32:35 +01:00
|
|
|
default: 'false'
|
2020-04-23 14:39:26 +03:00
|
|
|
filters:
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
description: |
|
|
|
|
Used for further filtering of results. Either a string containing a
|
|
|
|
JMESPath expression or a dictionary of meta data. Elements of the latter
|
|
|
|
may, themselves, be dictionaries.
|
2020-04-23 14:39:26 +03:00
|
|
|
type: dict
|
|
|
|
all_projects:
|
|
|
|
description:
|
|
|
|
- Whether to list servers from all projects or just the current auth
|
|
|
|
scoped project.
|
|
|
|
type: bool
|
2023-02-21 09:32:35 +01:00
|
|
|
default: 'false'
|
2020-05-12 10:20:09 -05:00
|
|
|
extends_documentation_fragment:
|
|
|
|
- openstack.cloud.openstack
|
|
|
|
'''
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
- name: Gather information about all 'web*' servers in active state
|
|
|
|
openstack.cloud.server_info:
|
|
|
|
cloud: devstack
|
|
|
|
name: web*
|
2020-05-12 10:20:09 -05:00
|
|
|
filters:
|
|
|
|
vm_state: active
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
|
|
|
|
- name: Filter servers with nested dictionaries
|
|
|
|
openstack.cloud.server_info:
|
|
|
|
cloud: devstack
|
|
|
|
filters:
|
|
|
|
metadata:
|
|
|
|
key1: value1
|
|
|
|
key2: value2
|
|
|
|
'''
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
servers:
|
|
|
|
description: List of servers matching the filters
|
|
|
|
elements: dict
|
|
|
|
type: list
|
|
|
|
returned: always
|
|
|
|
contains:
|
|
|
|
access_ipv4:
|
|
|
|
description: |
|
|
|
|
IPv4 address that should be used to access this server.
|
|
|
|
May be automatically set by the provider.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
access_ipv6:
|
|
|
|
description: |
|
|
|
|
IPv6 address that should be used to access this
|
|
|
|
server. May be automatically set by the provider.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
addresses:
|
|
|
|
description: |
|
|
|
|
A dictionary of addresses this server can be accessed through.
|
|
|
|
The dictionary contains keys such as 'private' and 'public',
|
|
|
|
each containing a list of dictionaries for addresses of that
|
|
|
|
type. The addresses are contained in a dictionary with keys
|
|
|
|
'addr' and 'version', which is either 4 or 6 depending on the
|
|
|
|
protocol of the IP address.
|
|
|
|
returned: success
|
|
|
|
type: dict
|
|
|
|
admin_password:
|
|
|
|
description: |
|
|
|
|
When a server is first created, it provides the administrator
|
|
|
|
password.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
attached_volumes:
|
|
|
|
description: |
|
|
|
|
A list of an attached volumes. Each item in the list contains
|
|
|
|
at least an 'id' key to identify the specific volumes.
|
|
|
|
returned: success
|
|
|
|
type: list
|
|
|
|
availability_zone:
|
|
|
|
description: |
|
|
|
|
The name of the availability zone this server is a part of.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
block_device_mapping:
|
|
|
|
description: |
|
|
|
|
Enables fine grained control of the block device mapping for an
|
|
|
|
instance. This is typically used for booting servers from
|
|
|
|
volumes.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
compute_host:
|
|
|
|
description: |
|
|
|
|
The name of the compute host on which this instance is running.
|
|
|
|
Appears in the response for administrative users only.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
config_drive:
|
|
|
|
description: |
|
|
|
|
Indicates whether or not a config drive was used for this
|
|
|
|
server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
created_at:
|
|
|
|
description: Timestamp of when the server was created.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description: |
|
|
|
|
The description of the server. Before microversion
|
|
|
|
2.19 this was set to the server name.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
disk_config:
|
|
|
|
description: The disk configuration. Either AUTO or MANUAL.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
flavor:
|
|
|
|
description: The flavor property as returned from server.
|
|
|
|
returned: success
|
|
|
|
type: dict
|
|
|
|
flavor_id:
|
|
|
|
description: |
|
|
|
|
The flavor reference, as a ID or full URL, for the flavor to
|
|
|
|
use for this server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
has_config_drive:
|
|
|
|
description: |
|
|
|
|
Indicates whether a configuration drive enables metadata
|
|
|
|
injection. Not all cloud providers enable this feature.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
host_id:
|
|
|
|
description: An ID representing the host of this server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
host_status:
|
|
|
|
description: The host status.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
hostname:
|
|
|
|
description: |
|
|
|
|
The hostname set on the instance when it is booted.
|
|
|
|
By default, it appears in the response for administrative users
|
|
|
|
only.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
hypervisor_hostname:
|
|
|
|
description: |
|
|
|
|
The hypervisor host name. Appears in the response for
|
|
|
|
administrative users only.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
id:
|
|
|
|
description: ID of the server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
image:
|
|
|
|
description: The image property as returned from server.
|
|
|
|
returned: success
|
|
|
|
type: dict
|
|
|
|
image_id:
|
|
|
|
description: |
|
|
|
|
The image reference, as a ID or full URL, for the image to use
|
|
|
|
for this server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
instance_name:
|
|
|
|
description: |
|
|
|
|
The instance name. The Compute API generates the instance name
|
|
|
|
from the instance name template. Appears in the response for
|
|
|
|
administrative users only.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
is_locked:
|
|
|
|
description: The locked status of the server
|
|
|
|
returned: success
|
|
|
|
type: bool
|
|
|
|
kernel_id:
|
|
|
|
description: |
|
|
|
|
The UUID of the kernel image when using an AMI. Will be null if
|
|
|
|
not. By default, it appears in the response for administrative
|
|
|
|
users only.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
key_name:
|
|
|
|
description: The name of an associated keypair.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
launch_index:
|
|
|
|
description: |
|
|
|
|
When servers are launched via multiple create, this is the
|
|
|
|
sequence in which the servers were launched. By default, it
|
|
|
|
appears in the response for administrative users only.
|
|
|
|
returned: success
|
|
|
|
type: int
|
|
|
|
launched_at:
|
|
|
|
description: The timestamp when the server was launched.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
links:
|
|
|
|
description: |
|
|
|
|
A list of dictionaries holding links relevant to this server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
max_count:
|
|
|
|
description: The maximum number of servers to create.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
metadata:
|
|
|
|
description: List of tag strings.
|
|
|
|
returned: success
|
|
|
|
type: dict
|
|
|
|
min_count:
|
|
|
|
description: The minimum number of servers to create.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
name:
|
|
|
|
description: Name of the server
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
networks:
|
|
|
|
description: |
|
|
|
|
A networks object. Required parameter when there are multiple
|
|
|
|
networks defined for the tenant. When you do not specify the
|
|
|
|
networks parameter, the server attaches to the only network
|
|
|
|
created for the current tenant.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
power_state:
|
|
|
|
description: The power state of this server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
progress:
|
|
|
|
description: |
|
|
|
|
While the server is building, this value represents the
|
|
|
|
percentage of completion. Once it is completed, it will be 100.
|
|
|
|
returned: success
|
|
|
|
type: int
|
|
|
|
project_id:
|
|
|
|
description: The ID of the project this server is associated with.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
ramdisk_id:
|
|
|
|
description: |
|
|
|
|
The UUID of the ramdisk image when using an AMI. Will be null
|
|
|
|
if not. By default, it appears in the response for
|
|
|
|
administrative users only.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
reservation_id:
|
|
|
|
description: |
|
|
|
|
The reservation id for the server. This is an id that can be
|
|
|
|
useful in tracking groups of servers created with multiple
|
|
|
|
create, that will all have the same reservation_id. By default,
|
|
|
|
it appears in the response for administrative users only.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
root_device_name:
|
|
|
|
description: |
|
|
|
|
The root device name for the instance By default, it appears in
|
|
|
|
the response for administrative users only.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
scheduler_hints:
|
|
|
|
description: The dictionary of data to send to the scheduler.
|
|
|
|
returned: success
|
|
|
|
type: dict
|
|
|
|
security_groups:
|
|
|
|
description: |
|
|
|
|
A list of applicable security groups. Each group contains keys
|
|
|
|
for: description, name, id, and rules.
|
|
|
|
returned: success
|
|
|
|
type: list
|
|
|
|
elements: dict
|
|
|
|
server_groups:
|
|
|
|
description: |
|
|
|
|
The UUIDs of the server groups to which the server belongs.
|
|
|
|
Currently this can contain at most one entry.
|
|
|
|
returned: success
|
|
|
|
type: list
|
|
|
|
status:
|
|
|
|
description: |
|
|
|
|
The state this server is in. Valid values include 'ACTIVE',
|
|
|
|
'BUILDING', 'DELETED', 'ERROR', 'HARD_REBOOT', 'PASSWORD',
|
|
|
|
'PAUSED', 'REBOOT', 'REBUILD', 'RESCUED', 'RESIZED',
|
|
|
|
'REVERT_RESIZE', 'SHUTOFF', 'SOFT_DELETED', 'STOPPED',
|
|
|
|
'SUSPENDED', 'UNKNOWN', or 'VERIFY_RESIZE'.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
tags:
|
|
|
|
description: A list of associated tags.
|
|
|
|
returned: success
|
|
|
|
type: list
|
|
|
|
task_state:
|
|
|
|
description: The task state of this server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
terminated_at:
|
|
|
|
description: |
|
|
|
|
The timestamp when the server was terminated (if it has been).
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
trusted_image_certificates:
|
|
|
|
description: |
|
|
|
|
A list of trusted certificate IDs, that were used during image
|
|
|
|
signature verification to verify the signing certificate.
|
|
|
|
returned: success
|
|
|
|
type: list
|
|
|
|
updated_at:
|
|
|
|
description: Timestamp of when this server was last updated.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
user_data:
|
|
|
|
description: |
|
|
|
|
Configuration information or scripts to use upon launch.
|
|
|
|
Base64 encoded.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
user_id:
|
|
|
|
description: The ID of the owners of this server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
vm_state:
|
|
|
|
description: The VM state of this server.
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
volumes:
|
|
|
|
description: Same as attached_volumes.
|
|
|
|
returned: success
|
|
|
|
type: list
|
2020-05-12 10:20:09 -05:00
|
|
|
'''
|
|
|
|
|
|
|
|
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import OpenStackModule
|
|
|
|
|
|
|
|
|
|
|
|
class ServerInfoModule(OpenStackModule):
|
|
|
|
|
|
|
|
argument_spec = dict(
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
name=dict(aliases=['server']),
|
2022-07-27 12:39:44 +02:00
|
|
|
detailed=dict(type='bool', default=False),
|
|
|
|
filters=dict(type='dict'),
|
|
|
|
all_projects=dict(type='bool', default=False),
|
2020-05-12 10:20:09 -05:00
|
|
|
)
|
2021-08-16 13:21:27 +03:00
|
|
|
module_kwargs = dict(
|
|
|
|
supports_check_mode=True
|
|
|
|
)
|
2020-05-12 10:20:09 -05:00
|
|
|
|
|
|
|
def run(self):
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
kwargs = dict((k, self.params[k])
|
|
|
|
for k in ['detailed', 'filters', 'all_projects']
|
|
|
|
if self.params[k] is not None)
|
|
|
|
kwargs['name_or_id'] = self.params['name']
|
2020-05-12 10:20:09 -05:00
|
|
|
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
self.exit(changed=False,
|
2024-06-20 18:08:49 +02:00
|
|
|
servers=[server.to_dict(computed=False)
|
|
|
|
if hasattr(server, "to_dict") else server
|
|
|
|
for server in
|
Refactored server and server_info modules
Allow to update server attributes such as its description.
Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.
Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.
Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.
Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.
Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.
Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.
Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.
Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.
Added RETURN fields documentation for the module results of both
server and server_info modules.
Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].
Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.
Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.
Added integration tests to check the update mechanism of the server
module.
Fixed indentation in integration tests.
Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.
Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.
Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.
[1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
[2] https://storyboard.openstack.org/#!/story/2007893
[3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
[4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
[5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
[6] https://storyboard.openstack.org/#!/story/2007873
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-11 08:40:53 +02:00
|
|
|
self.conn.search_servers(**kwargs)])
|
2020-05-12 10:20:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2020-05-21 20:52:48 +03:00
|
|
|
module = ServerInfoModule()
|
|
|
|
module()
|
2020-05-12 10:20:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|