[PR #9394/912065ad backport][stable-10] h*.py: normalize docs (#9417)
h*.py: normalize docs (#9394)
* h*.py: normalize docs
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 912065ad0e
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
pull/9426/head
parent
f66bd1035d
commit
0e99b006a2
|
@ -8,23 +8,21 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: haproxy
|
module: haproxy
|
||||||
short_description: Enable, disable, and set weights for HAProxy backend servers using socket commands
|
short_description: Enable, disable, and set weights for HAProxy backend servers using socket commands
|
||||||
author:
|
author:
|
||||||
- Ravi Bhure (@ravibhure)
|
- Ravi Bhure (@ravibhure)
|
||||||
description:
|
description:
|
||||||
- Enable, disable, drain and set weights for HAProxy backend servers using socket commands.
|
- Enable, disable, drain and set weights for HAProxy backend servers using socket commands.
|
||||||
notes:
|
notes:
|
||||||
- Enable, disable and drain commands are restricted and can only be issued on
|
- Enable, disable and drain commands are restricted and can only be issued on sockets configured for level C(admin). For
|
||||||
sockets configured for level 'admin'. For example, you can add the line
|
example, you can add the line C(stats socket /var/run/haproxy.sock level admin) to the general section of C(haproxy.cfg).
|
||||||
'stats socket /var/run/haproxy.sock level admin' to the general section of
|
See U(http://haproxy.1wt.eu/download/1.5/doc/configuration.txt).
|
||||||
haproxy.cfg. See U(http://haproxy.1wt.eu/download/1.5/doc/configuration.txt).
|
- Depends on netcat (C(nc)) being available; you need to install the appropriate package for your operating system before
|
||||||
- Depends on netcat (C(nc)) being available; you need to install the appropriate
|
this module can be used.
|
||||||
package for your operating system before this module can be used.
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: none
|
support: none
|
||||||
|
@ -38,8 +36,8 @@ options:
|
||||||
type: str
|
type: str
|
||||||
drain:
|
drain:
|
||||||
description:
|
description:
|
||||||
- Wait until the server has no active connections or until the timeout
|
- Wait until the server has no active connections or until the timeout determined by O(wait_interval) and O(wait_retries)
|
||||||
determined by wait_interval and wait_retries is reached.
|
is reached.
|
||||||
- Continue only after the status changes to C(MAINT).
|
- Continue only after the status changes to C(MAINT).
|
||||||
- This overrides the shutdown_sessions option.
|
- This overrides the shutdown_sessions option.
|
||||||
type: bool
|
type: bool
|
||||||
|
@ -51,10 +49,9 @@ options:
|
||||||
required: true
|
required: true
|
||||||
shutdown_sessions:
|
shutdown_sessions:
|
||||||
description:
|
description:
|
||||||
- When disabling a server, immediately terminate all the sessions attached
|
- When disabling a server, immediately terminate all the sessions attached to the specified server.
|
||||||
to the specified server.
|
- This can be used to terminate long-running sessions after a server is put into maintenance mode. Overridden by the
|
||||||
- This can be used to terminate long-running sessions after a server is put
|
drain option.
|
||||||
into maintenance mode. Overridden by the drain option.
|
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
socket:
|
socket:
|
||||||
|
@ -65,11 +62,11 @@ options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Desired state of the provided backend host.
|
- Desired state of the provided backend host.
|
||||||
- Note that V(drain) state is supported only by HAProxy version 1.5 or later.
|
- Note that V(drain) state is supported only by HAProxy version 1.5 or later. When used on versions < 1.5, it will be
|
||||||
When used on versions < 1.5, it will be ignored.
|
ignored.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
choices: [ disabled, drain, enabled ]
|
choices: [disabled, drain, enabled]
|
||||||
agent:
|
agent:
|
||||||
description:
|
description:
|
||||||
- Disable/enable agent checks (depending on O(state) value).
|
- Disable/enable agent checks (depending on O(state) value).
|
||||||
|
@ -89,8 +86,8 @@ options:
|
||||||
default: false
|
default: false
|
||||||
wait:
|
wait:
|
||||||
description:
|
description:
|
||||||
- Wait until the server reports a status of C(UP) when O(state=enabled),
|
- Wait until the server reports a status of C(UP) when O(state=enabled), status of C(MAINT) when O(state=disabled) or
|
||||||
status of C(MAINT) when O(state=disabled) or status of C(DRAIN) when O(state=drain).
|
status of C(DRAIN) when O(state=drain).
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
wait_interval:
|
wait_interval:
|
||||||
|
@ -106,14 +103,12 @@ options:
|
||||||
weight:
|
weight:
|
||||||
description:
|
description:
|
||||||
- The value passed in argument.
|
- The value passed in argument.
|
||||||
- If the value ends with the V(%) sign, then the new weight will be
|
- If the value ends with the V(%) sign, then the new weight will be relative to the initially configured weight.
|
||||||
relative to the initially configured weight.
|
- Relative weights are only permitted between 0 and 100% and absolute weights are permitted between 0 and 256.
|
||||||
- Relative weights are only permitted between 0 and 100% and absolute
|
|
||||||
weights are permitted between 0 and 256.
|
|
||||||
type: str
|
type: str
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r"""
|
||||||
- name: Disable server in 'www' backend pool
|
- name: Disable server in 'www' backend pool
|
||||||
community.general.haproxy:
|
community.general.haproxy:
|
||||||
state: disabled
|
state: disabled
|
||||||
|
@ -168,7 +163,8 @@ EXAMPLES = r'''
|
||||||
socket: /var/run/haproxy.sock
|
socket: /var/run/haproxy.sock
|
||||||
shutdown_sessions: true
|
shutdown_sessions: true
|
||||||
|
|
||||||
- name: Disable server without backend pool name (apply to all available backend pool) but fail when the backend host is not found
|
- name: Disable server without backend pool name (apply to all available backend pool) but fail when the backend host is
|
||||||
|
not found
|
||||||
community.general.haproxy:
|
community.general.haproxy:
|
||||||
state: disabled
|
state: disabled
|
||||||
host: '{{ inventory_hostname }}'
|
host: '{{ inventory_hostname }}'
|
||||||
|
@ -187,7 +183,8 @@ EXAMPLES = r'''
|
||||||
backend: www
|
backend: www
|
||||||
wait: true
|
wait: true
|
||||||
|
|
||||||
- name: Enable server in 'www' backend pool wait until healthy. Retry 10 times with intervals of 5 seconds to retrieve the health
|
- name: Enable server in 'www' backend pool wait until healthy. Retry 10 times with intervals of 5 seconds to retrieve the
|
||||||
|
health
|
||||||
community.general.haproxy:
|
community.general.haproxy:
|
||||||
state: enabled
|
state: enabled
|
||||||
host: '{{ inventory_hostname }}'
|
host: '{{ inventory_hostname }}'
|
||||||
|
@ -210,7 +207,7 @@ EXAMPLES = r'''
|
||||||
host: '{{ inventory_hostname }}'
|
host: '{{ inventory_hostname }}'
|
||||||
socket: /var/run/haproxy.sock
|
socket: /var/run/haproxy.sock
|
||||||
backend: www
|
backend: www
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
import socket
|
import socket
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: heroku_collaborator
|
module: heroku_collaborator
|
||||||
short_description: Add or delete app collaborators on Heroku
|
short_description: Add or delete app collaborators on Heroku
|
||||||
description:
|
description:
|
||||||
|
@ -32,35 +31,35 @@ options:
|
||||||
api_key:
|
api_key:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Heroku API key
|
- Heroku API key.
|
||||||
apps:
|
apps:
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
description:
|
description:
|
||||||
- List of Heroku App names
|
- List of Heroku App names.
|
||||||
required: true
|
required: true
|
||||||
suppress_invitation:
|
suppress_invitation:
|
||||||
description:
|
description:
|
||||||
- Suppress email invitation when creating collaborator
|
- Suppress email invitation when creating collaborator.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
user:
|
user:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- User ID or e-mail
|
- User ID or e-mail.
|
||||||
required: true
|
required: true
|
||||||
state:
|
state:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Create or remove the heroku collaborator
|
- Create or remove the heroku collaborator.
|
||||||
choices: ["present", "absent"]
|
choices: ["present", "absent"]
|
||||||
default: "present"
|
default: "present"
|
||||||
notes:
|
notes:
|
||||||
- E(HEROKU_API_KEY) and E(TF_VAR_HEROKU_API_KEY) environment variables can be used instead setting O(api_key).
|
- E(HEROKU_API_KEY) and E(TF_VAR_HEROKU_API_KEY) environment variables can be used instead setting O(api_key).
|
||||||
- If you use C(check_mode), you can also pass the C(-v) flag to see affected apps in C(msg), e.g. ["heroku-example-app"].
|
- If you use C(check_mode), you can also pass the C(-v) flag to see affected apps in C(msg), for example C(["heroku-example-app"]).
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
- name: Create a heroku collaborator
|
- name: Create a heroku collaborator
|
||||||
community.general.heroku_collaborator:
|
community.general.heroku_collaborator:
|
||||||
api_key: YOUR_API_KEY
|
api_key: YOUR_API_KEY
|
||||||
|
@ -76,12 +75,12 @@ EXAMPLES = '''
|
||||||
suppress_invitation: '{{ item.suppress_invitation | default(suppress_invitation) }}'
|
suppress_invitation: '{{ item.suppress_invitation | default(suppress_invitation) }}'
|
||||||
state: '{{ item.state | default("present") }}'
|
state: '{{ item.state | default("present") }}'
|
||||||
with_items:
|
with_items:
|
||||||
- { user: 'a.b@example.com' }
|
- {user: 'a.b@example.com'}
|
||||||
- { state: 'absent', user: 'b.c@example.com', suppress_invitation: false }
|
- {state: 'absent', user: 'b.c@example.com', suppress_invitation: false}
|
||||||
- { user: 'x.y@example.com', apps: ["heroku-example-app"] }
|
- {user: 'x.y@example.com', apps: ["heroku-example-app"]}
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = ''' # '''
|
RETURN = """ # """
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.heroku import HerokuHelper
|
from ansible_collections.community.general.plugins.module_utils.heroku import HerokuHelper
|
||||||
|
|
|
@ -9,75 +9,71 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hg
|
module: hg
|
||||||
short_description: Manages Mercurial (hg) repositories
|
short_description: Manages Mercurial (hg) repositories
|
||||||
description:
|
description:
|
||||||
- Manages Mercurial (hg) repositories. Supports SSH, HTTP/S and local address.
|
- Manages Mercurial (hg) repositories. Supports SSH, HTTP/S and local address.
|
||||||
author: "Yeukhon Wong (@yeukhon)"
|
author: "Yeukhon Wong (@yeukhon)"
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: none
|
support: none
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
repo:
|
repo:
|
||||||
description:
|
description:
|
||||||
- The repository address.
|
- The repository address.
|
||||||
required: true
|
required: true
|
||||||
aliases: [ name ]
|
aliases: [name]
|
||||||
type: str
|
type: str
|
||||||
dest:
|
dest:
|
||||||
description:
|
description:
|
||||||
- Absolute path of where the repository should be cloned to.
|
- Absolute path of where the repository should be cloned to. This parameter is required, unless clone and update are
|
||||||
This parameter is required, unless clone and update are set to no
|
set to no.
|
||||||
type: path
|
type: path
|
||||||
revision:
|
revision:
|
||||||
description:
|
description:
|
||||||
- Equivalent C(-r) option in hg command which could be the changeset, revision number,
|
- Equivalent C(-r) option in hg command which could be the changeset, revision number, branch name or even tag.
|
||||||
branch name or even tag.
|
aliases: [version]
|
||||||
aliases: [ version ]
|
type: str
|
||||||
type: str
|
force:
|
||||||
force:
|
description:
|
||||||
description:
|
- Discards uncommitted changes. Runs C(hg update -C).
|
||||||
- Discards uncommitted changes. Runs C(hg update -C).
|
type: bool
|
||||||
type: bool
|
default: false
|
||||||
default: false
|
purge:
|
||||||
purge:
|
description:
|
||||||
description:
|
- Deletes untracked files. Runs C(hg purge).
|
||||||
- Deletes untracked files. Runs C(hg purge).
|
type: bool
|
||||||
type: bool
|
default: false
|
||||||
default: false
|
update:
|
||||||
update:
|
description:
|
||||||
description:
|
- If V(false), do not retrieve new revisions from the origin repository.
|
||||||
- If V(false), do not retrieve new revisions from the origin repository
|
type: bool
|
||||||
type: bool
|
default: true
|
||||||
default: true
|
clone:
|
||||||
clone:
|
description:
|
||||||
description:
|
- If V(false), do not clone the repository if it does not exist locally.
|
||||||
- If V(false), do not clone the repository if it does not exist locally.
|
type: bool
|
||||||
type: bool
|
default: true
|
||||||
default: true
|
executable:
|
||||||
executable:
|
description:
|
||||||
description:
|
- Path to hg executable to use. If not supplied, the normal mechanism for resolving binary paths will be used.
|
||||||
- Path to hg executable to use. If not supplied,
|
type: str
|
||||||
the normal mechanism for resolving binary paths will be used.
|
|
||||||
type: str
|
|
||||||
notes:
|
notes:
|
||||||
- This module does not support push capability. See U(https://github.com/ansible/ansible/issues/31156).
|
- This module does not support push capability. See U(https://github.com/ansible/ansible/issues/31156).
|
||||||
- "If the task seems to be hanging, first verify remote host is in C(known_hosts).
|
- 'If the task seems to be hanging, first verify remote host is in C(known_hosts). SSH will prompt user to authorize the
|
||||||
SSH will prompt user to authorize the first contact with a remote host. To avoid this prompt,
|
first contact with a remote host. To avoid this prompt, one solution is to add the remote host public key in C(/etc/ssh/ssh_known_hosts)
|
||||||
one solution is to add the remote host public key in C(/etc/ssh/ssh_known_hosts) before calling
|
before calling the hg module, with the following command: C(ssh-keyscan remote_host.com >> /etc/ssh/ssh_known_hosts).'
|
||||||
the hg module, with the following command: ssh-keyscan remote_host.com >> /etc/ssh/ssh_known_hosts."
|
- As per 01 Dec 2018, Bitbucket has dropped support for TLSv1 and TLSv1.1 connections. As such, if the underlying system
|
||||||
- As per 01 Dec 2018, Bitbucket has dropped support for TLSv1 and TLSv1.1 connections. As such,
|
still uses a Python version below 2.7.9, you will have issues checking out bitbucket repositories.
|
||||||
if the underlying system still uses a Python version below 2.7.9, you will have issues checking out
|
See U(https://bitbucket.org/blog/deprecating-tlsv1-tlsv1-1-2018-12-01).
|
||||||
bitbucket repositories. See U(https://bitbucket.org/blog/deprecating-tlsv1-tlsv1-1-2018-12-01).
|
"""
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
- name: Ensure the current working copy is inside the stable branch and deletes untracked files if any.
|
- name: Ensure the current working copy is inside the stable branch and deletes untracked files if any.
|
||||||
community.general.hg:
|
community.general.hg:
|
||||||
repo: https://bitbucket.org/user/repo1
|
repo: https://bitbucket.org/user/repo1
|
||||||
|
@ -91,7 +87,7 @@ EXAMPLES = '''
|
||||||
dest: /srv/checkout
|
dest: /srv/checkout
|
||||||
clone: false
|
clone: false
|
||||||
update: false
|
update: false
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,11 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hipchat
|
module: hipchat
|
||||||
short_description: Send a message to Hipchat
|
short_description: Send a message to Hipchat
|
||||||
description:
|
description:
|
||||||
- Send a message to a Hipchat room, with options to control the formatting.
|
- Send a message to a Hipchat room, with options to control the formatting.
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
deprecated:
|
deprecated:
|
||||||
|
@ -40,8 +39,7 @@ options:
|
||||||
msg_from:
|
msg_from:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Name the message will appear to be sent from. Max length is 15
|
- Name the message will appear to be sent from. Max length is 15 characters - above this it will be truncated.
|
||||||
characters - above this it will be truncated.
|
|
||||||
default: Ansible
|
default: Ansible
|
||||||
aliases: [from]
|
aliases: [from]
|
||||||
msg:
|
msg:
|
||||||
|
@ -54,13 +52,13 @@ options:
|
||||||
description:
|
description:
|
||||||
- Background color for the message.
|
- Background color for the message.
|
||||||
default: yellow
|
default: yellow
|
||||||
choices: [ "yellow", "red", "green", "purple", "gray", "random" ]
|
choices: ["yellow", "red", "green", "purple", "gray", "random"]
|
||||||
msg_format:
|
msg_format:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Message format.
|
- Message format.
|
||||||
default: text
|
default: text
|
||||||
choices: [ "text", "html" ]
|
choices: ["text", "html"]
|
||||||
notify:
|
notify:
|
||||||
description:
|
description:
|
||||||
- If true, a notification will be triggered for users in the room.
|
- If true, a notification will be triggered for users in the room.
|
||||||
|
@ -68,23 +66,23 @@ options:
|
||||||
default: true
|
default: true
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- If V(false), SSL certificates will not be validated. This should only be used
|
- If V(false), SSL certificates will not be validated. This should only be used on personally controlled sites using
|
||||||
on personally controlled sites using self-signed certificates.
|
self-signed certificates.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
api:
|
api:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- API url if using a self-hosted hipchat server. For Hipchat API version
|
- API url if using a self-hosted hipchat server. For Hipchat API version 2 use the default URI with C(/v2) instead of
|
||||||
2 use the default URI with C(/v2) instead of C(/v1).
|
C(/v1).
|
||||||
default: 'https://api.hipchat.com/v1'
|
default: 'https://api.hipchat.com/v1'
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Shirou Wakayama (@shirou)
|
- Shirou Wakayama (@shirou)
|
||||||
- Paul Bourdel (@pb8226)
|
- Paul Bourdel (@pb8226)
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
- name: Send a message to a Hipchat room
|
- name: Send a message to a Hipchat room
|
||||||
community.general.hipchat:
|
community.general.hipchat:
|
||||||
room: notif
|
room: notif
|
||||||
|
@ -96,7 +94,7 @@ EXAMPLES = '''
|
||||||
token: OAUTH2_TOKEN
|
token: OAUTH2_TOKEN
|
||||||
room: notify
|
room: notify
|
||||||
msg: Ansible task finished
|
msg: Ansible task finished
|
||||||
'''
|
"""
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# HipChat module specific support methods.
|
# HipChat module specific support methods.
|
||||||
|
|
|
@ -14,81 +14,80 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: homebrew
|
module: homebrew
|
||||||
author:
|
author:
|
||||||
- "Indrajit Raychaudhuri (@indrajitr)"
|
- "Indrajit Raychaudhuri (@indrajitr)"
|
||||||
- "Daniel Jaouen (@danieljaouen)"
|
- "Daniel Jaouen (@danieljaouen)"
|
||||||
- "Andrew Dunham (@andrew-d)"
|
- "Andrew Dunham (@andrew-d)"
|
||||||
requirements:
|
requirements:
|
||||||
- homebrew must already be installed on the target system
|
- homebrew must already be installed on the target system
|
||||||
short_description: Package manager for Homebrew
|
short_description: Package manager for Homebrew
|
||||||
description:
|
description:
|
||||||
- Manages Homebrew packages
|
- Manages Homebrew packages.
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- A list of names of packages to install/remove.
|
- A list of names of packages to install/remove.
|
||||||
aliases: [ 'formula', 'package', 'pkg' ]
|
aliases: ['formula', 'package', 'pkg']
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
path:
|
path:
|
||||||
description:
|
description:
|
||||||
- "A V(:) separated list of paths to search for C(brew) executable.
|
- A V(:) separated list of paths to search for C(brew) executable. Since a package (I(formula) in homebrew parlance)
|
||||||
Since a package (I(formula) in homebrew parlance) location is prefixed relative to the actual path of C(brew) command,
|
location is prefixed relative to the actual path of C(brew) command, providing an alternative C(brew) path enables
|
||||||
providing an alternative C(brew) path enables managing different set of packages in an alternative location in the system."
|
managing different set of packages in an alternative location in the system.
|
||||||
default: '/usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin'
|
default: '/usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin'
|
||||||
type: path
|
type: path
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- state of the package.
|
- State of the package.
|
||||||
choices: [ 'absent', 'head', 'installed', 'latest', 'linked', 'present', 'removed', 'uninstalled', 'unlinked', 'upgraded' ]
|
choices: ['absent', 'head', 'installed', 'latest', 'linked', 'present', 'removed', 'uninstalled', 'unlinked', 'upgraded']
|
||||||
default: present
|
default: present
|
||||||
type: str
|
type: str
|
||||||
update_homebrew:
|
update_homebrew:
|
||||||
description:
|
description:
|
||||||
- update homebrew itself first.
|
- Update homebrew itself first.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
upgrade_all:
|
upgrade_all:
|
||||||
description:
|
description:
|
||||||
- upgrade all homebrew packages.
|
- Upgrade all homebrew packages.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: ['upgrade']
|
aliases: ['upgrade']
|
||||||
install_options:
|
install_options:
|
||||||
description:
|
description:
|
||||||
- options flags to install a package.
|
- Options flags to install a package.
|
||||||
aliases: ['options']
|
aliases: ['options']
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
upgrade_options:
|
upgrade_options:
|
||||||
description:
|
description:
|
||||||
- Option flags to upgrade.
|
- Option flags to upgrade.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
force_formula:
|
force_formula:
|
||||||
description:
|
description:
|
||||||
- Force the package(s) to be treated as a formula (equivalent to C(brew --formula)).
|
- Force the package(s) to be treated as a formula (equivalent to C(brew --formula)).
|
||||||
- To install a cask, use the M(community.general.homebrew_cask) module.
|
- To install a cask, use the M(community.general.homebrew_cask) module.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
version_added: 9.0.0
|
version_added: 9.0.0
|
||||||
notes:
|
notes:
|
||||||
- When used with a C(loop:) each package will be processed individually,
|
- When used with a C(loop:) each package will be processed individually, it is much more efficient to pass the list directly
|
||||||
it is much more efficient to pass the list directly to the O(name) option.
|
to the O(name) option.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
# Install formula foo with 'brew' in default path
|
# Install formula foo with 'brew' in default path
|
||||||
- community.general.homebrew:
|
- community.general.homebrew:
|
||||||
name: foo
|
name: foo
|
||||||
|
@ -154,29 +153,29 @@ EXAMPLES = '''
|
||||||
name: ambiguous_formula
|
name: ambiguous_formula
|
||||||
state: present
|
state: present
|
||||||
force_formula: true
|
force_formula: true
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
msg:
|
msg:
|
||||||
description: if the cache was updated or not
|
description: If the cache was updated or not.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: "Changed: 0, Unchanged: 2"
|
sample: "Changed: 0, Unchanged: 2"
|
||||||
unchanged_pkgs:
|
unchanged_pkgs:
|
||||||
description:
|
description:
|
||||||
- List of package names which are unchanged after module run
|
- List of package names which are unchanged after module run.
|
||||||
returned: success
|
returned: success
|
||||||
type: list
|
type: list
|
||||||
sample: ["awscli", "ag"]
|
sample: ["awscli", "ag"]
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
changed_pkgs:
|
changed_pkgs:
|
||||||
description:
|
description:
|
||||||
- List of package names which are changed after module run
|
- List of package names which are changed after module run.
|
||||||
returned: success
|
returned: success
|
||||||
type: list
|
type: list
|
||||||
sample: ['git', 'git-cola']
|
sample: ['git', 'git-cola']
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -11,8 +11,7 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: homebrew_cask
|
module: homebrew_cask
|
||||||
author:
|
author:
|
||||||
- "Indrajit Raychaudhuri (@indrajitr)"
|
- "Indrajit Raychaudhuri (@indrajitr)"
|
||||||
|
@ -31,60 +30,59 @@ attributes:
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Name of cask to install or remove.
|
- Name of cask to install or remove.
|
||||||
aliases: [ 'cask', 'package', 'pkg' ]
|
aliases: ['cask', 'package', 'pkg']
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
path:
|
path:
|
||||||
description:
|
description:
|
||||||
- "':' separated list of paths to search for 'brew' executable."
|
- "':' separated list of paths to search for 'brew' executable."
|
||||||
default: '/usr/local/bin:/opt/homebrew/bin'
|
default: '/usr/local/bin:/opt/homebrew/bin'
|
||||||
type: path
|
type: path
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the cask.
|
- State of the cask.
|
||||||
choices: [ 'absent', 'installed', 'latest', 'present', 'removed', 'uninstalled', 'upgraded' ]
|
choices: ['absent', 'installed', 'latest', 'present', 'removed', 'uninstalled', 'upgraded']
|
||||||
default: present
|
default: present
|
||||||
type: str
|
type: str
|
||||||
sudo_password:
|
sudo_password:
|
||||||
description:
|
description:
|
||||||
- The sudo password to be passed to SUDO_ASKPASS.
|
- The sudo password to be passed to E(SUDO_ASKPASS).
|
||||||
required: false
|
required: false
|
||||||
type: str
|
type: str
|
||||||
update_homebrew:
|
update_homebrew:
|
||||||
description:
|
description:
|
||||||
- Update homebrew itself first.
|
- Update homebrew itself first.
|
||||||
- Note that C(brew cask update) is a synonym for C(brew update).
|
- Note that C(brew cask update) is a synonym for C(brew update).
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
install_options:
|
install_options:
|
||||||
description:
|
description:
|
||||||
- Options flags to install a package.
|
- Options flags to install a package.
|
||||||
aliases: [ 'options' ]
|
aliases: ['options']
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
accept_external_apps:
|
accept_external_apps:
|
||||||
description:
|
description:
|
||||||
- Allow external apps.
|
- Allow external apps.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
upgrade_all:
|
upgrade_all:
|
||||||
description:
|
description:
|
||||||
- Upgrade all casks.
|
- Upgrade all casks.
|
||||||
- Mutually exclusive with C(upgraded) state.
|
- Mutually exclusive with C(upgraded) state.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: [ 'upgrade' ]
|
aliases: ['upgrade']
|
||||||
greedy:
|
greedy:
|
||||||
description:
|
description:
|
||||||
- Upgrade casks that auto update.
|
- Upgrade casks that auto update.
|
||||||
- Passes C(--greedy) to C(brew outdated --cask) when checking
|
- Passes C(--greedy) to C(brew outdated --cask) when checking if an installed cask has a newer version available, or
|
||||||
if an installed cask has a newer version available,
|
to C(brew upgrade --cask) when upgrading all casks.
|
||||||
or to C(brew upgrade --cask) when upgrading all casks.
|
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
'''
|
"""
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
- name: Install cask
|
- name: Install cask
|
||||||
community.general.homebrew_cask:
|
community.general.homebrew_cask:
|
||||||
name: alfred
|
name: alfred
|
||||||
|
@ -151,7 +149,7 @@ EXAMPLES = '''
|
||||||
name: wireshark
|
name: wireshark
|
||||||
state: present
|
state: present
|
||||||
sudo_password: "{{ ansible_become_pass }}"
|
sudo_password: "{{ ansible_become_pass }}"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -14,47 +14,46 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: homebrew_services
|
module: homebrew_services
|
||||||
author:
|
author:
|
||||||
- "Kit Ham (@kitizz)"
|
- "Kit Ham (@kitizz)"
|
||||||
requirements:
|
requirements:
|
||||||
- homebrew must already be installed on the target system
|
- homebrew must already be installed on the target system
|
||||||
short_description: Services manager for Homebrew
|
short_description: Services manager for Homebrew
|
||||||
version_added: 9.3.0
|
version_added: 9.3.0
|
||||||
description:
|
description:
|
||||||
- Manages daemons and services via Homebrew.
|
- Manages daemons and services using Homebrew.
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- An installed homebrew package whose service is to be updated.
|
- An installed homebrew package whose service is to be updated.
|
||||||
aliases: [ 'formula' ]
|
aliases: ['formula']
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
path:
|
path:
|
||||||
description:
|
description:
|
||||||
- "A V(:) separated list of paths to search for C(brew) executable.
|
- A V(:) separated list of paths to search for C(brew) executable. Since a package (I(formula) in homebrew parlance)
|
||||||
Since a package (I(formula) in homebrew parlance) location is prefixed relative to the actual path of C(brew) command,
|
location is prefixed relative to the actual path of C(brew) command, providing an alternative C(brew) path enables
|
||||||
providing an alternative C(brew) path enables managing different set of packages in an alternative location in the system."
|
managing different set of packages in an alternative location in the system.
|
||||||
default: '/usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin'
|
default: '/usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin'
|
||||||
type: path
|
type: path
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the package's service.
|
- State of the package's service.
|
||||||
choices: [ 'present', 'absent', 'restarted' ]
|
choices: ['present', 'absent', 'restarted']
|
||||||
default: present
|
default: present
|
||||||
type: str
|
type: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = r"""
|
||||||
- name: Install foo package
|
- name: Install foo package
|
||||||
community.general.homebrew:
|
community.general.homebrew:
|
||||||
name: foo
|
name: foo
|
||||||
|
@ -76,19 +75,19 @@ EXAMPLES = """
|
||||||
service_state: absent
|
service_state: absent
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = r"""
|
||||||
pid:
|
pid:
|
||||||
description:
|
description:
|
||||||
- If the service is now running, this is the PID of the service, otherwise -1.
|
- If the service is now running, this is the PID of the service, otherwise -1.
|
||||||
returned: success
|
returned: success
|
||||||
type: int
|
type: int
|
||||||
sample: 1234
|
sample: 1234
|
||||||
running:
|
running:
|
||||||
description:
|
description:
|
||||||
- Whether the service is running after running this command.
|
- Whether the service is running after running this command.
|
||||||
returned: success
|
returned: success
|
||||||
type: bool
|
type: bool
|
||||||
sample: true
|
sample: true
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -13,56 +13,53 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: homebrew_tap
|
module: homebrew_tap
|
||||||
author:
|
author:
|
||||||
- "Indrajit Raychaudhuri (@indrajitr)"
|
- "Indrajit Raychaudhuri (@indrajitr)"
|
||||||
- "Daniel Jaouen (@danieljaouen)"
|
- "Daniel Jaouen (@danieljaouen)"
|
||||||
short_description: Tap a Homebrew repository
|
short_description: Tap a Homebrew repository
|
||||||
description:
|
description:
|
||||||
- Tap external Homebrew repositories.
|
- Tap external Homebrew repositories.
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The GitHub user/organization repository to tap.
|
- The GitHub user/organization repository to tap.
|
||||||
required: true
|
required: true
|
||||||
aliases: ['tap']
|
aliases: ['tap']
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
url:
|
url:
|
||||||
description:
|
description:
|
||||||
- The optional git URL of the repository to tap. The URL is not
|
- The optional git URL of the repository to tap. The URL is not assumed to be on GitHub, and the protocol does not have
|
||||||
assumed to be on GitHub, and the protocol doesn't have to be HTTP.
|
to be HTTP. Any location and protocol that git can handle is fine.
|
||||||
Any location and protocol that git can handle is fine.
|
- O(name) option may not be a list of multiple taps (but a single tap instead) when this option is provided.
|
||||||
- O(name) option may not be a list of multiple taps (but a single
|
required: false
|
||||||
tap instead) when this option is provided.
|
type: str
|
||||||
required: false
|
state:
|
||||||
type: str
|
description:
|
||||||
state:
|
- State of the repository.
|
||||||
description:
|
choices: ['present', 'absent']
|
||||||
- state of the repository.
|
required: false
|
||||||
choices: [ 'present', 'absent' ]
|
default: 'present'
|
||||||
required: false
|
type: str
|
||||||
default: 'present'
|
path:
|
||||||
type: str
|
description:
|
||||||
path:
|
- A V(:) separated list of paths to search for C(brew) executable.
|
||||||
description:
|
default: '/usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin'
|
||||||
- "A V(:) separated list of paths to search for C(brew) executable."
|
type: path
|
||||||
default: '/usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin'
|
version_added: '2.1.0'
|
||||||
type: path
|
requirements: [homebrew]
|
||||||
version_added: '2.1.0'
|
"""
|
||||||
requirements: [ homebrew ]
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r"""
|
||||||
- name: Tap a Homebrew repository, state present
|
- name: Tap a Homebrew repository, state present
|
||||||
community.general.homebrew_tap:
|
community.general.homebrew_tap:
|
||||||
name: homebrew/dupes
|
name: homebrew/dupes
|
||||||
|
@ -81,7 +78,7 @@ EXAMPLES = r'''
|
||||||
community.general.homebrew_tap:
|
community.general.homebrew_tap:
|
||||||
name: telemachus/brew
|
name: telemachus/brew
|
||||||
url: 'https://bitbucket.org/telemachus/brew'
|
url: 'https://bitbucket.org/telemachus/brew'
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
|
@ -8,186 +8,185 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: homectl
|
module: homectl
|
||||||
author:
|
author:
|
||||||
- "James Livulpi (@jameslivulpi)"
|
- "James Livulpi (@jameslivulpi)"
|
||||||
short_description: Manage user accounts with systemd-homed
|
short_description: Manage user accounts with systemd-homed
|
||||||
version_added: 4.4.0
|
version_added: 4.4.0
|
||||||
description:
|
description:
|
||||||
- Manages a user's home directory managed by systemd-homed.
|
- Manages a user's home directory managed by systemd-homed.
|
||||||
notes:
|
notes:
|
||||||
- This module requires the deprecated L(crypt Python module,
|
- This module requires the deprecated L(crypt Python module, https://docs.python.org/3.12/library/crypt.html) library which
|
||||||
https://docs.python.org/3.12/library/crypt.html) library which was removed from Python 3.13.
|
was removed from Python 3.13. For Python 3.13 or newer, you need to install L(legacycrypt, https://pypi.org/project/legacycrypt/).
|
||||||
For Python 3.13 or newer, you need to install L(legacycrypt, https://pypi.org/project/legacycrypt/).
|
|
||||||
requirements:
|
requirements:
|
||||||
- legacycrypt (on Python 3.13 or newer)
|
- legacycrypt (on Python 3.13 or newer)
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The user name to create, remove, or update.
|
- The user name to create, remove, or update.
|
||||||
required: true
|
required: true
|
||||||
aliases: [ 'user', 'username' ]
|
aliases: ['user', 'username']
|
||||||
type: str
|
type: str
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- Set the user's password to this.
|
- Set the user's password to this.
|
||||||
- Homed requires this value to be in cleartext on user creation and updating a user.
|
- Homed requires this value to be in cleartext on user creation and updating a user.
|
||||||
- The module takes the password and generates a password hash in SHA-512 with 10000 rounds of salt generation using crypt.
|
- The module takes the password and generates a password hash in SHA-512 with 10000 rounds of salt generation using
|
||||||
- See U(https://systemd.io/USER_RECORD/).
|
crypt.
|
||||||
- This is required for O(state=present). When an existing user is updated this is checked against the stored hash in homed.
|
- See U(https://systemd.io/USER_RECORD/).
|
||||||
type: str
|
- This is required for O(state=present). When an existing user is updated this is checked against the stored hash in
|
||||||
state:
|
homed.
|
||||||
description:
|
type: str
|
||||||
- The operation to take on the user.
|
state:
|
||||||
choices: [ 'absent', 'present' ]
|
description:
|
||||||
default: present
|
- The operation to take on the user.
|
||||||
type: str
|
choices: ['absent', 'present']
|
||||||
storage:
|
default: present
|
||||||
description:
|
type: str
|
||||||
- Indicates the storage mechanism for the user's home directory.
|
storage:
|
||||||
- If the storage type is not specified, ``homed.conf(5)`` defines which default storage to use.
|
description:
|
||||||
- Only used when a user is first created.
|
- Indicates the storage mechanism for the user's home directory.
|
||||||
choices: [ 'classic', 'luks', 'directory', 'subvolume', 'fscrypt', 'cifs' ]
|
- If the storage type is not specified, C(homed.conf(5\)) defines which default storage to use.
|
||||||
type: str
|
- Only used when a user is first created.
|
||||||
disksize:
|
choices: ['classic', 'luks', 'directory', 'subvolume', 'fscrypt', 'cifs']
|
||||||
description:
|
type: str
|
||||||
- The intended home directory disk space.
|
disksize:
|
||||||
- Human readable value such as V(10G), V(10M), or V(10B).
|
description:
|
||||||
type: str
|
- The intended home directory disk space.
|
||||||
resize:
|
- Human readable value such as V(10G), V(10M), or V(10B).
|
||||||
description:
|
type: str
|
||||||
- When used with O(disksize) this will attempt to resize the home directory immediately.
|
resize:
|
||||||
default: false
|
description:
|
||||||
type: bool
|
- When used with O(disksize) this will attempt to resize the home directory immediately.
|
||||||
realname:
|
default: false
|
||||||
description:
|
type: bool
|
||||||
- The user's real ('human') name.
|
realname:
|
||||||
- This can also be used to add a comment to maintain compatibility with C(useradd).
|
description:
|
||||||
aliases: [ 'comment' ]
|
- The user's real ('human') name.
|
||||||
type: str
|
- This can also be used to add a comment to maintain compatibility with C(useradd).
|
||||||
realm:
|
aliases: ['comment']
|
||||||
description:
|
type: str
|
||||||
- The 'realm' a user is defined in.
|
realm:
|
||||||
type: str
|
description:
|
||||||
email:
|
- The 'realm' a user is defined in.
|
||||||
description:
|
type: str
|
||||||
- The email address of the user.
|
email:
|
||||||
type: str
|
description:
|
||||||
location:
|
- The email address of the user.
|
||||||
description:
|
type: str
|
||||||
- A free-form location string describing the location of the user.
|
location:
|
||||||
type: str
|
description:
|
||||||
iconname:
|
- A free-form location string describing the location of the user.
|
||||||
description:
|
type: str
|
||||||
- The name of an icon picked by the user, for example for the purpose of an avatar.
|
iconname:
|
||||||
- Should follow the semantics defined in the Icon Naming Specification.
|
description:
|
||||||
- See U(https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html) for specifics.
|
- The name of an icon picked by the user, for example for the purpose of an avatar.
|
||||||
type: str
|
- Should follow the semantics defined in the Icon Naming Specification.
|
||||||
homedir:
|
- See U(https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html) for specifics.
|
||||||
description:
|
type: str
|
||||||
- Path to use as home directory for the user.
|
homedir:
|
||||||
- This is the directory the user's home directory is mounted to while the user is logged in.
|
description:
|
||||||
- This is not where the user's data is actually stored, see O(imagepath) for that.
|
- Path to use as home directory for the user.
|
||||||
- Only used when a user is first created.
|
- This is the directory the user's home directory is mounted to while the user is logged in.
|
||||||
type: path
|
- This is not where the user's data is actually stored, see O(imagepath) for that.
|
||||||
imagepath:
|
- Only used when a user is first created.
|
||||||
description:
|
type: path
|
||||||
- Path to place the user's home directory.
|
imagepath:
|
||||||
- See U(https://www.freedesktop.org/software/systemd/man/homectl.html#--image-path=PATH) for more information.
|
description:
|
||||||
- Only used when a user is first created.
|
- Path to place the user's home directory.
|
||||||
type: path
|
- See U(https://www.freedesktop.org/software/systemd/man/homectl.html#--image-path=PATH) for more information.
|
||||||
uid:
|
- Only used when a user is first created.
|
||||||
description:
|
type: path
|
||||||
- Sets the UID of the user.
|
uid:
|
||||||
- If using O(gid) homed requires the value to be the same.
|
description:
|
||||||
- Only used when a user is first created.
|
- Sets the UID of the user.
|
||||||
type: int
|
- If using O(gid) homed requires the value to be the same.
|
||||||
gid:
|
- Only used when a user is first created.
|
||||||
description:
|
type: int
|
||||||
- Sets the gid of the user.
|
gid:
|
||||||
- If using O(uid) homed requires the value to be the same.
|
description:
|
||||||
- Only used when a user is first created.
|
- Sets the gid of the user.
|
||||||
type: int
|
- If using O(uid) homed requires the value to be the same.
|
||||||
mountopts:
|
- Only used when a user is first created.
|
||||||
description:
|
type: int
|
||||||
- String separated by comma each indicating mount options for a users home directory.
|
mountopts:
|
||||||
- Valid options are V(nosuid), V(nodev) or V(noexec).
|
description:
|
||||||
- Homed by default uses V(nodev) and V(nosuid) while V(noexec) is off.
|
- String separated by comma each indicating mount options for a users home directory.
|
||||||
type: str
|
- Valid options are V(nosuid), V(nodev) or V(noexec).
|
||||||
umask:
|
- Homed by default uses V(nodev) and V(nosuid) while V(noexec) is off.
|
||||||
description:
|
type: str
|
||||||
- Sets the umask for the user's login sessions
|
umask:
|
||||||
- Value from V(0000) to V(0777).
|
description:
|
||||||
type: int
|
- Sets the umask for the user's login sessions.
|
||||||
memberof:
|
- Value from V(0000) to V(0777).
|
||||||
description:
|
type: int
|
||||||
- String separated by comma each indicating a UNIX group this user shall be a member of.
|
memberof:
|
||||||
- Groups the user should be a member of should be supplied as comma separated list.
|
description:
|
||||||
aliases: [ 'groups' ]
|
- String separated by comma each indicating a UNIX group this user shall be a member of.
|
||||||
type: str
|
- Groups the user should be a member of should be supplied as comma separated list.
|
||||||
skeleton:
|
aliases: ['groups']
|
||||||
description:
|
type: str
|
||||||
- The absolute path to the skeleton directory to populate a new home directory from.
|
skeleton:
|
||||||
- This is only used when a home directory is first created.
|
description:
|
||||||
- If not specified homed by default uses V(/etc/skel).
|
- The absolute path to the skeleton directory to populate a new home directory from.
|
||||||
aliases: [ 'skel' ]
|
- This is only used when a home directory is first created.
|
||||||
type: path
|
- If not specified homed by default uses V(/etc/skel).
|
||||||
shell:
|
aliases: ['skel']
|
||||||
description:
|
type: path
|
||||||
- Shell binary to use for terminal logins of given user.
|
shell:
|
||||||
- If not specified homed by default uses V(/bin/bash).
|
description:
|
||||||
type: str
|
- Shell binary to use for terminal logins of given user.
|
||||||
environment:
|
- If not specified homed by default uses V(/bin/bash).
|
||||||
description:
|
type: str
|
||||||
- String separated by comma each containing an environment variable and its value to
|
environment:
|
||||||
set for the user's login session, in a format compatible with ``putenv()``.
|
description:
|
||||||
- Any environment variable listed here is automatically set by pam_systemd for all
|
- String separated by comma each containing an environment variable and its value to set for the user's login session,
|
||||||
login sessions of the user.
|
in a format compatible with C(putenv(\)).
|
||||||
aliases: [ 'setenv' ]
|
- Any environment variable listed here is automatically set by pam_systemd for all login sessions of the user.
|
||||||
type: str
|
aliases: ['setenv']
|
||||||
timezone:
|
type: str
|
||||||
description:
|
timezone:
|
||||||
- Preferred timezone to use for the user.
|
description:
|
||||||
- Should be a tzdata compatible location string such as V(America/New_York).
|
- Preferred timezone to use for the user.
|
||||||
type: str
|
- Should be a tzdata compatible location string such as V(America/New_York).
|
||||||
locked:
|
type: str
|
||||||
description:
|
locked:
|
||||||
- Whether the user account should be locked or not.
|
description:
|
||||||
type: bool
|
- Whether the user account should be locked or not.
|
||||||
language:
|
type: bool
|
||||||
description:
|
language:
|
||||||
- The preferred language/locale for the user.
|
description:
|
||||||
- This should be in a format compatible with the E(LANG) environment variable.
|
- The preferred language/locale for the user.
|
||||||
type: str
|
- This should be in a format compatible with the E(LANG) environment variable.
|
||||||
passwordhint:
|
type: str
|
||||||
description:
|
passwordhint:
|
||||||
- Password hint for the given user.
|
description:
|
||||||
type: str
|
- Password hint for the given user.
|
||||||
sshkeys:
|
type: str
|
||||||
description:
|
sshkeys:
|
||||||
- String separated by comma each listing a SSH public key that is authorized to access the account.
|
description:
|
||||||
- The keys should follow the same format as the lines in a traditional C(~/.ssh/authorized_key) file.
|
- String separated by comma each listing a SSH public key that is authorized to access the account.
|
||||||
type: str
|
- The keys should follow the same format as the lines in a traditional C(~/.ssh/authorized_key) file.
|
||||||
notbefore:
|
type: str
|
||||||
description:
|
notbefore:
|
||||||
- A time since the UNIX epoch before which the record should be considered invalid for the purpose of logging in.
|
description:
|
||||||
type: int
|
- A time since the UNIX epoch before which the record should be considered invalid for the purpose of logging in.
|
||||||
notafter:
|
type: int
|
||||||
description:
|
notafter:
|
||||||
- A time since the UNIX epoch after which the record should be considered invalid for the purpose of logging in.
|
description:
|
||||||
type: int
|
- A time since the UNIX epoch after which the record should be considered invalid for the purpose of logging in.
|
||||||
'''
|
type: int
|
||||||
|
"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
- name: Add the user 'james'
|
- name: Add the user 'james'
|
||||||
community.general.homectl:
|
community.general.homectl:
|
||||||
name: johnd
|
name: johnd
|
||||||
|
@ -215,9 +214,9 @@ EXAMPLES = '''
|
||||||
community.general.homectl:
|
community.general.homectl:
|
||||||
name: janet
|
name: janet
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
data:
|
data:
|
||||||
description: A json dictionary returned from C(homectl inspect -j).
|
description: A json dictionary returned from C(homectl inspect -j).
|
||||||
returned: success
|
returned: success
|
||||||
|
@ -267,7 +266,7 @@ data:
|
||||||
"userName": "james",
|
"userName": "james",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: honeybadger_deployment
|
module: honeybadger_deployment
|
||||||
author: "Benjamin Curtis (@stympy)"
|
author: "Benjamin Curtis (@stympy)"
|
||||||
short_description: Notify Honeybadger.io about app deployments
|
short_description: Notify Honeybadger.io about app deployments
|
||||||
|
@ -31,20 +30,20 @@ options:
|
||||||
environment:
|
environment:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- The environment name, typically 'production', 'staging', etc.
|
- The environment name, typically V(production), V(staging), and so on.
|
||||||
required: true
|
required: true
|
||||||
user:
|
user:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- The username of the person doing the deployment
|
- The username of the person doing the deployment.
|
||||||
repo:
|
repo:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- URL of the project repository
|
- URL of the project repository.
|
||||||
revision:
|
revision:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- A hash, number, tag, or other identifier showing what revision was deployed
|
- A hash, number, tag, or other identifier showing what revision was deployed.
|
||||||
url:
|
url:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
|
@ -52,14 +51,13 @@ options:
|
||||||
default: "https://api.honeybadger.io/v1/deploys"
|
default: "https://api.honeybadger.io/v1/deploys"
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- If V(false), SSL certificates for the target url will not be validated. This should only be used
|
- If V(false), SSL certificates for the target url will not be validated. This should only be used on personally controlled
|
||||||
on personally controlled sites using self-signed certificates.
|
sites using self-signed certificates.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
- name: Notify Honeybadger.io about an app deployment
|
- name: Notify Honeybadger.io about an app deployment
|
||||||
community.general.honeybadger_deployment:
|
community.general.honeybadger_deployment:
|
||||||
token: AAAAAA
|
token: AAAAAA
|
||||||
|
@ -67,9 +65,9 @@ EXAMPLES = '''
|
||||||
user: ansible
|
user: ansible
|
||||||
revision: b6826b8
|
revision: b6826b8
|
||||||
repo: 'git@github.com:user/repo.git'
|
repo: 'git@github.com:user/repo.git'
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''# '''
|
RETURN = """# """
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,13 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hpilo_boot
|
module: hpilo_boot
|
||||||
author: Dag Wieers (@dagwieers)
|
author: Dag Wieers (@dagwieers)
|
||||||
short_description: Boot system using specific media through HP iLO interface
|
short_description: Boot system using specific media through HP iLO interface
|
||||||
description:
|
description:
|
||||||
- "This module boots a system through its HP iLO interface. The boot media
|
- 'This module boots a system through its HP iLO interface. The boot media can be one of: V(cdrom), V(floppy), V(hdd),
|
||||||
can be one of: cdrom, floppy, hdd, network or usb."
|
V(network), or V(usb).'
|
||||||
- This module requires the hpilo python module.
|
- This module requires the hpilo python module.
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
@ -43,33 +42,32 @@ options:
|
||||||
type: str
|
type: str
|
||||||
media:
|
media:
|
||||||
description:
|
description:
|
||||||
- The boot media to boot the system from
|
- The boot media to boot the system from.
|
||||||
choices: [ "cdrom", "floppy", "rbsu", "hdd", "network", "normal", "usb" ]
|
choices: ["cdrom", "floppy", "rbsu", "hdd", "network", "normal", "usb"]
|
||||||
type: str
|
type: str
|
||||||
image:
|
image:
|
||||||
description:
|
description:
|
||||||
- The URL of a cdrom, floppy or usb boot media image.
|
- The URL of a cdrom, floppy or usb boot media image in the form V(protocol://username:password@hostname:port/filename).
|
||||||
protocol://username:password@hostname:port/filename
|
- V(protocol) is either V(http) or V(https).
|
||||||
- protocol is either 'http' or 'https'
|
- V(username:password) is optional.
|
||||||
- username:password is optional
|
- V(port) is optional.
|
||||||
- port is optional
|
|
||||||
type: str
|
type: str
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- The state of the boot media.
|
- The state of the boot media.
|
||||||
- "no_boot: Do not boot from the device"
|
- "V(no_boot): Do not boot from the device"
|
||||||
- "boot_once: Boot from the device once and then notthereafter"
|
- "V(boot_once): Boot from the device once and then notthereafter"
|
||||||
- "boot_always: Boot from the device each time the server is rebooted"
|
- "V(boot_always): Boot from the device each time the server is rebooted"
|
||||||
- "connect: Connect the virtual media device and set to boot_always"
|
- "V(connect): Connect the virtual media device and set to boot_always"
|
||||||
- "disconnect: Disconnects the virtual media device and set to no_boot"
|
- "V(disconnect): Disconnects the virtual media device and set to no_boot"
|
||||||
- "poweroff: Power off the server"
|
- "V(poweroff): Power off the server"
|
||||||
default: boot_once
|
default: boot_once
|
||||||
type: str
|
type: str
|
||||||
choices: [ "boot_always", "boot_once", "connect", "disconnect", "no_boot", "poweroff" ]
|
choices: ["boot_always", "boot_once", "connect", "disconnect", "no_boot", "poweroff"]
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
- Whether to force a reboot (even when the system is already booted).
|
- Whether to force a reboot (even when the system is already booted).
|
||||||
- As a safeguard, without force, hpilo_boot will refuse to reboot a server that is already running.
|
- As a safeguard, without force, hpilo_boot will refuse to reboot a server that is already running.
|
||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
ssl_version:
|
ssl_version:
|
||||||
|
@ -77,16 +75,16 @@ options:
|
||||||
- Change the ssl_version used.
|
- Change the ssl_version used.
|
||||||
default: TLSv1
|
default: TLSv1
|
||||||
type: str
|
type: str
|
||||||
choices: [ "SSLv3", "SSLv23", "TLSv1", "TLSv1_1", "TLSv1_2" ]
|
choices: ["SSLv3", "SSLv23", "TLSv1", "TLSv1_1", "TLSv1_2"]
|
||||||
requirements:
|
requirements:
|
||||||
- python-hpilo
|
- python-hpilo
|
||||||
notes:
|
notes:
|
||||||
- To use a USB key image you need to specify floppy as boot media.
|
- To use a USB key image you need to specify floppy as boot media.
|
||||||
- This module ought to be run from a system that can access the HP iLO
|
- This module ought to be run from a system that can access the HP iLO interface directly, either by using C(local_action)
|
||||||
interface directly, either by using C(local_action) or using C(delegate_to).
|
or using C(delegate_to).
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r"""
|
||||||
- name: Task to boot a system using an ISO from an HP iLO interface only if the system is an HP server
|
- name: Task to boot a system using an ISO from an HP iLO interface only if the system is an HP server
|
||||||
community.general.hpilo_boot:
|
community.general.hpilo_boot:
|
||||||
host: YOUR_ILO_ADDRESS
|
host: YOUR_ILO_ADDRESS
|
||||||
|
@ -104,11 +102,11 @@ EXAMPLES = r'''
|
||||||
password: YOUR_ILO_PASSWORD
|
password: YOUR_ILO_PASSWORD
|
||||||
state: poweroff
|
state: poweroff
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
# Default return values
|
# Default return values
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
@ -9,23 +9,21 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hpilo_info
|
module: hpilo_info
|
||||||
author: Dag Wieers (@dagwieers)
|
author: Dag Wieers (@dagwieers)
|
||||||
short_description: Gather information through an HP iLO interface
|
short_description: Gather information through an HP iLO interface
|
||||||
description:
|
description:
|
||||||
- This module gathers information on a specific system using its HP iLO interface.
|
- This module gathers information on a specific system using its HP iLO interface. These information includes hardware and
|
||||||
These information includes hardware and network related information useful
|
network related information useful for provisioning (for example macaddress, uuid).
|
||||||
for provisioning (e.g. macaddress, uuid).
|
- This module requires the C(hpilo) python module.
|
||||||
- This module requires the C(hpilo) python module.
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
- community.general.attributes.info_module
|
- community.general.attributes.info_module
|
||||||
options:
|
options:
|
||||||
host:
|
host:
|
||||||
description:
|
description:
|
||||||
- The HP iLO hostname/address that is linked to the physical system.
|
- The HP iLO hostname/address that is linked to the physical system.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
login:
|
login:
|
||||||
|
@ -43,15 +41,15 @@ options:
|
||||||
- Change the ssl_version used.
|
- Change the ssl_version used.
|
||||||
default: TLSv1
|
default: TLSv1
|
||||||
type: str
|
type: str
|
||||||
choices: [ "SSLv3", "SSLv23", "TLSv1", "TLSv1_1", "TLSv1_2" ]
|
choices: ["SSLv3", "SSLv23", "TLSv1", "TLSv1_1", "TLSv1_2"]
|
||||||
requirements:
|
requirements:
|
||||||
- hpilo
|
- hpilo
|
||||||
notes:
|
notes:
|
||||||
- This module ought to be run from a system that can access the HP iLO
|
- This module ought to be run from a system that can access the HP iLO interface directly, either by using C(local_action)
|
||||||
interface directly, either by using C(local_action) or using C(delegate_to).
|
or using C(delegate_to).
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r"""
|
||||||
- name: Gather facts from a HP iLO interface only if the system is an HP server
|
- name: Gather facts from a HP iLO interface only if the system is an HP server
|
||||||
community.general.hpilo_info:
|
community.general.hpilo_info:
|
||||||
host: YOUR_ILO_ADDRESS
|
host: YOUR_ILO_ADDRESS
|
||||||
|
@ -64,71 +62,71 @@ EXAMPLES = r'''
|
||||||
- ansible.builtin.fail:
|
- ansible.builtin.fail:
|
||||||
msg: 'CMDB serial ({{ cmdb_serialno }}) does not match hardware serial ({{ results.hw_system_serial }}) !'
|
msg: 'CMDB serial ({{ cmdb_serialno }}) does not match hardware serial ({{ results.hw_system_serial }}) !'
|
||||||
when: cmdb_serialno != results.hw_system_serial
|
when: cmdb_serialno != results.hw_system_serial
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = r'''
|
RETURN = r"""
|
||||||
# Typical output of HP iLO_info for a physical system
|
# Typical output of HP iLO_info for a physical system
|
||||||
hw_bios_date:
|
hw_bios_date:
|
||||||
description: BIOS date
|
description: BIOS date.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: 05/05/2011
|
sample: 05/05/2011
|
||||||
|
|
||||||
hw_bios_version:
|
hw_bios_version:
|
||||||
description: BIOS version
|
description: BIOS version.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: P68
|
sample: P68
|
||||||
|
|
||||||
hw_ethX:
|
hw_ethX:
|
||||||
description: Interface information (for each interface)
|
description: Interface information (for each interface).
|
||||||
returned: always
|
returned: always
|
||||||
type: dict
|
type: dict
|
||||||
sample:
|
sample:
|
||||||
- macaddress: 00:11:22:33:44:55
|
- macaddress: 00:11:22:33:44:55
|
||||||
macaddress_dash: 00-11-22-33-44-55
|
macaddress_dash: 00-11-22-33-44-55
|
||||||
|
|
||||||
hw_eth_ilo:
|
hw_eth_ilo:
|
||||||
description: Interface information (for the iLO network interface)
|
description: Interface information (for the iLO network interface).
|
||||||
returned: always
|
returned: always
|
||||||
type: dict
|
type: dict
|
||||||
sample:
|
sample:
|
||||||
- macaddress: 00:11:22:33:44:BA
|
- macaddress: 00:11:22:33:44:BA
|
||||||
- macaddress_dash: 00-11-22-33-44-BA
|
- macaddress_dash: 00-11-22-33-44-BA
|
||||||
|
|
||||||
hw_product_name:
|
hw_product_name:
|
||||||
description: Product name
|
description: Product name.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: ProLiant DL360 G7
|
sample: ProLiant DL360 G7
|
||||||
|
|
||||||
hw_product_uuid:
|
hw_product_uuid:
|
||||||
description: Product UUID
|
description: Product UUID.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: ef50bac8-2845-40ff-81d9-675315501dac
|
sample: ef50bac8-2845-40ff-81d9-675315501dac
|
||||||
|
|
||||||
hw_system_serial:
|
hw_system_serial:
|
||||||
description: System serial number
|
description: System serial number.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: ABC12345D6
|
sample: ABC12345D6
|
||||||
|
|
||||||
hw_uuid:
|
hw_uuid:
|
||||||
description: Hardware UUID
|
description: Hardware UUID.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: 123456ABC78901D2
|
sample: 123456ABC78901D2
|
||||||
|
|
||||||
host_power_status:
|
host_power_status:
|
||||||
description:
|
description:
|
||||||
- Power status of host.
|
- Power status of host.
|
||||||
- Will be one of V(ON), V(OFF) and V(UNKNOWN).
|
- Will be one of V(ON), V(OFF) and V(UNKNOWN).
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: "ON"
|
sample: "ON"
|
||||||
version_added: 3.5.0
|
version_added: 3.5.0
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
@ -9,13 +9,12 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hponcfg
|
module: hponcfg
|
||||||
author: Dag Wieers (@dagwieers)
|
author: Dag Wieers (@dagwieers)
|
||||||
short_description: Configure HP iLO interface using hponcfg
|
short_description: Configure HP iLO interface using C(hponcfg)
|
||||||
description:
|
description:
|
||||||
- This modules configures the HP iLO interface using hponcfg.
|
- This modules configures the HP iLO interface using C(hponcfg).
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
|
@ -26,32 +25,32 @@ attributes:
|
||||||
options:
|
options:
|
||||||
path:
|
path:
|
||||||
description:
|
description:
|
||||||
- The XML file as accepted by hponcfg.
|
- The XML file as accepted by C(hponcfg).
|
||||||
required: true
|
required: true
|
||||||
aliases: ['src']
|
aliases: ['src']
|
||||||
type: path
|
type: path
|
||||||
minfw:
|
minfw:
|
||||||
description:
|
description:
|
||||||
- The minimum firmware level needed.
|
- The minimum firmware level needed.
|
||||||
required: false
|
required: false
|
||||||
type: str
|
type: str
|
||||||
executable:
|
executable:
|
||||||
description:
|
description:
|
||||||
- Path to the hponcfg executable (C(hponcfg) which uses $PATH).
|
- Path to the hponcfg executable (C(hponcfg) which uses E(PATH)).
|
||||||
default: hponcfg
|
default: hponcfg
|
||||||
type: str
|
type: str
|
||||||
verbose:
|
verbose:
|
||||||
description:
|
description:
|
||||||
- Run hponcfg in verbose mode (-v).
|
- Run C(hponcfg) in verbose mode (-v).
|
||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
requirements:
|
requirements:
|
||||||
- hponcfg tool
|
- hponcfg tool
|
||||||
notes:
|
notes:
|
||||||
- You need a working hponcfg on the target system.
|
- You need a working C(hponcfg) on the target system.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r"""
|
||||||
- name: Example hponcfg configuration XML
|
- name: Example hponcfg configuration XML
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
content: |
|
content: |
|
||||||
|
@ -78,7 +77,7 @@ EXAMPLES = r'''
|
||||||
community.general.hponcfg:
|
community.general.hponcfg:
|
||||||
src: /tmp/enable-ssh.xml
|
src: /tmp/enable-ssh.xml
|
||||||
executable: /opt/hp/tools/hponcfg
|
executable: /opt/hp/tools/hponcfg
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
||||||
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
|
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
|
||||||
|
|
|
@ -9,7 +9,7 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
module: htpasswd
|
module: htpasswd
|
||||||
short_description: Manage user files for basic authentication
|
short_description: Manage user files for basic authentication
|
||||||
description:
|
description:
|
||||||
|
@ -24,13 +24,13 @@ options:
|
||||||
path:
|
path:
|
||||||
type: path
|
type: path
|
||||||
required: true
|
required: true
|
||||||
aliases: [ dest, destfile ]
|
aliases: [dest, destfile]
|
||||||
description:
|
description:
|
||||||
- Path to the file that contains the usernames and passwords.
|
- Path to the file that contains the usernames and passwords.
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
aliases: [ username ]
|
aliases: [username]
|
||||||
description:
|
description:
|
||||||
- User name to add or remove.
|
- User name to add or remove.
|
||||||
password:
|
password:
|
||||||
|
@ -44,19 +44,17 @@ options:
|
||||||
required: false
|
required: false
|
||||||
default: "apr_md5_crypt"
|
default: "apr_md5_crypt"
|
||||||
description:
|
description:
|
||||||
- Hashing scheme to be used. As well as the four choices listed
|
- Hashing scheme to be used. As well as the four choices listed here, you can also use any other hash supported by passlib,
|
||||||
here, you can also use any other hash supported by passlib, such as
|
such as V(portable_apache22) and V(host_apache24); or V(md5_crypt) and V(sha256_crypt), which are Linux passwd hashes.
|
||||||
V(portable_apache22) and V(host_apache24); or V(md5_crypt) and V(sha256_crypt),
|
Only some schemes in addition to the four choices below will be compatible with Apache or Nginx, and supported schemes
|
||||||
which are Linux passwd hashes. Only some schemes in addition to
|
depend on passlib version and its dependencies.
|
||||||
the four choices below will be compatible with Apache or Nginx, and
|
|
||||||
supported schemes depend on passlib version and its dependencies.
|
|
||||||
- See U(https://passlib.readthedocs.io/en/stable/lib/passlib.apache.html#passlib.apache.HtpasswdFile) parameter C(default_scheme).
|
- See U(https://passlib.readthedocs.io/en/stable/lib/passlib.apache.html#passlib.apache.HtpasswdFile) parameter C(default_scheme).
|
||||||
- 'Some of the available choices might be: V(apr_md5_crypt), V(des_crypt), V(ldap_sha1), V(plaintext).'
|
- 'Some of the available choices might be: V(apr_md5_crypt), V(des_crypt), V(ldap_sha1), V(plaintext).'
|
||||||
aliases: [crypt_scheme]
|
aliases: [crypt_scheme]
|
||||||
state:
|
state:
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
choices: [ present, absent ]
|
choices: [present, absent]
|
||||||
default: "present"
|
default: "present"
|
||||||
description:
|
description:
|
||||||
- Whether the user entry should be present or not.
|
- Whether the user entry should be present or not.
|
||||||
|
@ -65,22 +63,21 @@ options:
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
description:
|
description:
|
||||||
- Used with O(state=present). If V(true), the file will be created
|
- Used with O(state=present). If V(true), the file will be created if it does not exist. Conversely, if set to V(false)
|
||||||
if it does not exist. Conversely, if set to V(false) and the file
|
and the file does not exist it will fail.
|
||||||
does not exist it will fail.
|
|
||||||
notes:
|
notes:
|
||||||
- "This module depends on the C(passlib) Python library, which needs to be installed on all target systems."
|
- This module depends on the C(passlib) Python library, which needs to be installed on all target systems.
|
||||||
- "On Debian < 11, Ubuntu <= 20.04, or Fedora: install C(python-passlib)."
|
- 'On Debian < 11, Ubuntu <= 20.04, or Fedora: install C(python-passlib).'
|
||||||
- "On Debian, Ubuntu: install C(python3-passlib)."
|
- 'On Debian, Ubuntu: install C(python3-passlib).'
|
||||||
- "On RHEL or CentOS: Enable EPEL, then install C(python-passlib)."
|
- 'On RHEL or CentOS: Enable EPEL, then install C(python-passlib).'
|
||||||
requirements: [ passlib>=1.6 ]
|
requirements: [passlib>=1.6]
|
||||||
author: "Ansible Core Team"
|
author: "Ansible Core Team"
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- files
|
- files
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = r"""
|
||||||
- name: Add a user to a password file and ensure permissions are set
|
- name: Add a user to a password file and ensure permissions are set
|
||||||
community.general.htpasswd:
|
community.general.htpasswd:
|
||||||
path: /etc/nginx/passwdfile
|
path: /etc/nginx/passwdfile
|
||||||
|
|
|
@ -12,230 +12,207 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_ecs_instance
|
module: hwc_ecs_instance
|
||||||
description:
|
description:
|
||||||
- instance management.
|
- Instance management.
|
||||||
short_description: Creates a resource of Ecs/Instance in Huawei Cloud
|
short_description: Creates a resource of Ecs/Instance in Huawei Cloud
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
|
||||||
type: str
|
|
||||||
choices: ['present', 'absent']
|
|
||||||
default: 'present'
|
|
||||||
timeouts:
|
|
||||||
description:
|
|
||||||
- The timeouts for each operations.
|
|
||||||
type: dict
|
|
||||||
default: {}
|
|
||||||
suboptions:
|
|
||||||
create:
|
|
||||||
description:
|
|
||||||
- The timeouts for create operation.
|
|
||||||
type: str
|
|
||||||
default: '30m'
|
|
||||||
update:
|
|
||||||
description:
|
|
||||||
- The timeouts for update operation.
|
|
||||||
type: str
|
|
||||||
default: '30m'
|
|
||||||
delete:
|
|
||||||
description:
|
|
||||||
- The timeouts for delete operation.
|
|
||||||
type: str
|
|
||||||
default: '30m'
|
|
||||||
availability_zone:
|
|
||||||
description:
|
|
||||||
- Specifies the name of the AZ where the ECS is located.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
flavor_name:
|
|
||||||
description:
|
|
||||||
- Specifies the name of the system flavor.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
image_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of the system image.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- Specifies the ECS name. Value requirements consists of 1 to 64
|
|
||||||
characters, including letters, digits, underscores (V(_)), hyphens
|
|
||||||
(V(-)), periods (V(.)).
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
nics:
|
|
||||||
description:
|
|
||||||
- Specifies the NIC information of the ECS. Constraints the
|
|
||||||
network of the NIC must belong to the VPC specified by vpc_id. A
|
|
||||||
maximum of 12 NICs can be attached to an ECS.
|
|
||||||
type: list
|
|
||||||
elements: dict
|
|
||||||
required: true
|
|
||||||
suboptions:
|
|
||||||
ip_address:
|
|
||||||
description:
|
|
||||||
- Specifies the IP address of the NIC. The value is an IPv4
|
|
||||||
address. Its value must be an unused IP
|
|
||||||
address in the network segment of the subnet.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
subnet_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of subnet.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
root_volume:
|
|
||||||
description:
|
|
||||||
- Specifies the configuration of the ECS's system disks.
|
|
||||||
type: dict
|
|
||||||
required: true
|
|
||||||
suboptions:
|
|
||||||
volume_type:
|
|
||||||
description:
|
|
||||||
- Specifies the ECS system disk type.
|
|
||||||
- SATA is common I/O disk type.
|
|
||||||
- SAS is high I/O disk type.
|
|
||||||
- SSD is ultra-high I/O disk type.
|
|
||||||
- co-p1 is high I/O (performance-optimized I) disk type.
|
|
||||||
- uh-l1 is ultra-high I/O (latency-optimized) disk type.
|
|
||||||
- NOTE is For HANA, HL1, and HL2 ECSs, use co-p1 and uh-l1
|
|
||||||
disks. For other ECSs, do not use co-p1 or uh-l1 disks.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
size:
|
|
||||||
description:
|
|
||||||
- Specifies the system disk size, in GB. The value range is
|
|
||||||
1 to 1024. The system disk size must be
|
|
||||||
greater than or equal to the minimum system disk size
|
|
||||||
supported by the image (min_disk attribute of the image).
|
|
||||||
If this parameter is not specified or is set to 0, the
|
|
||||||
default system disk size is the minimum value of the
|
|
||||||
system disk in the image (min_disk attribute of the
|
|
||||||
image).
|
|
||||||
type: int
|
|
||||||
required: false
|
|
||||||
snapshot_id:
|
|
||||||
description:
|
|
||||||
- Specifies the snapshot ID or ID of the original data disk
|
|
||||||
contained in the full-ECS image.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
vpc_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of the VPC to which the ECS belongs.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
admin_pass:
|
|
||||||
description:
|
|
||||||
- Specifies the initial login password of the administrator account
|
|
||||||
for logging in to an ECS using password authentication. The Linux
|
|
||||||
administrator is root, and the Windows administrator is
|
|
||||||
Administrator. Password complexity requirements, consists of 8 to
|
|
||||||
26 characters. The password must contain at least three of the
|
|
||||||
following character types 'uppercase letters, lowercase letters,
|
|
||||||
digits, and special characters (!@$%^-_=+[{}]:,./?)'. The password
|
|
||||||
cannot contain the username or the username in reverse. The
|
|
||||||
Windows ECS password cannot contain the username, the username in
|
|
||||||
reverse, or more than two consecutive characters in the username.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
data_volumes:
|
|
||||||
description:
|
|
||||||
- Specifies the data disks of ECS instance.
|
|
||||||
type: list
|
|
||||||
elements: dict
|
|
||||||
required: false
|
|
||||||
suboptions:
|
|
||||||
volume_id:
|
|
||||||
description:
|
|
||||||
- Specifies the disk ID.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
device:
|
|
||||||
description:
|
|
||||||
- Specifies the disk device name.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
description:
|
description:
|
||||||
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
|
type: str
|
||||||
|
choices: ['present', 'absent']
|
||||||
|
default: 'present'
|
||||||
|
timeouts:
|
||||||
|
description:
|
||||||
|
- The timeouts for each operations.
|
||||||
|
type: dict
|
||||||
|
default: {}
|
||||||
|
suboptions:
|
||||||
|
create:
|
||||||
description:
|
description:
|
||||||
- Specifies the description of an ECS, which is a null string by
|
- The timeouts for create operation.
|
||||||
default. Can contain a maximum of 85 characters. Cannot contain
|
type: str
|
||||||
special characters, such as < and >.
|
default: '30m'
|
||||||
|
update:
|
||||||
|
description:
|
||||||
|
- The timeouts for update operation.
|
||||||
|
type: str
|
||||||
|
default: '30m'
|
||||||
|
delete:
|
||||||
|
description:
|
||||||
|
- The timeouts for delete operation.
|
||||||
|
type: str
|
||||||
|
default: '30m'
|
||||||
|
availability_zone:
|
||||||
|
description:
|
||||||
|
- Specifies the name of the AZ where the ECS is located.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
flavor_name:
|
||||||
|
description:
|
||||||
|
- Specifies the name of the system flavor.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
image_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of the system image.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Specifies the ECS name. Value requirements consists of 1 to 64 characters, including letters, digits, underscores
|
||||||
|
(V(_)), hyphens (V(-)), periods (V(.)).
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
nics:
|
||||||
|
description:
|
||||||
|
- Specifies the NIC information of the ECS. Constraints the network of the NIC must belong to the VPC specified by vpc_id.
|
||||||
|
A maximum of 12 NICs can be attached to an ECS.
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
required: true
|
||||||
|
suboptions:
|
||||||
|
ip_address:
|
||||||
|
description:
|
||||||
|
- Specifies the IP address of the NIC. The value is an IPv4 address. Its value must be an unused IP address in the
|
||||||
|
network segment of the subnet.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
subnet_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of subnet.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
root_volume:
|
||||||
|
description:
|
||||||
|
- Specifies the configuration of the ECS's system disks.
|
||||||
|
type: dict
|
||||||
|
required: true
|
||||||
|
suboptions:
|
||||||
|
volume_type:
|
||||||
|
description:
|
||||||
|
- Specifies the ECS system disk type.
|
||||||
|
- SATA is common I/O disk type.
|
||||||
|
- SAS is high I/O disk type.
|
||||||
|
- SSD is ultra-high I/O disk type.
|
||||||
|
- Co-p1 is high I/O (performance-optimized I) disk type.
|
||||||
|
- Uh-l1 is ultra-high I/O (latency-optimized) disk type.
|
||||||
|
- NOTE is For HANA, HL1, and HL2 ECSs, use co-p1 and uh-l1 disks. For other ECSs, do not use co-p1 or uh-l1 disks.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
size:
|
||||||
|
description:
|
||||||
|
- Specifies the system disk size, in GB. The value range is 1 to 1024. The system disk size must be greater than
|
||||||
|
or equal to the minimum system disk size supported by the image (min_disk attribute of the image). If this parameter
|
||||||
|
is not specified or is set to 0, the default system disk size is the minimum value of the system disk in the image
|
||||||
|
(min_disk attribute of the image).
|
||||||
|
type: int
|
||||||
|
required: false
|
||||||
|
snapshot_id:
|
||||||
|
description:
|
||||||
|
- Specifies the snapshot ID or ID of the original data disk contained in the full-ECS image.
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
eip_id:
|
vpc_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of the VPC to which the ECS belongs.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
admin_pass:
|
||||||
|
description:
|
||||||
|
- Specifies the initial login password of the administrator account for logging in to an ECS using password authentication.
|
||||||
|
The Linux administrator is root, and the Windows administrator is Administrator. Password complexity requirements,
|
||||||
|
consists of 8 to 26 characters. The password must contain at least three of the following character types 'uppercase
|
||||||
|
letters, lowercase letters, digits, and special characters (V(!@$%^-_=+[{}]:,./?))'. The password cannot contain the
|
||||||
|
username or the username in reverse. The Windows ECS password cannot contain the username, the username in reverse,
|
||||||
|
or more than two consecutive characters in the username.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
data_volumes:
|
||||||
|
description:
|
||||||
|
- Specifies the data disks of ECS instance.
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
required: false
|
||||||
|
suboptions:
|
||||||
|
volume_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the ID of the elastic IP address assigned to the ECS.
|
- Specifies the disk ID.
|
||||||
Only elastic IP addresses in the DOWN state can be
|
type: str
|
||||||
assigned.
|
required: true
|
||||||
type: str
|
device:
|
||||||
required: false
|
description:
|
||||||
enable_auto_recovery:
|
- Specifies the disk device name.
|
||||||
description:
|
|
||||||
- Specifies whether automatic recovery is enabled on the ECS.
|
|
||||||
type: bool
|
|
||||||
required: false
|
|
||||||
enterprise_project_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of the enterprise project to which the ECS
|
|
||||||
belongs.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
security_groups:
|
|
||||||
description:
|
|
||||||
- Specifies the security groups of the ECS. If this
|
|
||||||
parameter is left blank, the default security group is bound to
|
|
||||||
the ECS by default.
|
|
||||||
type: list
|
|
||||||
elements: str
|
|
||||||
required: false
|
|
||||||
server_metadata:
|
|
||||||
description:
|
|
||||||
- Specifies the metadata of ECS to be created.
|
|
||||||
type: dict
|
|
||||||
required: false
|
|
||||||
server_tags:
|
|
||||||
description:
|
|
||||||
- Specifies the tags of an ECS. When you create ECSs, one ECS
|
|
||||||
supports up to 10 tags.
|
|
||||||
type: dict
|
|
||||||
required: false
|
|
||||||
ssh_key_name:
|
|
||||||
description:
|
|
||||||
- Specifies the name of the SSH key used for logging in to the ECS.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
user_data:
|
|
||||||
description:
|
|
||||||
- Specifies the user data to be injected during the ECS creation
|
|
||||||
process. Text, text files, and gzip files can be injected.
|
|
||||||
The content to be injected must be encoded with
|
|
||||||
base64. The maximum size of the content to be injected (before
|
|
||||||
encoding) is 32 KB. For Linux ECSs, this parameter does not take
|
|
||||||
effect when adminPass is used.
|
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
|
description:
|
||||||
|
description:
|
||||||
|
- Specifies the description of an ECS, which is a null string by default. Can contain a maximum of 85 characters. Cannot
|
||||||
|
contain special characters, such as V(<) and V(>).
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
eip_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of the elastic IP address assigned to the ECS. Only elastic IP addresses in the DOWN state can be
|
||||||
|
assigned.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
enable_auto_recovery:
|
||||||
|
description:
|
||||||
|
- Specifies whether automatic recovery is enabled on the ECS.
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
enterprise_project_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of the enterprise project to which the ECS belongs.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
security_groups:
|
||||||
|
description:
|
||||||
|
- Specifies the security groups of the ECS. If this parameter is left blank, the default security group is bound to
|
||||||
|
the ECS by default.
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
required: false
|
||||||
|
server_metadata:
|
||||||
|
description:
|
||||||
|
- Specifies the metadata of ECS to be created.
|
||||||
|
type: dict
|
||||||
|
required: false
|
||||||
|
server_tags:
|
||||||
|
description:
|
||||||
|
- Specifies the tags of an ECS. When you create ECSs, one ECS supports up to 10 tags.
|
||||||
|
type: dict
|
||||||
|
required: false
|
||||||
|
ssh_key_name:
|
||||||
|
description:
|
||||||
|
- Specifies the name of the SSH key used for logging in to the ECS.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
user_data:
|
||||||
|
description:
|
||||||
|
- Specifies the user data to be injected during the ECS creation process. Text, text files, and gzip files can be injected.
|
||||||
|
The content to be injected must be encoded with base64. The maximum size of the content to be injected (before encoding)
|
||||||
|
is 32 KB. For Linux ECSs, this parameter does not take effect when adminPass is used.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# create an ecs instance
|
# create an ecs instance
|
||||||
- name: Create a vpc
|
- name: Create a vpc
|
||||||
hwc_network_vpc:
|
hwc_network_vpc:
|
||||||
|
@ -285,238 +262,216 @@ EXAMPLES = '''
|
||||||
vpc_id: "{{ vpc.id }}"
|
vpc_id: "{{ vpc.id }}"
|
||||||
root_volume:
|
root_volume:
|
||||||
volume_type: "SAS"
|
volume_type: "SAS"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
availability_zone:
|
availability_zone:
|
||||||
description:
|
description:
|
||||||
- Specifies the name of the AZ where the ECS is located.
|
- Specifies the name of the AZ where the ECS is located.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
flavor_name:
|
flavor_name:
|
||||||
description:
|
description:
|
||||||
- Specifies the name of the system flavor.
|
- Specifies the name of the system flavor.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
image_id:
|
image_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the ID of the system image.
|
- Specifies the ID of the system image.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Specifies the ECS name. Value requirements "Consists of 1 to 64
|
- Specifies the ECS name. Value requirements "Consists of 1 to 64 characters, including letters, digits, underscores (V(_)),
|
||||||
characters, including letters, digits, underscores (V(_)), hyphens
|
hyphens (V(-)), periods (V(.)).".
|
||||||
(V(-)), periods (V(.)).".
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
nics:
|
||||||
nics:
|
description:
|
||||||
description:
|
- Specifies the NIC information of the ECS. The network of the NIC must belong to the VPC specified by vpc_id. A maximum
|
||||||
- Specifies the NIC information of the ECS. The
|
of 12 NICs can be attached to an ECS.
|
||||||
network of the NIC must belong to the VPC specified by vpc_id. A
|
type: list
|
||||||
maximum of 12 NICs can be attached to an ECS.
|
returned: success
|
||||||
type: list
|
contains:
|
||||||
returned: success
|
ip_address:
|
||||||
contains:
|
description:
|
||||||
ip_address:
|
- Specifies the IP address of the NIC. The value is an IPv4 address. Its value must be an unused IP address in the
|
||||||
description:
|
network segment of the subnet.
|
||||||
- Specifies the IP address of the NIC. The value is an IPv4
|
type: str
|
||||||
address. Its value must be an unused IP
|
returned: success
|
||||||
address in the network segment of the subnet.
|
subnet_id:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the ID of subnet.
|
||||||
subnet_id:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
- Specifies the ID of subnet.
|
port_id:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the port ID corresponding to the IP address.
|
||||||
port_id:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
- Specifies the port ID corresponding to the IP address.
|
root_volume:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the configuration of the ECS's system disks.
|
||||||
root_volume:
|
type: dict
|
||||||
description:
|
returned: success
|
||||||
- Specifies the configuration of the ECS's system disks.
|
contains:
|
||||||
type: dict
|
volume_type:
|
||||||
returned: success
|
description:
|
||||||
contains:
|
- Specifies the ECS system disk type.
|
||||||
volume_type:
|
- SATA is common I/O disk type.
|
||||||
description:
|
- SAS is high I/O disk type.
|
||||||
- Specifies the ECS system disk type.
|
- SSD is ultra-high I/O disk type.
|
||||||
- SATA is common I/O disk type.
|
- Co-p1 is high I/O (performance-optimized I) disk type.
|
||||||
- SAS is high I/O disk type.
|
- Uh-l1 is ultra-high I/O (latency-optimized) disk type.
|
||||||
- SSD is ultra-high I/O disk type.
|
- NOTE is For HANA, HL1, and HL2 ECSs, use co-p1 and uh-l1 disks. For other ECSs, do not use co-p1 or uh-l1 disks.
|
||||||
- co-p1 is high I/O (performance-optimized I) disk type.
|
type: str
|
||||||
- uh-l1 is ultra-high I/O (latency-optimized) disk type.
|
returned: success
|
||||||
- NOTE is For HANA, HL1, and HL2 ECSs, use co-p1 and uh-l1
|
size:
|
||||||
disks. For other ECSs, do not use co-p1 or uh-l1 disks.
|
description:
|
||||||
type: str
|
- Specifies the system disk size, in GB. The value range is 1 to 1024. The system disk size must be greater than or
|
||||||
returned: success
|
equal to the minimum system disk size supported by the image (min_disk attribute of the image). If this parameter
|
||||||
size:
|
is not specified or is set to 0, the default system disk size is the minimum value of the system disk in the image
|
||||||
description:
|
(min_disk attribute of the image).
|
||||||
- Specifies the system disk size, in GB. The value range is
|
type: int
|
||||||
1 to 1024. The system disk size must be
|
returned: success
|
||||||
greater than or equal to the minimum system disk size
|
snapshot_id:
|
||||||
supported by the image (min_disk attribute of the image).
|
description:
|
||||||
If this parameter is not specified or is set to 0, the
|
- Specifies the snapshot ID or ID of the original data disk contained in the full-ECS image.
|
||||||
default system disk size is the minimum value of the
|
type: str
|
||||||
system disk in the image (min_disk attribute of the
|
returned: success
|
||||||
image).
|
device:
|
||||||
type: int
|
description:
|
||||||
returned: success
|
- Specifies the disk device name.
|
||||||
snapshot_id:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
- Specifies the snapshot ID or ID of the original data disk
|
volume_id:
|
||||||
contained in the full-ECS image.
|
description:
|
||||||
type: str
|
- Specifies the disk ID.
|
||||||
returned: success
|
type: str
|
||||||
device:
|
returned: success
|
||||||
description:
|
vpc_id:
|
||||||
- Specifies the disk device name.
|
description:
|
||||||
type: str
|
- Specifies the ID of the VPC to which the ECS belongs.
|
||||||
returned: success
|
type: str
|
||||||
volume_id:
|
returned: success
|
||||||
description:
|
admin_pass:
|
||||||
- Specifies the disk ID.
|
description:
|
||||||
type: str
|
- Specifies the initial login password of the administrator account for logging in to an ECS using password authentication.
|
||||||
returned: success
|
The Linux administrator is root, and the Windows administrator is Administrator. Password complexity requirements consists
|
||||||
vpc_id:
|
of 8 to 26 characters. The password must contain at least three of the following character types "uppercase letters,
|
||||||
description:
|
lowercase letters, digits, and special characters (!@$%^-_=+[{}]:,./?)". The password cannot contain the username or
|
||||||
- Specifies the ID of the VPC to which the ECS belongs.
|
the username in reverse. The Windows ECS password cannot contain the username, the username in reverse, or more than
|
||||||
type: str
|
two consecutive characters in the username.
|
||||||
returned: success
|
type: str
|
||||||
admin_pass:
|
returned: success
|
||||||
description:
|
data_volumes:
|
||||||
- Specifies the initial login password of the administrator account
|
description:
|
||||||
for logging in to an ECS using password authentication. The Linux
|
- Specifies the data disks of ECS instance.
|
||||||
administrator is root, and the Windows administrator is
|
type: list
|
||||||
Administrator. Password complexity requirements consists of 8 to
|
returned: success
|
||||||
26 characters. The password must contain at least three of the
|
contains:
|
||||||
following character types "uppercase letters, lowercase letters,
|
volume_id:
|
||||||
digits, and special characters (!@$%^-_=+[{}]:,./?)". The password
|
description:
|
||||||
cannot contain the username or the username in reverse. The
|
- Specifies the disk ID.
|
||||||
Windows ECS password cannot contain the username, the username in
|
type: str
|
||||||
reverse, or more than two consecutive characters in the username.
|
returned: success
|
||||||
type: str
|
device:
|
||||||
returned: success
|
description:
|
||||||
data_volumes:
|
- Specifies the disk device name.
|
||||||
description:
|
type: str
|
||||||
- Specifies the data disks of ECS instance.
|
returned: success
|
||||||
type: list
|
description:
|
||||||
returned: success
|
description:
|
||||||
contains:
|
- Specifies the description of an ECS, which is a null string by default. Can contain a maximum of 85 characters. Cannot
|
||||||
volume_id:
|
contain special characters, such as < and >.
|
||||||
description:
|
type: str
|
||||||
- Specifies the disk ID.
|
returned: success
|
||||||
type: str
|
eip_id:
|
||||||
returned: success
|
description:
|
||||||
device:
|
- Specifies the ID of the elastic IP address assigned to the ECS. Only elastic IP addresses in the DOWN state can be assigned.
|
||||||
description:
|
type: str
|
||||||
- Specifies the disk device name.
|
returned: success
|
||||||
type: str
|
enable_auto_recovery:
|
||||||
returned: success
|
description:
|
||||||
description:
|
- Specifies whether automatic recovery is enabled on the ECS.
|
||||||
description:
|
type: bool
|
||||||
- Specifies the description of an ECS, which is a null string by
|
returned: success
|
||||||
default. Can contain a maximum of 85 characters. Cannot contain
|
enterprise_project_id:
|
||||||
special characters, such as < and >.
|
description:
|
||||||
type: str
|
- Specifies the ID of the enterprise project to which the ECS belongs.
|
||||||
returned: success
|
type: str
|
||||||
eip_id:
|
returned: success
|
||||||
description:
|
security_groups:
|
||||||
- Specifies the ID of the elastic IP address assigned to the ECS.
|
description:
|
||||||
Only elastic IP addresses in the DOWN state can be assigned.
|
- Specifies the security groups of the ECS. If this parameter is left blank, the default security group is bound to the
|
||||||
type: str
|
ECS by default.
|
||||||
returned: success
|
type: list
|
||||||
enable_auto_recovery:
|
returned: success
|
||||||
description:
|
server_metadata:
|
||||||
- Specifies whether automatic recovery is enabled on the ECS.
|
description:
|
||||||
type: bool
|
- Specifies the metadata of ECS to be created.
|
||||||
returned: success
|
type: dict
|
||||||
enterprise_project_id:
|
returned: success
|
||||||
description:
|
server_tags:
|
||||||
- Specifies the ID of the enterprise project to which the ECS
|
description:
|
||||||
belongs.
|
- Specifies the tags of an ECS. When you create ECSs, one ECS supports up to 10 tags.
|
||||||
type: str
|
type: dict
|
||||||
returned: success
|
returned: success
|
||||||
security_groups:
|
ssh_key_name:
|
||||||
description:
|
description:
|
||||||
- Specifies the security groups of the ECS. If this parameter is left
|
- Specifies the name of the SSH key used for logging in to the ECS.
|
||||||
blank, the default security group is bound to the ECS by default.
|
type: str
|
||||||
type: list
|
returned: success
|
||||||
returned: success
|
user_data:
|
||||||
server_metadata:
|
description:
|
||||||
description:
|
- Specifies the user data to be injected during the ECS creation process. Text, text files, and gzip files can be injected.
|
||||||
- Specifies the metadata of ECS to be created.
|
The content to be injected must be encoded with base64. The maximum size of the content to be injected (before encoding)
|
||||||
type: dict
|
is 32 KB. For Linux ECSs, this parameter does not take effect when adminPass is used.
|
||||||
returned: success
|
type: str
|
||||||
server_tags:
|
returned: success
|
||||||
description:
|
config_drive:
|
||||||
- Specifies the tags of an ECS. When you create ECSs, one ECS
|
description:
|
||||||
supports up to 10 tags.
|
- Specifies the configuration driver.
|
||||||
type: dict
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
ssh_key_name:
|
created:
|
||||||
description:
|
description:
|
||||||
- Specifies the name of the SSH key used for logging in to the ECS.
|
- Specifies the time when an ECS was created.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
user_data:
|
disk_config_type:
|
||||||
description:
|
description:
|
||||||
- Specifies the user data to be injected during the ECS creation
|
- Specifies the disk configuration type. MANUAL is The image space is not expanded. AUTO is the image space of the system
|
||||||
process. Text, text files, and gzip files can be injected.
|
disk will be expanded to be as same as the flavor.
|
||||||
The content to be injected must be encoded with base64. The maximum
|
type: str
|
||||||
size of the content to be injected (before encoding) is 32 KB. For
|
returned: success
|
||||||
Linux ECSs, this parameter does not take effect when adminPass is
|
host_name:
|
||||||
used.
|
description:
|
||||||
type: str
|
- Specifies the host name of the ECS.
|
||||||
returned: success
|
type: str
|
||||||
config_drive:
|
returned: success
|
||||||
description:
|
image_name:
|
||||||
- Specifies the configuration driver.
|
description:
|
||||||
type: str
|
- Specifies the image name of the ECS.
|
||||||
returned: success
|
type: str
|
||||||
created:
|
returned: success
|
||||||
description:
|
power_state:
|
||||||
- Specifies the time when an ECS was created.
|
description:
|
||||||
type: str
|
- Specifies the power status of the ECS.
|
||||||
returned: success
|
type: int
|
||||||
disk_config_type:
|
returned: success
|
||||||
description:
|
server_alias:
|
||||||
- Specifies the disk configuration type. MANUAL is The image
|
description:
|
||||||
space is not expanded. AUTO is the image space of the system disk
|
- Specifies the ECS alias.
|
||||||
will be expanded to be as same as the flavor.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
status:
|
||||||
host_name:
|
description:
|
||||||
description:
|
- Specifies the ECS status. Options are ACTIVE, REBOOT, HARD_REBOOT, REBUILD, MIGRATING, BUILD, SHUTOFF, RESIZE, VERIFY_RESIZE,
|
||||||
- Specifies the host name of the ECS.
|
ERROR, and DELETED.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
image_name:
|
"""
|
||||||
description:
|
|
||||||
- Specifies the image name of the ECS.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
power_state:
|
|
||||||
description:
|
|
||||||
- Specifies the power status of the ECS.
|
|
||||||
type: int
|
|
||||||
returned: success
|
|
||||||
server_alias:
|
|
||||||
description:
|
|
||||||
- Specifies the ECS alias.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
status:
|
|
||||||
description:
|
|
||||||
- Specifies the ECS status. Options are ACTIVE, REBOOT, HARD_REBOOT,
|
|
||||||
REBUILD, MIGRATING, BUILD, SHUTOFF, RESIZE, VERIFY_RESIZE, ERROR,
|
|
||||||
and DELETED.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
||||||
|
|
|
@ -12,155 +12,135 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_evs_disk
|
module: hwc_evs_disk
|
||||||
description:
|
description:
|
||||||
- block storage management.
|
- Block storage management.
|
||||||
short_description: Creates a resource of Evs/Disk in Huawei Cloud
|
short_description: Creates a resource of Evs/Disk in Huawei Cloud
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
|
||||||
- Whether the given object should exist in Huaweicloud Cloud.
|
|
||||||
type: str
|
|
||||||
choices: ['present', 'absent']
|
|
||||||
default: 'present'
|
|
||||||
timeouts:
|
|
||||||
description:
|
|
||||||
- The timeouts for each operations.
|
|
||||||
type: dict
|
|
||||||
default: {}
|
|
||||||
suboptions:
|
|
||||||
create:
|
|
||||||
description:
|
|
||||||
- The timeouts for create operation.
|
|
||||||
type: str
|
|
||||||
default: '30m'
|
|
||||||
update:
|
|
||||||
description:
|
|
||||||
- The timeouts for update operation.
|
|
||||||
type: str
|
|
||||||
default: '30m'
|
|
||||||
delete:
|
|
||||||
description:
|
|
||||||
- The timeouts for delete operation.
|
|
||||||
type: str
|
|
||||||
default: '30m'
|
|
||||||
availability_zone:
|
|
||||||
description:
|
|
||||||
- Specifies the AZ where you want to create the disk.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- Specifies the disk name. The value can contain a maximum of 255
|
|
||||||
bytes.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
volume_type:
|
|
||||||
description:
|
|
||||||
- Specifies the disk type. Currently, the value can be SSD, SAS, or
|
|
||||||
SATA.
|
|
||||||
- SSD specifies the ultra-high I/O disk type.
|
|
||||||
- SAS specifies the high I/O disk type.
|
|
||||||
- SATA specifies the common I/O disk type.
|
|
||||||
- If the specified disk type is not available in the AZ, the
|
|
||||||
disk will fail to create. If the EVS disk is created from a
|
|
||||||
snapshot, the volume_type field must be the same as that of the
|
|
||||||
snapshot's source disk.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
backup_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of the backup that can be used to create a disk.
|
|
||||||
This parameter is mandatory when you use a backup to create the
|
|
||||||
disk.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
description:
|
description:
|
||||||
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
|
type: str
|
||||||
|
choices: ['present', 'absent']
|
||||||
|
default: 'present'
|
||||||
|
timeouts:
|
||||||
|
description:
|
||||||
|
- The timeouts for each operations.
|
||||||
|
type: dict
|
||||||
|
default: {}
|
||||||
|
suboptions:
|
||||||
|
create:
|
||||||
description:
|
description:
|
||||||
- Specifies the disk description. The value can contain a maximum
|
- The timeouts for create operation.
|
||||||
of 255 bytes.
|
|
||||||
type: str
|
type: str
|
||||||
required: false
|
default: '30m'
|
||||||
enable_full_clone:
|
update:
|
||||||
description:
|
description:
|
||||||
- If the disk is created from a snapshot and linked cloning needs
|
- The timeouts for update operation.
|
||||||
to be used, set this parameter to True.
|
|
||||||
type: bool
|
|
||||||
required: false
|
|
||||||
enable_scsi:
|
|
||||||
description:
|
|
||||||
- If this parameter is set to True, the disk device type will be
|
|
||||||
SCSI, which allows ECS OSs to directly access underlying storage
|
|
||||||
media. SCSI reservation command is supported. If this parameter
|
|
||||||
is set to False, the disk device type will be VBD, which supports
|
|
||||||
only simple SCSI read/write commands.
|
|
||||||
- If parameter enable_share is set to True and this parameter
|
|
||||||
is not specified, shared SCSI disks are created. SCSI EVS disks
|
|
||||||
cannot be created from backups, which means that this parameter
|
|
||||||
cannot be True if backup_id has been specified.
|
|
||||||
type: bool
|
|
||||||
required: false
|
|
||||||
enable_share:
|
|
||||||
description:
|
|
||||||
- Specifies whether the disk is shareable. The default value is
|
|
||||||
False.
|
|
||||||
type: bool
|
|
||||||
required: false
|
|
||||||
encryption_id:
|
|
||||||
description:
|
|
||||||
- Specifies the encryption ID. The length of it fixes at 36 bytes.
|
|
||||||
type: str
|
type: str
|
||||||
required: false
|
default: '30m'
|
||||||
enterprise_project_id:
|
delete:
|
||||||
description:
|
description:
|
||||||
- Specifies the enterprise project ID. This ID is associated with
|
- The timeouts for delete operation.
|
||||||
the disk during the disk creation. If it is not specified, the
|
|
||||||
disk is bound to the default enterprise project.
|
|
||||||
type: str
|
type: str
|
||||||
required: false
|
default: '30m'
|
||||||
image_id:
|
availability_zone:
|
||||||
description:
|
description:
|
||||||
- Specifies the image ID. If this parameter is specified, the disk
|
- Specifies the AZ where you want to create the disk.
|
||||||
is created from an image. BMS system disks cannot be
|
type: str
|
||||||
created from BMS images.
|
required: true
|
||||||
type: str
|
name:
|
||||||
required: false
|
description:
|
||||||
size:
|
- Specifies the disk name. The value can contain a maximum of 255 bytes.
|
||||||
description:
|
type: str
|
||||||
- Specifies the disk size, in GB. Its values are as follows, System
|
required: true
|
||||||
disk 1 GB to 1024 GB, Data disk 10 GB to 32768 GB. This
|
volume_type:
|
||||||
parameter is mandatory when you create an empty disk or use an
|
description:
|
||||||
image or a snapshot to create a disk. If you use an image or a
|
- Specifies the disk type. Currently, the value can be SSD, SAS, or SATA.
|
||||||
snapshot to create a disk, the disk size must be greater than or
|
- SSD specifies the ultra-high I/O disk type.
|
||||||
equal to the image or snapshot size. This parameter is optional
|
- SAS specifies the high I/O disk type.
|
||||||
when you use a backup to create a disk. If this parameter is not
|
- SATA specifies the common I/O disk type.
|
||||||
specified, the disk size is equal to the backup size.
|
- If the specified disk type is not available in the AZ, the disk will fail to create. If the EVS disk is created from
|
||||||
type: int
|
a snapshot, the volume_type field must be the same as that of the snapshot's source disk.
|
||||||
required: false
|
type: str
|
||||||
snapshot_id:
|
required: true
|
||||||
description:
|
backup_id:
|
||||||
- Specifies the snapshot ID. If this parameter is specified, the
|
description:
|
||||||
disk is created from a snapshot.
|
- Specifies the ID of the backup that can be used to create a disk. This parameter is mandatory when you use a backup
|
||||||
type: str
|
to create the disk.
|
||||||
required: false
|
type: str
|
||||||
|
required: false
|
||||||
|
description:
|
||||||
|
description:
|
||||||
|
- Specifies the disk description. The value can contain a maximum of 255 bytes.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
enable_full_clone:
|
||||||
|
description:
|
||||||
|
- If the disk is created from a snapshot and linked cloning needs to be used, set this parameter to True.
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
enable_scsi:
|
||||||
|
description:
|
||||||
|
- If this parameter is set to True, the disk device type will be SCSI, which allows ECS OSs to directly access underlying
|
||||||
|
storage media. SCSI reservation command is supported. If this parameter is set to False, the disk device type will
|
||||||
|
be VBD, which supports only simple SCSI read/write commands.
|
||||||
|
- If parameter enable_share is set to True and this parameter is not specified, shared SCSI disks are created. SCSI
|
||||||
|
EVS disks cannot be created from backups, which means that this parameter cannot be True if backup_id has been specified.
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
enable_share:
|
||||||
|
description:
|
||||||
|
- Specifies whether the disk is shareable. The default value is False.
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
encryption_id:
|
||||||
|
description:
|
||||||
|
- Specifies the encryption ID. The length of it fixes at 36 bytes.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
enterprise_project_id:
|
||||||
|
description:
|
||||||
|
- Specifies the enterprise project ID. This ID is associated with the disk during the disk creation. If it is not specified,
|
||||||
|
the disk is bound to the default enterprise project.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
image_id:
|
||||||
|
description:
|
||||||
|
- Specifies the image ID. If this parameter is specified, the disk is created from an image. BMS system disks cannot
|
||||||
|
be created from BMS images.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
size:
|
||||||
|
description:
|
||||||
|
- Specifies the disk size, in GB. Its values are as follows, System disk 1 GB to 1024 GB, Data disk 10 GB to 32768 GB.
|
||||||
|
This parameter is mandatory when you create an empty disk or use an image or a snapshot to create a disk. If you use
|
||||||
|
an image or a snapshot to create a disk, the disk size must be greater than or equal to the image or snapshot size.
|
||||||
|
This parameter is optional when you use a backup to create a disk. If this parameter is not specified, the disk size
|
||||||
|
is equal to the backup size.
|
||||||
|
type: int
|
||||||
|
required: false
|
||||||
|
snapshot_id:
|
||||||
|
description:
|
||||||
|
- Specifies the snapshot ID. If this parameter is specified, the disk is created from a snapshot.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# test create disk
|
# test create disk
|
||||||
- name: Create a disk
|
- name: Create a disk
|
||||||
community.general.hwc_evs_disk:
|
community.general.hwc_evs_disk:
|
||||||
|
@ -168,176 +148,153 @@ EXAMPLES = '''
|
||||||
name: "ansible_evs_disk_test"
|
name: "ansible_evs_disk_test"
|
||||||
volume_type: "SATA"
|
volume_type: "SATA"
|
||||||
size: 10
|
size: 10
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
availability_zone:
|
availability_zone:
|
||||||
description:
|
description:
|
||||||
- Specifies the AZ where you want to create the disk.
|
- Specifies the AZ where you want to create the disk.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Specifies the disk name. The value can contain a maximum of 255
|
- Specifies the disk name. The value can contain a maximum of 255 bytes.
|
||||||
bytes.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
volume_type:
|
||||||
volume_type:
|
description:
|
||||||
description:
|
- Specifies the disk type. Currently, the value can be SSD, SAS, or SATA.
|
||||||
- Specifies the disk type. Currently, the value can be SSD, SAS, or
|
- SSD specifies the ultra-high I/O disk type.
|
||||||
SATA.
|
- SAS specifies the high I/O disk type.
|
||||||
- SSD specifies the ultra-high I/O disk type.
|
- SATA specifies the common I/O disk type.
|
||||||
- SAS specifies the high I/O disk type.
|
- If the specified disk type is not available in the AZ, the disk will fail to create. If the EVS disk is created from
|
||||||
- SATA specifies the common I/O disk type.
|
a snapshot, the volume_type field must be the same as that of the snapshot's source disk.
|
||||||
- If the specified disk type is not available in the AZ, the
|
type: str
|
||||||
disk will fail to create. If the EVS disk is created from a
|
returned: success
|
||||||
snapshot, the volume_type field must be the same as that of the
|
backup_id:
|
||||||
snapshot's source disk.
|
description:
|
||||||
type: str
|
- Specifies the ID of the backup that can be used to create a disk. This parameter is mandatory when you use a backup
|
||||||
returned: success
|
to create the disk.
|
||||||
backup_id:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
- Specifies the ID of the backup that can be used to create a disk.
|
description:
|
||||||
This parameter is mandatory when you use a backup to create the
|
description:
|
||||||
disk.
|
- Specifies the disk description. The value can contain a maximum of 255 bytes.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
description:
|
enable_full_clone:
|
||||||
description:
|
description:
|
||||||
- Specifies the disk description. The value can contain a maximum
|
- If the disk is created from a snapshot and linked cloning needs to be used, set this parameter to True.
|
||||||
of 255 bytes.
|
type: bool
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
enable_scsi:
|
||||||
enable_full_clone:
|
description:
|
||||||
description:
|
- If this parameter is set to True, the disk device type will be SCSI, which allows ECS OSs to directly access underlying
|
||||||
- If the disk is created from a snapshot and linked cloning needs
|
storage media. SCSI reservation command is supported. If this parameter is set to False, the disk device type will be
|
||||||
to be used, set this parameter to True.
|
VBD, which supports only simple SCSI read/write commands.
|
||||||
type: bool
|
- If parameter enable_share is set to True and this parameter is not specified, shared SCSI disks are created. SCSI EVS
|
||||||
returned: success
|
disks cannot be created from backups, which means that this parameter cannot be True if backup_id has been specified.
|
||||||
enable_scsi:
|
type: bool
|
||||||
description:
|
returned: success
|
||||||
- If this parameter is set to True, the disk device type will be
|
enable_share:
|
||||||
SCSI, which allows ECS OSs to directly access underlying storage
|
description:
|
||||||
media. SCSI reservation command is supported. If this parameter
|
- Specifies whether the disk is shareable. The default value is False.
|
||||||
is set to False, the disk device type will be VBD, which supports
|
type: bool
|
||||||
only simple SCSI read/write commands.
|
returned: success
|
||||||
- If parameter enable_share is set to True and this parameter
|
encryption_id:
|
||||||
is not specified, shared SCSI disks are created. SCSI EVS disks
|
description:
|
||||||
cannot be created from backups, which means that this parameter
|
- Specifies the encryption ID. The length of it fixes at 36 bytes.
|
||||||
cannot be True if backup_id has been specified.
|
type: str
|
||||||
type: bool
|
returned: success
|
||||||
returned: success
|
enterprise_project_id:
|
||||||
enable_share:
|
description:
|
||||||
description:
|
- Specifies the enterprise project ID. This ID is associated with the disk during the disk creation. If it is not specified,
|
||||||
- Specifies whether the disk is shareable. The default value is
|
the disk is bound to the default enterprise project.
|
||||||
False.
|
type: str
|
||||||
type: bool
|
returned: success
|
||||||
returned: success
|
image_id:
|
||||||
encryption_id:
|
description:
|
||||||
description:
|
- Specifies the image ID. If this parameter is specified, the disk is created from an image. BMS system disks cannot be
|
||||||
- Specifies the encryption ID. The length of it fixes at 36 bytes.
|
created from BMS images.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
enterprise_project_id:
|
size:
|
||||||
description:
|
description:
|
||||||
- Specifies the enterprise project ID. This ID is associated with
|
- Specifies the disk size, in GB. Its values are as follows, System disk 1 GB to 1024 GB, Data disk 10 GB to 32768 GB.
|
||||||
the disk during the disk creation. If it is not specified, the
|
This parameter is mandatory when you create an empty disk or use an image or a snapshot to create a disk. If you use
|
||||||
disk is bound to the default enterprise project.
|
an image or a snapshot to create a disk, the disk size must be greater than or equal to the image or snapshot size.
|
||||||
type: str
|
This parameter is optional when you use a backup to create a disk. If this parameter is not specified, the disk size
|
||||||
returned: success
|
is equal to the backup size.
|
||||||
image_id:
|
type: int
|
||||||
description:
|
returned: success
|
||||||
- Specifies the image ID. If this parameter is specified, the disk
|
snapshot_id:
|
||||||
is created from an image. BMS system disks cannot be
|
description:
|
||||||
created from BMS images.
|
- Specifies the snapshot ID. If this parameter is specified, the disk is created from a snapshot.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
size:
|
attachments:
|
||||||
description:
|
description:
|
||||||
- Specifies the disk size, in GB. Its values are as follows, System
|
- Specifies the disk attachment information.
|
||||||
disk 1 GB to 1024 GB, Data disk 10 GB to 32768 GB. This
|
type: complex
|
||||||
parameter is mandatory when you create an empty disk or use an
|
returned: success
|
||||||
image or a snapshot to create a disk. If you use an image or a
|
contains:
|
||||||
snapshot to create a disk, the disk size must be greater than or
|
attached_at:
|
||||||
equal to the image or snapshot size. This parameter is optional
|
description:
|
||||||
when you use a backup to create a disk. If this parameter is not
|
- Specifies the time when the disk was attached. Time format is 'UTC YYYY-MM-DDTHH:MM:SS'.
|
||||||
specified, the disk size is equal to the backup size.
|
type: str
|
||||||
type: int
|
returned: success
|
||||||
returned: success
|
attachment_id:
|
||||||
snapshot_id:
|
description:
|
||||||
description:
|
- Specifies the ID of the attachment information.
|
||||||
- Specifies the snapshot ID. If this parameter is specified, the
|
type: str
|
||||||
disk is created from a snapshot.
|
returned: success
|
||||||
type: str
|
device:
|
||||||
returned: success
|
description:
|
||||||
attachments:
|
- Specifies the device name.
|
||||||
description:
|
type: str
|
||||||
- Specifies the disk attachment information.
|
returned: success
|
||||||
type: complex
|
server_id:
|
||||||
returned: success
|
description:
|
||||||
contains:
|
- Specifies the ID of the server to which the disk is attached.
|
||||||
attached_at:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
- Specifies the time when the disk was attached. Time
|
backup_policy_id:
|
||||||
format is 'UTC YYYY-MM-DDTHH:MM:SS'.
|
description:
|
||||||
type: str
|
- Specifies the backup policy ID.
|
||||||
returned: success
|
type: str
|
||||||
attachment_id:
|
returned: success
|
||||||
description:
|
created_at:
|
||||||
- Specifies the ID of the attachment information.
|
description:
|
||||||
type: str
|
- Specifies the time when the disk was created. Time format is 'UTC YYYY-MM-DDTHH:MM:SS'.
|
||||||
returned: success
|
type: str
|
||||||
device:
|
returned: success
|
||||||
description:
|
is_bootable:
|
||||||
- Specifies the device name.
|
description:
|
||||||
type: str
|
- Specifies whether the disk is bootable.
|
||||||
returned: success
|
type: bool
|
||||||
server_id:
|
returned: success
|
||||||
description:
|
is_readonly:
|
||||||
- Specifies the ID of the server to which the disk is
|
description:
|
||||||
attached.
|
- Specifies whether the disk is read-only or read/write. True indicates that the disk is read-only. False indicates that
|
||||||
type: str
|
the disk is read/write.
|
||||||
returned: success
|
type: bool
|
||||||
backup_policy_id:
|
returned: success
|
||||||
description:
|
source_volume_id:
|
||||||
- Specifies the backup policy ID.
|
description:
|
||||||
type: str
|
- Specifies the source disk ID. This parameter has a value if the disk is created from a source disk.
|
||||||
returned: success
|
type: str
|
||||||
created_at:
|
returned: success
|
||||||
description:
|
status:
|
||||||
- Specifies the time when the disk was created. Time format is 'UTC
|
description:
|
||||||
YYYY-MM-DDTHH:MM:SS'.
|
- Specifies the disk status.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
is_bootable:
|
tags:
|
||||||
description:
|
description:
|
||||||
- Specifies whether the disk is bootable.
|
- Specifies the disk tags.
|
||||||
type: bool
|
type: dict
|
||||||
returned: success
|
returned: success
|
||||||
is_readonly:
|
"""
|
||||||
description:
|
|
||||||
- Specifies whether the disk is read-only or read/write. True
|
|
||||||
indicates that the disk is read-only. False indicates that the
|
|
||||||
disk is read/write.
|
|
||||||
type: bool
|
|
||||||
returned: success
|
|
||||||
source_volume_id:
|
|
||||||
description:
|
|
||||||
- Specifies the source disk ID. This parameter has a value if the
|
|
||||||
disk is created from a source disk.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
status:
|
|
||||||
description:
|
|
||||||
- Specifies the disk status.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
tags:
|
|
||||||
description:
|
|
||||||
- Specifies the disk tags.
|
|
||||||
type: dict
|
|
||||||
returned: success
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
||||||
|
|
|
@ -12,123 +12,120 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_network_vpc
|
module: hwc_network_vpc
|
||||||
description:
|
description:
|
||||||
- Represents an vpc resource.
|
- Represents an vpc resource.
|
||||||
short_description: Creates a Huawei Cloud VPC
|
short_description: Creates a Huawei Cloud VPC
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
|
description:
|
||||||
|
- Whether the given object should exist in VPC.
|
||||||
|
type: str
|
||||||
|
choices: ['present', 'absent']
|
||||||
|
default: 'present'
|
||||||
|
timeouts:
|
||||||
|
description:
|
||||||
|
- The timeouts for each operations.
|
||||||
|
type: dict
|
||||||
|
default: {}
|
||||||
|
suboptions:
|
||||||
|
create:
|
||||||
description:
|
description:
|
||||||
- Whether the given object should exist in vpc.
|
- The timeout for create operation.
|
||||||
type: str
|
type: str
|
||||||
choices: ['present', 'absent']
|
default: '15m'
|
||||||
default: 'present'
|
update:
|
||||||
timeouts:
|
|
||||||
description:
|
description:
|
||||||
- The timeouts for each operations.
|
- The timeout for update operation.
|
||||||
type: dict
|
|
||||||
default: {}
|
|
||||||
suboptions:
|
|
||||||
create:
|
|
||||||
description:
|
|
||||||
- The timeout for create operation.
|
|
||||||
type: str
|
|
||||||
default: '15m'
|
|
||||||
update:
|
|
||||||
description:
|
|
||||||
- The timeout for update operation.
|
|
||||||
type: str
|
|
||||||
default: '15m'
|
|
||||||
delete:
|
|
||||||
description:
|
|
||||||
- The timeout for delete operation.
|
|
||||||
type: str
|
|
||||||
default: '15m'
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- The name of vpc.
|
|
||||||
type: str
|
type: str
|
||||||
required: true
|
default: '15m'
|
||||||
cidr:
|
delete:
|
||||||
description:
|
description:
|
||||||
- The range of available subnets in the vpc.
|
- The timeout for delete operation.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
default: '15m'
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- The name of vpc.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
cidr:
|
||||||
|
description:
|
||||||
|
- The range of available subnets in the VPC.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
- name: Create a vpc
|
- name: Create a vpc
|
||||||
community.general.hwc_network_vpc:
|
community.general.hwc_network_vpc:
|
||||||
identity_endpoint: "{{ identity_endpoint }}"
|
identity_endpoint: "{{ identity_endpoint }}"
|
||||||
user: "{{ user }}"
|
user: "{{ user }}"
|
||||||
password: "{{ password }}"
|
password: "{{ password }}"
|
||||||
domain: "{{ domain }}"
|
domain: "{{ domain }}"
|
||||||
project: "{{ project }}"
|
project: "{{ project }}"
|
||||||
region: "{{ region }}"
|
region: "{{ region }}"
|
||||||
name: "vpc_1"
|
name: "vpc_1"
|
||||||
cidr: "192.168.100.0/24"
|
cidr: "192.168.100.0/24"
|
||||||
state: present
|
state: present
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
id:
|
id:
|
||||||
description:
|
description:
|
||||||
- the id of vpc.
|
- The id of vpc.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- the name of vpc.
|
- The name of vpc.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
cidr:
|
cidr:
|
||||||
description:
|
description:
|
||||||
- the range of available subnets in the vpc.
|
- The range of available subnets in the vpc.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
status:
|
status:
|
||||||
description:
|
description:
|
||||||
- the status of vpc.
|
- The status of vpc.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
routes:
|
routes:
|
||||||
description:
|
description:
|
||||||
- the route information.
|
- The route information.
|
||||||
type: complex
|
type: complex
|
||||||
returned: success
|
returned: success
|
||||||
contains:
|
contains:
|
||||||
destination:
|
destination:
|
||||||
description:
|
description:
|
||||||
- the destination network segment of a route.
|
- The destination network segment of a route.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
next_hop:
|
next_hop:
|
||||||
description:
|
description:
|
||||||
- the next hop of a route. If the route type is peering,
|
- The next hop of a route. If the route type is peering, it will provide VPC peering connection ID.
|
||||||
it will provide VPC peering connection ID.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
enable_shared_snat:
|
||||||
enable_shared_snat:
|
description:
|
||||||
description:
|
- Show whether the shared snat is enabled.
|
||||||
- show whether the shared snat is enabled.
|
type: bool
|
||||||
type: bool
|
returned: success
|
||||||
returned: success
|
"""
|
||||||
'''
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Imports
|
# Imports
|
||||||
|
|
|
@ -12,101 +12,92 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_smn_topic
|
module: hwc_smn_topic
|
||||||
description:
|
description:
|
||||||
- Represents a SMN notification topic resource.
|
- Represents a SMN notification topic resource.
|
||||||
short_description: Creates a resource of SMNTopic in Huaweicloud Cloud
|
short_description: Creates a resource of SMNTopic in Huawei Cloud
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Whether the given object should exist in Huaweicloud Cloud.
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
type: str
|
type: str
|
||||||
choices: ['present', 'absent']
|
choices: ['present', 'absent']
|
||||||
default: 'present'
|
default: 'present'
|
||||||
display_name:
|
display_name:
|
||||||
description:
|
description:
|
||||||
- Topic display name, which is presented as the name of the email
|
- Topic display name, which is presented as the name of the email sender in an email message. The topic display name
|
||||||
sender in an email message. The topic display name contains a
|
contains a maximum of 192 bytes.
|
||||||
maximum of 192 bytes.
|
type: str
|
||||||
type: str
|
required: false
|
||||||
required: false
|
name:
|
||||||
name:
|
description:
|
||||||
description:
|
- Name of the topic to be created. The topic name is a string of 1 to 256 characters. It must contain upper- or lower-case
|
||||||
- Name of the topic to be created. The topic name is a string of 1
|
letters, digits, hyphens (V(-)), and underscores (V(_)), and must start with a letter or digit.
|
||||||
to 256 characters. It must contain upper- or lower-case letters,
|
type: str
|
||||||
digits, hyphens (V(-)), and underscores (V(_)), and must start with a
|
required: true
|
||||||
letter or digit.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
- name: Create a smn topic
|
- name: Create a smn topic
|
||||||
community.general.hwc_smn_topic:
|
community.general.hwc_smn_topic:
|
||||||
identity_endpoint: "{{ identity_endpoint }}"
|
identity_endpoint: "{{ identity_endpoint }}"
|
||||||
user_name: "{{ user_name }}"
|
user_name: "{{ user_name }}"
|
||||||
password: "{{ password }}"
|
password: "{{ password }}"
|
||||||
domain_name: "{{ domain_name }}"
|
domain_name: "{{ domain_name }}"
|
||||||
project_name: "{{ project_name }}"
|
project_name: "{{ project_name }}"
|
||||||
region: "{{ region }}"
|
region: "{{ region }}"
|
||||||
name: "ansible_smn_topic_test"
|
name: "ansible_smn_topic_test"
|
||||||
state: present
|
state: present
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
create_time:
|
create_time:
|
||||||
description:
|
description:
|
||||||
- Time when the topic was created.
|
- Time when the topic was created.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
display_name:
|
display_name:
|
||||||
description:
|
description:
|
||||||
- Topic display name, which is presented as the name of the email
|
- Topic display name, which is presented as the name of the email sender in an email message. The topic display name contains
|
||||||
sender in an email message. The topic display name contains a
|
a maximum of 192 bytes.
|
||||||
maximum of 192 bytes.
|
returned: success
|
||||||
returned: success
|
type: str
|
||||||
type: str
|
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Name of the topic to be created. The topic name is a string of 1
|
- Name of the topic to be created. The topic name is a string of 1 to 256 characters. It must contain upper- or lower-case
|
||||||
to 256 characters. It must contain upper- or lower-case letters,
|
letters, digits, hyphens (V(-)), and underscores (V(_)), and must start with a letter or digit.
|
||||||
digits, hyphens (V(-)), and underscores (V(_)), and must start with a
|
returned: success
|
||||||
letter or digit.
|
type: str
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
push_policy:
|
push_policy:
|
||||||
description:
|
description:
|
||||||
- Message pushing policy. 0 indicates that the message sending
|
- Message pushing policy. V(0) indicates that the message sending fails and the message is cached in the queue. V(1) indicates
|
||||||
fails and the message is cached in the queue. 1 indicates that
|
that the failed message is discarded.
|
||||||
the failed message is discarded.
|
returned: success
|
||||||
returned: success
|
type: int
|
||||||
type: int
|
|
||||||
topic_urn:
|
topic_urn:
|
||||||
description:
|
description:
|
||||||
- Resource identifier of a topic, which is unique.
|
- Resource identifier of a topic, which is unique.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
update_time:
|
update_time:
|
||||||
description:
|
description:
|
||||||
- Time when the topic was updated.
|
- Time when the topic was updated.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
'''
|
"""
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Imports
|
# Imports
|
||||||
|
|
|
@ -12,126 +12,110 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_vpc_eip
|
module: hwc_vpc_eip
|
||||||
description:
|
description:
|
||||||
- elastic ip management.
|
- Elastic IP management.
|
||||||
short_description: Creates a resource of Vpc/EIP in Huawei Cloud
|
short_description: Creates a resource of VPC/EIP in Huawei Cloud
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
|
description:
|
||||||
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
|
type: str
|
||||||
|
choices: ['present', 'absent']
|
||||||
|
default: 'present'
|
||||||
|
timeouts:
|
||||||
|
description:
|
||||||
|
- The timeouts for each operations.
|
||||||
|
type: dict
|
||||||
|
default: {}
|
||||||
|
suboptions:
|
||||||
|
create:
|
||||||
description:
|
description:
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
- The timeouts for create operation.
|
||||||
type: str
|
type: str
|
||||||
choices: ['present', 'absent']
|
default: '5m'
|
||||||
default: 'present'
|
update:
|
||||||
timeouts:
|
|
||||||
description:
|
description:
|
||||||
- The timeouts for each operations.
|
- The timeouts for update operation.
|
||||||
type: dict
|
type: str
|
||||||
default: {}
|
default: '5m'
|
||||||
suboptions:
|
type:
|
||||||
create:
|
description:
|
||||||
description:
|
- Specifies the EIP type.
|
||||||
- The timeouts for create operation.
|
type: str
|
||||||
type: str
|
required: true
|
||||||
default: '5m'
|
dedicated_bandwidth:
|
||||||
update:
|
description:
|
||||||
description:
|
- Specifies the dedicated bandwidth object.
|
||||||
- The timeouts for update operation.
|
type: dict
|
||||||
type: str
|
required: false
|
||||||
default: '5m'
|
suboptions:
|
||||||
type:
|
charge_mode:
|
||||||
description:
|
description:
|
||||||
- Specifies the EIP type.
|
- Specifies whether the bandwidth is billed by traffic or by bandwidth size. The value can be bandwidth or traffic.
|
||||||
|
If this parameter is left blank or is null character string, default value bandwidth is used. For IPv6 addresses,
|
||||||
|
the default parameter value is bandwidth outside China and is traffic in China.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
dedicated_bandwidth:
|
name:
|
||||||
description:
|
description:
|
||||||
- Specifies the dedicated bandwidth object.
|
- Specifies the bandwidth name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores
|
||||||
type: dict
|
(V(_)), hyphens (V(-)), and periods (V(.)).
|
||||||
required: false
|
|
||||||
suboptions:
|
|
||||||
charge_mode:
|
|
||||||
description:
|
|
||||||
- Specifies whether the bandwidth is billed by traffic or
|
|
||||||
by bandwidth size. The value can be bandwidth or traffic.
|
|
||||||
If this parameter is left blank or is null character
|
|
||||||
string, default value bandwidth is used. For IPv6
|
|
||||||
addresses, the default parameter value is bandwidth
|
|
||||||
outside China and is traffic in China.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- Specifies the bandwidth name. The value is a string of 1
|
|
||||||
to 64 characters that can contain letters, digits,
|
|
||||||
underscores (V(_)), hyphens (V(-)), and periods (V(.)).
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
size:
|
|
||||||
description:
|
|
||||||
- Specifies the bandwidth size. The value ranges from 1
|
|
||||||
Mbit/s to 2000 Mbit/s by default. (The specific range may
|
|
||||||
vary depending on the configuration in each region. You
|
|
||||||
can see the bandwidth range of each region on the
|
|
||||||
management console.) The minimum unit for bandwidth
|
|
||||||
adjustment varies depending on the bandwidth range. The
|
|
||||||
details are as follows.
|
|
||||||
- The minimum unit is 1 Mbit/s if the allowed bandwidth
|
|
||||||
size ranges from 0 to 300 Mbit/s (with 300 Mbit/s
|
|
||||||
included).
|
|
||||||
- The minimum unit is 50 Mbit/s if the allowed bandwidth
|
|
||||||
size ranges 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s
|
|
||||||
included).
|
|
||||||
- The minimum unit is 500 Mbit/s if the allowed bandwidth
|
|
||||||
size is greater than 1000 Mbit/s.
|
|
||||||
type: int
|
|
||||||
required: true
|
|
||||||
enterprise_project_id:
|
|
||||||
description:
|
|
||||||
- Specifies the enterprise project ID.
|
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: true
|
||||||
ip_version:
|
size:
|
||||||
description:
|
description:
|
||||||
- The value can be 4 (IPv4 address) or 6 (IPv6 address). If this
|
- Specifies the bandwidth size. The value ranges from 1 Mbit/s to 2000 Mbit/s by default. (The specific range may
|
||||||
parameter is left blank, an IPv4 address will be assigned.
|
vary depending on the configuration in each region. You can see the bandwidth range of each region on the management
|
||||||
|
console.) The minimum unit for bandwidth adjustment varies depending on the bandwidth range. The details are as
|
||||||
|
follows.
|
||||||
|
- The minimum unit is 1 Mbit/s if the allowed bandwidth size ranges from 0 to 300 Mbit/s (with 300 Mbit/s included).
|
||||||
|
- The minimum unit is 50 Mbit/s if the allowed bandwidth size ranges 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s
|
||||||
|
included).
|
||||||
|
- The minimum unit is 500 Mbit/s if the allowed bandwidth size is greater than 1000 Mbit/s.
|
||||||
type: int
|
type: int
|
||||||
required: false
|
required: true
|
||||||
ipv4_address:
|
enterprise_project_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the obtained IPv4 EIP. The system automatically assigns
|
- Specifies the enterprise project ID.
|
||||||
an EIP if you do not specify it.
|
type: str
|
||||||
type: str
|
required: false
|
||||||
required: false
|
ip_version:
|
||||||
port_id:
|
description:
|
||||||
description:
|
- The value can be 4 (IPv4 address) or 6 (IPv6 address). If this parameter is left blank, an IPv4 address will be assigned.
|
||||||
- Specifies the port ID. This parameter is returned only when a
|
type: int
|
||||||
private IP address is bound with the EIP.
|
required: false
|
||||||
type: str
|
ipv4_address:
|
||||||
required: false
|
description:
|
||||||
shared_bandwidth_id:
|
- Specifies the obtained IPv4 EIP. The system automatically assigns an EIP if you do not specify it.
|
||||||
description:
|
type: str
|
||||||
- Specifies the ID of shared bandwidth.
|
required: false
|
||||||
type: str
|
port_id:
|
||||||
required: false
|
description:
|
||||||
|
- Specifies the port ID. This parameter is returned only when a private IP address is bound with the EIP.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
shared_bandwidth_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of shared bandwidth.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# create an eip and bind it to a port
|
# create an eip and bind it to a port
|
||||||
- name: Create vpc
|
- name: Create vpc
|
||||||
hwc_network_vpc:
|
hwc_network_vpc:
|
||||||
|
@ -159,107 +143,91 @@ EXAMPLES = '''
|
||||||
name: "ansible_test_dedicated_bandwidth"
|
name: "ansible_test_dedicated_bandwidth"
|
||||||
size: 1
|
size: 1
|
||||||
port_id: "{{ port.id }}"
|
port_id: "{{ port.id }}"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
type:
|
type:
|
||||||
description:
|
description:
|
||||||
- Specifies the EIP type.
|
- Specifies the EIP type.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
dedicated_bandwidth:
|
dedicated_bandwidth:
|
||||||
description:
|
description:
|
||||||
- Specifies the dedicated bandwidth object.
|
- Specifies the dedicated bandwidth object.
|
||||||
type: dict
|
type: dict
|
||||||
returned: success
|
returned: success
|
||||||
contains:
|
contains:
|
||||||
charge_mode:
|
charge_mode:
|
||||||
description:
|
description:
|
||||||
- Specifies whether the bandwidth is billed by traffic or
|
- Specifies whether the bandwidth is billed by traffic or by bandwidth size. The value can be bandwidth or traffic.
|
||||||
by bandwidth size. The value can be bandwidth or traffic.
|
If this parameter is left blank or is null character string, default value bandwidth is used. For IPv6 addresses,
|
||||||
If this parameter is left blank or is null character
|
the default parameter value is bandwidth outside China and is traffic in China.
|
||||||
string, default value bandwidth is used. For IPv6
|
type: str
|
||||||
addresses, the default parameter value is bandwidth
|
returned: success
|
||||||
outside China and is traffic in China.
|
name:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the bandwidth name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores
|
||||||
name:
|
(V(_)), hyphens (V(-)), and periods (V(.)).
|
||||||
description:
|
type: str
|
||||||
- Specifies the bandwidth name. The value is a string of 1
|
returned: success
|
||||||
to 64 characters that can contain letters, digits,
|
size:
|
||||||
underscores (V(_)), hyphens (V(-)), and periods (V(.)).
|
description:
|
||||||
type: str
|
- Specifies the bandwidth size. The value ranges from 1 Mbit/s to 2000 Mbit/s by default. (The specific range may
|
||||||
returned: success
|
vary depending on the configuration in each region. You can see the bandwidth range of each region on the management
|
||||||
size:
|
console.) The minimum unit for bandwidth adjustment varies depending on the bandwidth range. The details are as
|
||||||
description:
|
follows:.
|
||||||
- Specifies the bandwidth size. The value ranges from 1
|
- The minimum unit is 1 Mbit/s if the allowed bandwidth size ranges from 0 to 300 Mbit/s (with 300 Mbit/s included).
|
||||||
Mbit/s to 2000 Mbit/s by default. (The specific range may
|
- The minimum unit is 50 Mbit/s if the allowed bandwidth size ranges 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s included).
|
||||||
vary depending on the configuration in each region. You
|
- The minimum unit is 500 Mbit/s if the allowed bandwidth size is greater than 1000 Mbit/s.
|
||||||
can see the bandwidth range of each region on the
|
type: int
|
||||||
management console.) The minimum unit for bandwidth
|
returned: success
|
||||||
adjustment varies depending on the bandwidth range. The
|
id:
|
||||||
details are as follows:.
|
description:
|
||||||
- The minimum unit is 1 Mbit/s if the allowed bandwidth
|
- Specifies the ID of dedicated bandwidth.
|
||||||
size ranges from 0 to 300 Mbit/s (with 300 Mbit/s
|
type: str
|
||||||
included).
|
returned: success
|
||||||
- The minimum unit is 50 Mbit/s if the allowed bandwidth
|
enterprise_project_id:
|
||||||
size ranges 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s
|
description:
|
||||||
included).
|
- Specifies the enterprise project ID.
|
||||||
- The minimum unit is 500 Mbit/s if the allowed bandwidth
|
type: str
|
||||||
size is greater than 1000 Mbit/s.
|
returned: success
|
||||||
type: int
|
ip_version:
|
||||||
returned: success
|
description:
|
||||||
id:
|
- The value can be 4 (IPv4 address) or 6 (IPv6 address). If this parameter is left blank, an IPv4 address will be assigned.
|
||||||
description:
|
type: int
|
||||||
- Specifies the ID of dedicated bandwidth.
|
returned: success
|
||||||
type: str
|
ipv4_address:
|
||||||
returned: success
|
description:
|
||||||
enterprise_project_id:
|
- Specifies the obtained IPv4 EIP. The system automatically assigns an EIP if you do not specify it.
|
||||||
description:
|
type: str
|
||||||
- Specifies the enterprise project ID.
|
returned: success
|
||||||
type: str
|
port_id:
|
||||||
returned: success
|
description:
|
||||||
ip_version:
|
- Specifies the port ID. This parameter is returned only when a private IP address is bound with the EIP.
|
||||||
description:
|
type: str
|
||||||
- The value can be 4 (IPv4 address) or 6 (IPv6 address). If this
|
returned: success
|
||||||
parameter is left blank, an IPv4 address will be assigned.
|
shared_bandwidth_id:
|
||||||
type: int
|
description:
|
||||||
returned: success
|
- Specifies the ID of shared bandwidth.
|
||||||
ipv4_address:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
- Specifies the obtained IPv4 EIP. The system automatically assigns
|
create_time:
|
||||||
an EIP if you do not specify it.
|
description:
|
||||||
type: str
|
- Specifies the time (UTC time) when the EIP was assigned.
|
||||||
returned: success
|
type: str
|
||||||
port_id:
|
returned: success
|
||||||
description:
|
ipv6_address:
|
||||||
- Specifies the port ID. This parameter is returned only when a
|
description:
|
||||||
private IP address is bound with the EIP.
|
- Specifies the obtained IPv6 EIP.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
shared_bandwidth_id:
|
private_ip_address:
|
||||||
description:
|
description:
|
||||||
- Specifies the ID of shared bandwidth.
|
- Specifies the private IP address bound with the EIP. This parameter is returned only when a private IP address is bound
|
||||||
type: str
|
with the EIP.
|
||||||
returned: success
|
type: str
|
||||||
create_time:
|
returned: success
|
||||||
description:
|
"""
|
||||||
- Specifies the time (UTC time) when the EIP was assigned.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
ipv6_address:
|
|
||||||
description:
|
|
||||||
- Specifies the obtained IPv6 EIP.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
private_ip_address:
|
|
||||||
description:
|
|
||||||
- Specifies the private IP address bound with the EIP. This
|
|
||||||
parameter is returned only when a private IP address is bound
|
|
||||||
with the EIP.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcClientException404, HwcModule,
|
Config, HwcClientException, HwcClientException404, HwcModule,
|
||||||
|
|
|
@ -13,79 +13,75 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_vpc_peering_connect
|
module: hwc_vpc_peering_connect
|
||||||
description:
|
description:
|
||||||
- vpc peering management.
|
- VPC peering management.
|
||||||
short_description: Creates a resource of Vpc/PeeringConnect in Huawei Cloud
|
short_description: Creates a resource of VPC/PeeringConnect in Huawei Cloud
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
|
||||||
type: str
|
|
||||||
choices: ['present', 'absent']
|
|
||||||
default: 'present'
|
|
||||||
timeouts:
|
|
||||||
description:
|
|
||||||
- The timeouts for each operations.
|
|
||||||
type: dict
|
|
||||||
default: {}
|
|
||||||
suboptions:
|
|
||||||
create:
|
|
||||||
description:
|
|
||||||
- The timeouts for create operation.
|
|
||||||
type: str
|
|
||||||
default: '15m'
|
|
||||||
local_vpc_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of local VPC.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- Specifies the name of the VPC peering connection. The value can
|
|
||||||
contain 1 to 64 characters.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
peering_vpc:
|
|
||||||
description:
|
|
||||||
- Specifies information about the peering VPC.
|
|
||||||
type: dict
|
|
||||||
required: true
|
|
||||||
suboptions:
|
|
||||||
vpc_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of peering VPC.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
project_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of the project which the peering vpc
|
|
||||||
belongs to.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
description:
|
description:
|
||||||
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
|
type: str
|
||||||
|
choices: ['present', 'absent']
|
||||||
|
default: 'present'
|
||||||
|
timeouts:
|
||||||
|
description:
|
||||||
|
- The timeouts for each operations.
|
||||||
|
type: dict
|
||||||
|
default: {}
|
||||||
|
suboptions:
|
||||||
|
create:
|
||||||
description:
|
description:
|
||||||
- The description of vpc peering connection.
|
- The timeouts for create operation.
|
||||||
|
type: str
|
||||||
|
default: '15m'
|
||||||
|
local_vpc_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of local VPC.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Specifies the name of the VPC peering connection. The value can contain 1 to 64 characters.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
peering_vpc:
|
||||||
|
description:
|
||||||
|
- Specifies information about the peering VPC.
|
||||||
|
type: dict
|
||||||
|
required: true
|
||||||
|
suboptions:
|
||||||
|
vpc_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of peering VPC.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
project_id:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of the project which the peering vpc belongs to.
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
|
description:
|
||||||
|
description:
|
||||||
|
- The description of vpc peering connection.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# create a peering connect
|
# create a peering connect
|
||||||
- name: Create a local vpc
|
- name: Create a local vpc
|
||||||
hwc_network_vpc:
|
hwc_network_vpc:
|
||||||
|
@ -103,43 +99,41 @@ EXAMPLES = '''
|
||||||
name: "ansible_network_peering_test"
|
name: "ansible_network_peering_test"
|
||||||
peering_vpc:
|
peering_vpc:
|
||||||
vpc_id: "{{ vpc2.id }}"
|
vpc_id: "{{ vpc2.id }}"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
local_vpc_id:
|
local_vpc_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the ID of local VPC.
|
- Specifies the ID of local VPC.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Specifies the name of the VPC peering connection. The value can
|
- Specifies the name of the VPC peering connection. The value can contain 1 to 64 characters.
|
||||||
contain 1 to 64 characters.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
peering_vpc:
|
||||||
peering_vpc:
|
description:
|
||||||
description:
|
- Specifies information about the peering VPC.
|
||||||
- Specifies information about the peering VPC.
|
type: dict
|
||||||
type: dict
|
returned: success
|
||||||
returned: success
|
contains:
|
||||||
contains:
|
vpc_id:
|
||||||
vpc_id:
|
description:
|
||||||
description:
|
- Specifies the ID of peering VPC.
|
||||||
- Specifies the ID of peering VPC.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
project_id:
|
||||||
project_id:
|
description:
|
||||||
description:
|
- Specifies the ID of the project which the peering vpc belongs to.
|
||||||
- Specifies the ID of the project which the peering vpc
|
type: str
|
||||||
belongs to.
|
returned: success
|
||||||
type: str
|
description:
|
||||||
returned: success
|
description:
|
||||||
description:
|
- The description of vpc peering connection.
|
||||||
description:
|
type: str
|
||||||
- The description of vpc peering connection.
|
returned: success
|
||||||
type: str
|
"""
|
||||||
returned: success
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcClientException404, HwcModule,
|
Config, HwcClientException, HwcClientException404, HwcModule,
|
||||||
|
|
|
@ -12,110 +12,105 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_vpc_port
|
module: hwc_vpc_port
|
||||||
description:
|
description:
|
||||||
- vpc port management.
|
- VPC port management.
|
||||||
short_description: Creates a resource of Vpc/Port in Huawei Cloud
|
short_description: Creates a resource of VPC/Port in Huawei Cloud
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
|
description:
|
||||||
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
|
type: str
|
||||||
|
choices: ['present', 'absent']
|
||||||
|
default: 'present'
|
||||||
|
timeouts:
|
||||||
|
description:
|
||||||
|
- The timeouts for each operations.
|
||||||
|
type: dict
|
||||||
|
default: {}
|
||||||
|
suboptions:
|
||||||
|
create:
|
||||||
description:
|
description:
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
- The timeouts for create operation.
|
||||||
type: str
|
type: str
|
||||||
choices: ['present', 'absent']
|
default: '15m'
|
||||||
default: 'present'
|
subnet_id:
|
||||||
timeouts:
|
description:
|
||||||
|
- Specifies the ID of the subnet to which the port belongs.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
admin_state_up:
|
||||||
|
description:
|
||||||
|
- Specifies the administrative state of the port.
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
allowed_address_pairs:
|
||||||
|
description:
|
||||||
|
- Specifies a set of zero or more allowed address pairs.
|
||||||
|
required: false
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
suboptions:
|
||||||
|
ip_address:
|
||||||
description:
|
description:
|
||||||
- The timeouts for each operations.
|
- Specifies the IP address. It cannot set it to 0.0.0.0. Configure an independent security group for the port if
|
||||||
type: dict
|
a large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs.
|
||||||
default: {}
|
|
||||||
suboptions:
|
|
||||||
create:
|
|
||||||
description:
|
|
||||||
- The timeouts for create operation.
|
|
||||||
type: str
|
|
||||||
default: '15m'
|
|
||||||
subnet_id:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of the subnet to which the port belongs.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
admin_state_up:
|
|
||||||
description:
|
|
||||||
- Specifies the administrative state of the port.
|
|
||||||
type: bool
|
|
||||||
required: false
|
|
||||||
allowed_address_pairs:
|
|
||||||
description:
|
|
||||||
- Specifies a set of zero or more allowed address pairs.
|
|
||||||
required: false
|
|
||||||
type: list
|
|
||||||
elements: dict
|
|
||||||
suboptions:
|
|
||||||
ip_address:
|
|
||||||
description:
|
|
||||||
- Specifies the IP address. It cannot set it to 0.0.0.0.
|
|
||||||
Configure an independent security group for the port if a
|
|
||||||
large CIDR block (subnet mask less than 24) is configured
|
|
||||||
for parameter allowed_address_pairs.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
mac_address:
|
|
||||||
description:
|
|
||||||
- Specifies the MAC address.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
extra_dhcp_opts:
|
|
||||||
description:
|
|
||||||
- Specifies the extended option of DHCP.
|
|
||||||
type: list
|
|
||||||
elements: dict
|
|
||||||
required: false
|
|
||||||
suboptions:
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- Specifies the option name.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
value:
|
|
||||||
description:
|
|
||||||
- Specifies the option value.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
ip_address:
|
|
||||||
description:
|
|
||||||
- Specifies the port IP address.
|
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
name:
|
mac_address:
|
||||||
description:
|
description:
|
||||||
- Specifies the port name. The value can contain no more than 255
|
- Specifies the MAC address.
|
||||||
characters.
|
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
security_groups:
|
extra_dhcp_opts:
|
||||||
|
description:
|
||||||
|
- Specifies the extended option of DHCP.
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
required: false
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
description:
|
description:
|
||||||
- Specifies the ID of the security group.
|
- Specifies the option name.
|
||||||
type: list
|
type: str
|
||||||
elements: str
|
|
||||||
required: false
|
required: false
|
||||||
|
value:
|
||||||
|
description:
|
||||||
|
- Specifies the option value.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ip_address:
|
||||||
|
description:
|
||||||
|
- Specifies the port IP address.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Specifies the port name. The value can contain no more than 255 characters.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
security_groups:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of the security group.
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
required: false
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# create a port
|
# create a port
|
||||||
- name: Create vpc
|
- name: Create vpc
|
||||||
hwc_network_vpc:
|
hwc_network_vpc:
|
||||||
|
@ -134,76 +129,73 @@ EXAMPLES = '''
|
||||||
community.general.hwc_vpc_port:
|
community.general.hwc_vpc_port:
|
||||||
subnet_id: "{{ subnet.id }}"
|
subnet_id: "{{ subnet.id }}"
|
||||||
ip_address: "192.168.100.33"
|
ip_address: "192.168.100.33"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
subnet_id:
|
subnet_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the ID of the subnet to which the port belongs.
|
- Specifies the ID of the subnet to which the port belongs.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
admin_state_up:
|
admin_state_up:
|
||||||
description:
|
description:
|
||||||
- Specifies the administrative state of the port.
|
- Specifies the administrative state of the port.
|
||||||
type: bool
|
type: bool
|
||||||
returned: success
|
returned: success
|
||||||
allowed_address_pairs:
|
allowed_address_pairs:
|
||||||
description:
|
description:
|
||||||
- Specifies a set of zero or more allowed address pairs.
|
- Specifies a set of zero or more allowed address pairs.
|
||||||
type: list
|
type: list
|
||||||
returned: success
|
returned: success
|
||||||
contains:
|
contains:
|
||||||
ip_address:
|
|
||||||
description:
|
|
||||||
- Specifies the IP address. It cannot set it to 0.0.0.0.
|
|
||||||
Configure an independent security group for the port if a
|
|
||||||
large CIDR block (subnet mask less than 24) is configured
|
|
||||||
for parameter allowed_address_pairs.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
mac_address:
|
|
||||||
description:
|
|
||||||
- Specifies the MAC address.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
extra_dhcp_opts:
|
|
||||||
description:
|
|
||||||
- Specifies the extended option of DHCP.
|
|
||||||
type: list
|
|
||||||
returned: success
|
|
||||||
contains:
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- Specifies the option name.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
value:
|
|
||||||
description:
|
|
||||||
- Specifies the option value.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
ip_address:
|
ip_address:
|
||||||
description:
|
description:
|
||||||
- Specifies the port IP address.
|
- Specifies the IP address. It cannot set it to 0.0.0.0. Configure an independent security group for the port if a
|
||||||
type: str
|
large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs.
|
||||||
returned: success
|
type: str
|
||||||
name:
|
returned: success
|
||||||
description:
|
|
||||||
- Specifies the port name. The value can contain no more than 255
|
|
||||||
characters.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
security_groups:
|
|
||||||
description:
|
|
||||||
- Specifies the ID of the security group.
|
|
||||||
type: list
|
|
||||||
returned: success
|
|
||||||
mac_address:
|
mac_address:
|
||||||
description:
|
description:
|
||||||
- Specifies the port MAC address.
|
- Specifies the MAC address.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
'''
|
extra_dhcp_opts:
|
||||||
|
description:
|
||||||
|
- Specifies the extended option of DHCP.
|
||||||
|
type: list
|
||||||
|
returned: success
|
||||||
|
contains:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Specifies the option name.
|
||||||
|
type: str
|
||||||
|
returned: success
|
||||||
|
value:
|
||||||
|
description:
|
||||||
|
- Specifies the option value.
|
||||||
|
type: str
|
||||||
|
returned: success
|
||||||
|
ip_address:
|
||||||
|
description:
|
||||||
|
- Specifies the port IP address.
|
||||||
|
type: str
|
||||||
|
returned: success
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Specifies the port name. The value can contain no more than 255 characters.
|
||||||
|
type: str
|
||||||
|
returned: success
|
||||||
|
security_groups:
|
||||||
|
description:
|
||||||
|
- Specifies the ID of the security group.
|
||||||
|
type: list
|
||||||
|
returned: success
|
||||||
|
mac_address:
|
||||||
|
description:
|
||||||
|
- Specifies the port MAC address.
|
||||||
|
type: str
|
||||||
|
returned: success
|
||||||
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcClientException404, HwcModule,
|
Config, HwcClientException, HwcClientException404, HwcModule,
|
||||||
|
|
|
@ -12,54 +12,51 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_vpc_private_ip
|
module: hwc_vpc_private_ip
|
||||||
description:
|
description:
|
||||||
- vpc private ip management.
|
- VPC private IP management.
|
||||||
short_description: Creates a resource of Vpc/PrivateIP in Huawei Cloud
|
short_description: Creates a resource of VPC/PrivateIP in Huawei Cloud
|
||||||
notes:
|
notes:
|
||||||
- If O(id) option is provided, it takes precedence over O(subnet_id), O(ip_address) for private ip selection.
|
- If O(id) option is provided, it takes precedence over O(subnet_id), O(ip_address) for private IP selection.
|
||||||
- O(subnet_id), O(ip_address) are used for private ip selection. If more than one private ip with this options exists, execution is aborted.
|
- O(subnet_id), O(ip_address) are used for private IP selection. If more than one private IP with this options exists, execution
|
||||||
- No parameter support updating. If one of option is changed, the module will create a new resource.
|
is aborted.
|
||||||
|
- No parameter support updating. If one of option is changed, the module will create a new resource.
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
type: str
|
type: str
|
||||||
choices: ['present', 'absent']
|
choices: ['present', 'absent']
|
||||||
default: 'present'
|
default: 'present'
|
||||||
subnet_id:
|
subnet_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the ID of the subnet from which IP addresses are
|
- Specifies the ID of the subnet from which IP addresses are assigned. Cannot be changed after creating the private
|
||||||
assigned. Cannot be changed after creating the private ip.
|
IP.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
ip_address:
|
ip_address:
|
||||||
description:
|
description:
|
||||||
- Specifies the target IP address. The value can be an available IP
|
- Specifies the target IP address. The value can be an available IP address in the subnet. If it is not specified, the
|
||||||
address in the subnet. If it is not specified, the system
|
system automatically assigns an IP address. Cannot be changed after creating the private IP.
|
||||||
automatically assigns an IP address. Cannot be changed after
|
type: str
|
||||||
creating the private ip.
|
required: false
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
# create a private IP
|
||||||
EXAMPLES = '''
|
|
||||||
# create a private ip
|
|
||||||
- name: Create vpc
|
- name: Create vpc
|
||||||
hwc_network_vpc:
|
hwc_network_vpc:
|
||||||
cidr: "192.168.100.0/24"
|
cidr: "192.168.100.0/24"
|
||||||
|
@ -73,27 +70,25 @@ EXAMPLES = '''
|
||||||
vpc_id: "{{ vpc.id }}"
|
vpc_id: "{{ vpc.id }}"
|
||||||
cidr: "192.168.100.0/26"
|
cidr: "192.168.100.0/26"
|
||||||
register: subnet
|
register: subnet
|
||||||
- name: Create a private ip
|
- name: Create a private IP
|
||||||
community.general.hwc_vpc_private_ip:
|
community.general.hwc_vpc_private_ip:
|
||||||
subnet_id: "{{ subnet.id }}"
|
subnet_id: "{{ subnet.id }}"
|
||||||
ip_address: "192.168.100.33"
|
ip_address: "192.168.100.33"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
subnet_id:
|
subnet_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the ID of the subnet from which IP addresses are
|
- Specifies the ID of the subnet from which IP addresses are assigned.
|
||||||
assigned.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
ip_address:
|
||||||
ip_address:
|
description:
|
||||||
description:
|
- Specifies the target IP address. The value can be an available IP address in the subnet. If it is not specified, the
|
||||||
- Specifies the target IP address. The value can be an available IP
|
system automatically assigns an IP address.
|
||||||
address in the subnet. If it is not specified, the system
|
type: str
|
||||||
automatically assigns an IP address.
|
returned: success
|
||||||
type: str
|
"""
|
||||||
returned: success
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
||||||
|
|
|
@ -12,60 +12,59 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_vpc_route
|
module: hwc_vpc_route
|
||||||
description:
|
description:
|
||||||
- vpc route management.
|
- VPC route management.
|
||||||
short_description: Creates a resource of Vpc/Route in Huawei Cloud
|
short_description: Creates a resource of VPC/Route in Huawei Cloud
|
||||||
notes:
|
notes:
|
||||||
- If O(id) option is provided, it takes precedence over O(destination), O(vpc_id), O(type), and O(next_hop) for route selection.
|
- If O(id) option is provided, it takes precedence over O(destination), O(vpc_id), O(type), and O(next_hop) for route selection.
|
||||||
- O(destination), O(vpc_id), O(type) and O(next_hop) are used for route selection. If more than one route with this options exists, execution is aborted.
|
- O(destination), O(vpc_id), O(type) and O(next_hop) are used for route selection. If more than one route with this options
|
||||||
- No parameter support updating. If one of option is changed, the module will create a new resource.
|
exists, execution is aborted.
|
||||||
|
- No parameter support updating. If one of option is changed, the module will create a new resource.
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
type: str
|
type: str
|
||||||
choices: ['present', 'absent']
|
choices: ['present', 'absent']
|
||||||
default: 'present'
|
default: 'present'
|
||||||
destination:
|
destination:
|
||||||
description:
|
description:
|
||||||
- Specifies the destination IP address or CIDR block.
|
- Specifies the destination IP address or CIDR block.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
next_hop:
|
next_hop:
|
||||||
description:
|
description:
|
||||||
- Specifies the next hop. The value is VPC peering connection ID.
|
- Specifies the next hop. The value is VPC peering connection ID.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
vpc_id:
|
vpc_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the VPC ID to which route is added.
|
- Specifies the VPC ID to which route is added.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
type:
|
type:
|
||||||
description:
|
description:
|
||||||
- Specifies the type of route.
|
- Specifies the type of route.
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
default: 'peering'
|
default: 'peering'
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# create a peering connect
|
# create a peering connect
|
||||||
- name: Create a local vpc
|
- name: Create a local vpc
|
||||||
hwc_network_vpc:
|
hwc_network_vpc:
|
||||||
|
@ -91,35 +90,35 @@ EXAMPLES = '''
|
||||||
vpc_id: "{{ vpc1.id }}"
|
vpc_id: "{{ vpc1.id }}"
|
||||||
destination: "192.168.0.0/16"
|
destination: "192.168.0.0/16"
|
||||||
next_hop: "{{ connect.id }}"
|
next_hop: "{{ connect.id }}"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
id:
|
id:
|
||||||
description:
|
description:
|
||||||
- UUID of the route.
|
- UUID of the route.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
destination:
|
destination:
|
||||||
description:
|
description:
|
||||||
- Specifies the destination IP address or CIDR block.
|
- Specifies the destination IP address or CIDR block.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
next_hop:
|
next_hop:
|
||||||
description:
|
description:
|
||||||
- Specifies the next hop. The value is VPC peering connection ID.
|
- Specifies the next hop. The value is VPC peering connection ID.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
vpc_id:
|
vpc_id:
|
||||||
description:
|
description:
|
||||||
- Specifies the VPC ID to which route is added.
|
- Specifies the VPC ID to which route is added.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
type:
|
type:
|
||||||
description:
|
description:
|
||||||
- Specifies the type of route.
|
- Specifies the type of route.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
||||||
|
|
|
@ -12,162 +12,141 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_vpc_security_group
|
module: hwc_vpc_security_group
|
||||||
description:
|
description:
|
||||||
- vpc security group management.
|
- VPC security group management.
|
||||||
short_description: Creates a resource of Vpc/SecurityGroup in Huawei Cloud
|
short_description: Creates a resource of VPC/SecurityGroup in Huawei Cloud
|
||||||
notes:
|
notes:
|
||||||
- If O(id) option is provided, it takes precedence over O(name),
|
- If O(id) option is provided, it takes precedence over O(name), O(enterprise_project_id), and O(vpc_id) for security group
|
||||||
O(enterprise_project_id), and O(vpc_id) for security group selection.
|
selection.
|
||||||
- O(name), O(enterprise_project_id) and O(vpc_id) are used for security
|
- O(name), O(enterprise_project_id) and O(vpc_id) are used for security group selection. If more than one security group
|
||||||
group selection. If more than one security group with this options exists,
|
with this options exists, execution is aborted.
|
||||||
execution is aborted.
|
- No parameter support updating. If one of option is changed, the module will create a new resource.
|
||||||
- No parameter support updating. If one of option is changed, the module
|
|
||||||
will create a new resource.
|
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
type: str
|
type: str
|
||||||
choices: ['present', 'absent']
|
choices: ['present', 'absent']
|
||||||
default: 'present'
|
default: 'present'
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Specifies the security group name. The value is a string of 1 to
|
- Specifies the security group name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores
|
||||||
64 characters that can contain letters, digits, underscores (V(_)),
|
(V(_)), hyphens (V(-)), and periods (V(.)).
|
||||||
hyphens (V(-)), and periods (V(.)).
|
type: str
|
||||||
type: str
|
required: true
|
||||||
required: true
|
enterprise_project_id:
|
||||||
enterprise_project_id:
|
description:
|
||||||
description:
|
- Specifies the enterprise project ID. When creating a security group, associate the enterprise project ID with the
|
||||||
- Specifies the enterprise project ID. When creating a security
|
security group.s.
|
||||||
group, associate the enterprise project ID with the security
|
type: str
|
||||||
group.s
|
required: false
|
||||||
type: str
|
vpc_id:
|
||||||
required: false
|
description:
|
||||||
vpc_id:
|
- Specifies the resource ID of the VPC to which the security group belongs.
|
||||||
description:
|
type: str
|
||||||
- Specifies the resource ID of the VPC to which the security group
|
required: false
|
||||||
belongs.
|
|
||||||
type: str
|
|
||||||
required: false
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# create a security group
|
# create a security group
|
||||||
- name: Create a security group
|
- name: Create a security group
|
||||||
community.general.hwc_vpc_security_group:
|
community.general.hwc_vpc_security_group:
|
||||||
name: "ansible_network_security_group_test"
|
name: "ansible_network_security_group_test"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Specifies the security group name. The value is a string of 1 to
|
- Specifies the security group name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores
|
||||||
64 characters that can contain letters, digits, underscores (V(_)),
|
(V(_)), hyphens (V(-)), and periods (V(.)).
|
||||||
hyphens (V(-)), and periods (V(.)).
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
enterprise_project_id:
|
||||||
enterprise_project_id:
|
description:
|
||||||
description:
|
- Specifies the enterprise project ID. When creating a security group, associate the enterprise project ID with the security
|
||||||
- Specifies the enterprise project ID. When creating a security
|
group.
|
||||||
group, associate the enterprise project ID with the security
|
type: str
|
||||||
group.
|
returned: success
|
||||||
type: str
|
vpc_id:
|
||||||
returned: success
|
description:
|
||||||
vpc_id:
|
- Specifies the resource ID of the VPC to which the security group belongs.
|
||||||
description:
|
type: str
|
||||||
- Specifies the resource ID of the VPC to which the security group
|
returned: success
|
||||||
belongs.
|
rules:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the security group rule, which ensures that resources in the security group can communicate with one another.
|
||||||
rules:
|
type: complex
|
||||||
description:
|
returned: success
|
||||||
- Specifies the security group rule, which ensures that resources
|
contains:
|
||||||
in the security group can communicate with one another.
|
description:
|
||||||
type: complex
|
description:
|
||||||
returned: success
|
- Provides supplementary information about the security group rule.
|
||||||
contains:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
description:
|
direction:
|
||||||
- Provides supplementary information about the security
|
description:
|
||||||
group rule.
|
- Specifies the direction of access control. The value can be egress or ingress.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
direction:
|
ethertype:
|
||||||
description:
|
description:
|
||||||
- Specifies the direction of access control. The value can
|
- Specifies the IP protocol version. The value can be IPv4 or IPv6.
|
||||||
be egress or ingress.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
id:
|
||||||
ethertype:
|
description:
|
||||||
description:
|
- Specifies the security group rule ID.
|
||||||
- Specifies the IP protocol version. The value can be IPv4
|
type: str
|
||||||
or IPv6.
|
returned: success
|
||||||
type: str
|
port_range_max:
|
||||||
returned: success
|
description:
|
||||||
id:
|
- Specifies the end port number. The value ranges from 1 to 65535. If the protocol is not icmp, the value cannot be
|
||||||
description:
|
smaller than the port_range_min value. An empty value indicates all ports.
|
||||||
- Specifies the security group rule ID.
|
type: int
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
port_range_min:
|
||||||
port_range_max:
|
description:
|
||||||
description:
|
- Specifies the start port number. The value ranges from 1 to 65535. The value cannot be greater than the port_range_max
|
||||||
- Specifies the end port number. The value ranges from 1 to
|
value. An empty value indicates all ports.
|
||||||
65535. If the protocol is not icmp, the value cannot be
|
type: int
|
||||||
smaller than the port_range_min value. An empty value
|
returned: success
|
||||||
indicates all ports.
|
protocol:
|
||||||
type: int
|
description:
|
||||||
returned: success
|
- Specifies the protocol type. The value can be icmp, tcp, udp, or others. If the parameter is left blank, the security
|
||||||
port_range_min:
|
group supports all protocols.
|
||||||
description:
|
type: str
|
||||||
- Specifies the start port number. The value ranges from 1
|
returned: success
|
||||||
to 65535. The value cannot be greater than the
|
remote_address_group_id:
|
||||||
port_range_max value. An empty value indicates all ports.
|
description:
|
||||||
type: int
|
- Specifies the ID of remote IP address group.
|
||||||
returned: success
|
type: str
|
||||||
protocol:
|
returned: success
|
||||||
description:
|
remote_group_id:
|
||||||
- Specifies the protocol type. The value can be icmp, tcp,
|
description:
|
||||||
udp, or others. If the parameter is left blank, the
|
- Specifies the ID of the peer security group.
|
||||||
security group supports all protocols.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
remote_ip_prefix:
|
||||||
remote_address_group_id:
|
description:
|
||||||
description:
|
- Specifies the remote IP address. If the access control direction is set to egress, the parameter specifies the source
|
||||||
- Specifies the ID of remote IP address group.
|
IP address. If the access control direction is set to ingress, the parameter specifies the destination IP address.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
remote_group_id:
|
"""
|
||||||
description:
|
|
||||||
- Specifies the ID of the peer security group.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
remote_ip_prefix:
|
|
||||||
description:
|
|
||||||
- Specifies the remote IP address. If the access control
|
|
||||||
direction is set to egress, the parameter specifies the
|
|
||||||
source IP address. If the access control direction is set
|
|
||||||
to ingress, the parameter specifies the destination IP
|
|
||||||
address.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
||||||
|
|
|
@ -12,105 +12,90 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_vpc_security_group_rule
|
module: hwc_vpc_security_group_rule
|
||||||
description:
|
description:
|
||||||
- vpc security group management.
|
- VPC security group management.
|
||||||
short_description: Creates a resource of Vpc/SecurityGroupRule in Huawei Cloud
|
short_description: Creates a resource of VPC/SecurityGroupRule in Huawei Cloud
|
||||||
notes:
|
notes:
|
||||||
- If O(id) option is provided, it takes precedence over
|
- If O(id) option is provided, it takes precedence over O(security_group_id) for security group rule selection.
|
||||||
O(security_group_id) for security group rule selection.
|
- O(security_group_id) is used for security group rule selection. If more than one security group rule with this options
|
||||||
- O(security_group_id) is used for security group rule selection. If more
|
exists, execution is aborted.
|
||||||
than one security group rule with this options exists, execution is
|
- No parameter support updating. If one of option is changed, the module will create a new resource.
|
||||||
aborted.
|
|
||||||
- No parameter support updating. If one of option is changed, the module
|
|
||||||
will create a new resource.
|
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
|
||||||
type: str
|
|
||||||
choices: ['present', 'absent']
|
|
||||||
default: 'present'
|
|
||||||
direction:
|
|
||||||
description:
|
|
||||||
- Specifies the direction of access control. The value can be
|
|
||||||
egress or ingress.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
security_group_id:
|
|
||||||
description:
|
|
||||||
- Specifies the security group rule ID, which uniquely identifies
|
|
||||||
the security group rule.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
description:
|
description:
|
||||||
description:
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
- Provides supplementary information about the security group rule.
|
type: str
|
||||||
The value is a string of no more than 255 characters that can
|
choices: ['present', 'absent']
|
||||||
contain letters and digits.
|
default: 'present'
|
||||||
type: str
|
direction:
|
||||||
required: false
|
description:
|
||||||
ethertype:
|
- Specifies the direction of access control. The value can be egress or ingress.
|
||||||
description:
|
type: str
|
||||||
- Specifies the IP protocol version. The value can be IPv4 or IPv6.
|
required: true
|
||||||
If you do not set this parameter, IPv4 is used by default.
|
security_group_id:
|
||||||
type: str
|
description:
|
||||||
required: false
|
- Specifies the security group rule ID, which uniquely identifies the security group rule.
|
||||||
port_range_max:
|
type: str
|
||||||
description:
|
required: true
|
||||||
- Specifies the end port number. The value ranges from 1 to 65535.
|
description:
|
||||||
If the protocol is not icmp, the value cannot be smaller than the
|
description:
|
||||||
port_range_min value. An empty value indicates all ports.
|
- Provides supplementary information about the security group rule. The value is a string of no more than 255 characters
|
||||||
type: int
|
that can contain letters and digits.
|
||||||
required: false
|
type: str
|
||||||
port_range_min:
|
required: false
|
||||||
description:
|
ethertype:
|
||||||
- Specifies the start port number. The value ranges from 1 to
|
description:
|
||||||
65535. The value cannot be greater than the port_range_max value.
|
- Specifies the IP protocol version. The value can be IPv4 or IPv6. If you do not set this parameter, IPv4 is used by
|
||||||
An empty value indicates all ports.
|
default.
|
||||||
type: int
|
type: str
|
||||||
required: false
|
required: false
|
||||||
protocol:
|
port_range_max:
|
||||||
description:
|
description:
|
||||||
- Specifies the protocol type. The value can be icmp, tcp, or udp.
|
- Specifies the end port number. The value ranges from 1 to 65535. If the protocol is not icmp, the value cannot be
|
||||||
If the parameter is left blank, the security group supports all
|
smaller than the port_range_min value. An empty value indicates all ports.
|
||||||
protocols.
|
type: int
|
||||||
type: str
|
required: false
|
||||||
required: false
|
port_range_min:
|
||||||
remote_group_id:
|
description:
|
||||||
description:
|
- Specifies the start port number. The value ranges from 1 to 65535. The value cannot be greater than the port_range_max
|
||||||
- Specifies the ID of the peer security group. The value is
|
value. An empty value indicates all ports.
|
||||||
exclusive with parameter remote_ip_prefix.
|
type: int
|
||||||
type: str
|
required: false
|
||||||
required: false
|
protocol:
|
||||||
remote_ip_prefix:
|
description:
|
||||||
description:
|
- Specifies the protocol type. The value can be icmp, tcp, or udp. If the parameter is left blank, the security group
|
||||||
- Specifies the remote IP address. If the access control direction
|
supports all protocols.
|
||||||
is set to egress, the parameter specifies the source IP address.
|
type: str
|
||||||
If the access control direction is set to ingress, the parameter
|
required: false
|
||||||
specifies the destination IP address. The value can be in the
|
remote_group_id:
|
||||||
CIDR format or IP addresses. The parameter is exclusive with
|
description:
|
||||||
parameter remote_group_id.
|
- Specifies the ID of the peer security group. The value is exclusive with parameter remote_ip_prefix.
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
|
remote_ip_prefix:
|
||||||
|
description:
|
||||||
|
- Specifies the remote IP address. If the access control direction is set to egress, the parameter specifies the source
|
||||||
|
IP address. If the access control direction is set to ingress, the parameter specifies the destination IP address.
|
||||||
|
The value can be in the CIDR format or IP addresses. The parameter is exclusive with parameter remote_group_id.
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# create a security group rule
|
# create a security group rule
|
||||||
- name: Create a security group
|
- name: Create a security group
|
||||||
hwc_vpc_security_group:
|
hwc_vpc_security_group:
|
||||||
|
@ -125,72 +110,62 @@ EXAMPLES = '''
|
||||||
security_group_id: "{{ sg.id }}"
|
security_group_id: "{{ sg.id }}"
|
||||||
port_range_min: 22
|
port_range_min: 22
|
||||||
remote_ip_prefix: "0.0.0.0/0"
|
remote_ip_prefix: "0.0.0.0/0"
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
direction:
|
direction:
|
||||||
description:
|
description:
|
||||||
- Specifies the direction of access control. The value can be
|
- Specifies the direction of access control. The value can be egress or ingress.
|
||||||
egress or ingress.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
security_group_id:
|
||||||
security_group_id:
|
description:
|
||||||
description:
|
- Specifies the security group rule ID, which uniquely identifies the security group rule.
|
||||||
- Specifies the security group rule ID, which uniquely identifies
|
type: str
|
||||||
the security group rule.
|
returned: success
|
||||||
type: str
|
description:
|
||||||
returned: success
|
description:
|
||||||
description:
|
- Provides supplementary information about the security group rule. The value is a string of no more than 255 characters
|
||||||
description:
|
that can contain letters and digits.
|
||||||
- Provides supplementary information about the security group rule.
|
type: str
|
||||||
The value is a string of no more than 255 characters that can
|
returned: success
|
||||||
contain letters and digits.
|
ethertype:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the IP protocol version. The value can be IPv4 or IPv6. If you do not set this parameter, IPv4 is used by
|
||||||
ethertype:
|
default.
|
||||||
description:
|
type: str
|
||||||
- Specifies the IP protocol version. The value can be IPv4 or IPv6.
|
returned: success
|
||||||
If you do not set this parameter, IPv4 is used by default.
|
port_range_max:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the end port number. The value ranges from 1 to 65535. If the protocol is not icmp, the value cannot be smaller
|
||||||
port_range_max:
|
than the port_range_min value. An empty value indicates all ports.
|
||||||
description:
|
type: int
|
||||||
- Specifies the end port number. The value ranges from 1 to 65535.
|
returned: success
|
||||||
If the protocol is not icmp, the value cannot be smaller than the
|
port_range_min:
|
||||||
port_range_min value. An empty value indicates all ports.
|
description:
|
||||||
type: int
|
- Specifies the start port number. The value ranges from 1 to 65535. The value cannot be greater than the port_range_max
|
||||||
returned: success
|
value. An empty value indicates all ports.
|
||||||
port_range_min:
|
type: int
|
||||||
description:
|
returned: success
|
||||||
- Specifies the start port number. The value ranges from 1 to
|
protocol:
|
||||||
65535. The value cannot be greater than the port_range_max value.
|
description:
|
||||||
An empty value indicates all ports.
|
- Specifies the protocol type. The value can be icmp, tcp, or udp. If the parameter is left blank, the security group
|
||||||
type: int
|
supports all protocols.
|
||||||
returned: success
|
type: str
|
||||||
protocol:
|
returned: success
|
||||||
description:
|
remote_group_id:
|
||||||
- Specifies the protocol type. The value can be icmp, tcp, or udp.
|
description:
|
||||||
If the parameter is left blank, the security group supports all
|
- Specifies the ID of the peer security group. The value is exclusive with parameter remote_ip_prefix.
|
||||||
protocols.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
remote_ip_prefix:
|
||||||
remote_group_id:
|
description:
|
||||||
description:
|
- Specifies the remote IP address. If the access control direction is set to egress, the parameter specifies the source
|
||||||
- Specifies the ID of the peer security group. The value is
|
IP address. If the access control direction is set to ingress, the parameter specifies the destination IP address. The
|
||||||
exclusive with parameter remote_ip_prefix.
|
value can be in the CIDR format or IP addresses. The parameter is exclusive with parameter remote_group_id.
|
||||||
type: str
|
type: str
|
||||||
returned: success
|
returned: success
|
||||||
remote_ip_prefix:
|
"""
|
||||||
description:
|
|
||||||
- Specifies the remote IP address. If the access control direction
|
|
||||||
is set to egress, the parameter specifies the source IP address.
|
|
||||||
If the access control direction is set to ingress, the parameter
|
|
||||||
specifies the destination IP address. The value can be in the
|
|
||||||
CIDR format or IP addresses. The parameter is exclusive with
|
|
||||||
parameter remote_group_id.
|
|
||||||
type: str
|
|
||||||
returned: success
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
Config, HwcClientException, HwcModule, are_different_dicts, build_path,
|
||||||
|
|
|
@ -12,99 +12,90 @@ __metaclass__ = type
|
||||||
# Documentation
|
# Documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
---
|
|
||||||
module: hwc_vpc_subnet
|
module: hwc_vpc_subnet
|
||||||
description:
|
description:
|
||||||
- subnet management.
|
- Subnet management.
|
||||||
short_description: Creates a resource of Vpc/Subnet in Huawei Cloud
|
short_description: Creates a resource of VPC/Subnet in Huawei Cloud
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
author: Huawei Inc. (@huaweicloud)
|
author: Huawei Inc. (@huaweicloud)
|
||||||
requirements:
|
requirements:
|
||||||
- keystoneauth1 >= 3.6.0
|
- keystoneauth1 >= 3.6.0
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
support: full
|
support: full
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
|
description:
|
||||||
|
- Whether the given object should exist in Huawei Cloud.
|
||||||
|
type: str
|
||||||
|
choices: ['present', 'absent']
|
||||||
|
default: 'present'
|
||||||
|
timeouts:
|
||||||
|
description:
|
||||||
|
- The timeouts for each operations.
|
||||||
|
type: dict
|
||||||
|
default: {}
|
||||||
|
suboptions:
|
||||||
|
create:
|
||||||
description:
|
description:
|
||||||
- Whether the given object should exist in Huawei Cloud.
|
- The timeouts for create operation.
|
||||||
type: str
|
type: str
|
||||||
choices: ['present', 'absent']
|
default: '15m'
|
||||||
default: 'present'
|
update:
|
||||||
timeouts:
|
|
||||||
description:
|
description:
|
||||||
- The timeouts for each operations.
|
- The timeouts for update operation.
|
||||||
type: dict
|
|
||||||
default: {}
|
|
||||||
suboptions:
|
|
||||||
create:
|
|
||||||
description:
|
|
||||||
- The timeouts for create operation.
|
|
||||||
type: str
|
|
||||||
default: '15m'
|
|
||||||
update:
|
|
||||||
description:
|
|
||||||
- The timeouts for update operation.
|
|
||||||
type: str
|
|
||||||
default: '15m'
|
|
||||||
cidr:
|
|
||||||
description:
|
|
||||||
- Specifies the subnet CIDR block. The value must be within the VPC
|
|
||||||
CIDR block and be in CIDR format. The subnet mask cannot be
|
|
||||||
greater than 28. Cannot be changed after creating the subnet.
|
|
||||||
type: str
|
type: str
|
||||||
required: true
|
default: '15m'
|
||||||
gateway_ip:
|
cidr:
|
||||||
description:
|
description:
|
||||||
- Specifies the gateway of the subnet. The value must be an IP
|
- Specifies the subnet CIDR block. The value must be within the VPC CIDR block and be in CIDR format. The subnet mask
|
||||||
address in the subnet. Cannot be changed after creating the subnet.
|
cannot be greater than 28. Cannot be changed after creating the subnet.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
name:
|
gateway_ip:
|
||||||
description:
|
description:
|
||||||
- Specifies the subnet name. The value is a string of 1 to 64
|
- Specifies the gateway of the subnet. The value must be an IP address in the subnet. Cannot be changed after creating
|
||||||
characters that can contain letters, digits, underscores (V(_)),
|
the subnet.
|
||||||
hyphens (V(-)), and periods (V(.)).
|
type: str
|
||||||
type: str
|
required: true
|
||||||
required: true
|
name:
|
||||||
vpc_id:
|
description:
|
||||||
description:
|
- Specifies the subnet name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores
|
||||||
- Specifies the ID of the VPC to which the subnet belongs. Cannot
|
(V(_)), hyphens (V(-)), and periods (V(.)).
|
||||||
be changed after creating the subnet.
|
type: str
|
||||||
type: str
|
required: true
|
||||||
required: true
|
vpc_id:
|
||||||
availability_zone:
|
description:
|
||||||
description:
|
- Specifies the ID of the VPC to which the subnet belongs. Cannot be changed after creating the subnet.
|
||||||
- Specifies the AZ to which the subnet belongs. Cannot be changed
|
type: str
|
||||||
after creating the subnet.
|
required: true
|
||||||
type: str
|
availability_zone:
|
||||||
required: false
|
description:
|
||||||
dhcp_enable:
|
- Specifies the AZ to which the subnet belongs. Cannot be changed after creating the subnet.
|
||||||
description:
|
type: str
|
||||||
- Specifies whether DHCP is enabled for the subnet. The value can
|
required: false
|
||||||
be true (enabled) or false(disabled), and default value is true.
|
dhcp_enable:
|
||||||
If this parameter is set to false, newly created ECSs cannot
|
description:
|
||||||
obtain IP addresses, and usernames and passwords cannot be
|
- Specifies whether DHCP is enabled for the subnet. The value can be true (enabled) or false(disabled), and default
|
||||||
injected using Cloud-init.
|
value is true. If this parameter is set to false, newly created ECSs cannot obtain IP addresses, and usernames and
|
||||||
type: bool
|
passwords cannot be injected using Cloud-init.
|
||||||
required: false
|
type: bool
|
||||||
dns_address:
|
required: false
|
||||||
description:
|
dns_address:
|
||||||
- Specifies the DNS server addresses for subnet. The address
|
description:
|
||||||
in the head will be used first.
|
- Specifies the DNS server addresses for subnet. The address in the head will be used first.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
required: false
|
required: false
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.hwc
|
- community.general.hwc
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# create subnet
|
# create subnet
|
||||||
- name: Create vpc
|
- name: Create vpc
|
||||||
hwc_network_vpc:
|
hwc_network_vpc:
|
||||||
|
@ -118,55 +109,49 @@ EXAMPLES = '''
|
||||||
gateway_ip: "192.168.100.32"
|
gateway_ip: "192.168.100.32"
|
||||||
name: "ansible_network_subnet_test"
|
name: "ansible_network_subnet_test"
|
||||||
dhcp_enable: true
|
dhcp_enable: true
|
||||||
'''
|
"""
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r"""
|
||||||
cidr:
|
cidr:
|
||||||
description:
|
description:
|
||||||
- Specifies the subnet CIDR block. The value must be within the VPC
|
- Specifies the subnet CIDR block. The value must be within the VPC CIDR block and be in CIDR format. The subnet mask
|
||||||
CIDR block and be in CIDR format. The subnet mask cannot be
|
cannot be greater than 28.
|
||||||
greater than 28.
|
type: str
|
||||||
type: str
|
returned: success
|
||||||
returned: success
|
gateway_ip:
|
||||||
gateway_ip:
|
description:
|
||||||
description:
|
- Specifies the gateway of the subnet. The value must be an IP address in the subnet.
|
||||||
- Specifies the gateway of the subnet. The value must be an IP
|
type: str
|
||||||
address in the subnet.
|
returned: success
|
||||||
type: str
|
name:
|
||||||
returned: success
|
description:
|
||||||
name:
|
- Specifies the subnet name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores
|
||||||
description:
|
(V(_)), hyphens (V(-)), and periods (V(.)).
|
||||||
- Specifies the subnet name. The value is a string of 1 to 64
|
type: str
|
||||||
characters that can contain letters, digits, underscores (V(_)),
|
returned: success
|
||||||
hyphens (V(-)), and periods (V(.)).
|
vpc_id:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the ID of the VPC to which the subnet belongs.
|
||||||
vpc_id:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
- Specifies the ID of the VPC to which the subnet belongs.
|
availability_zone:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies the AZ to which the subnet belongs.
|
||||||
availability_zone:
|
type: str
|
||||||
description:
|
returned: success
|
||||||
- Specifies the AZ to which the subnet belongs.
|
dhcp_enable:
|
||||||
type: str
|
description:
|
||||||
returned: success
|
- Specifies whether DHCP is enabled for the subnet. The value can be true (enabled) or false(disabled), and default value
|
||||||
dhcp_enable:
|
is true. If this parameter is set to false, newly created ECSs cannot obtain IP addresses, and usernames and passwords
|
||||||
description:
|
cannot be injected using Cloud-init.
|
||||||
- Specifies whether DHCP is enabled for the subnet. The value can
|
type: bool
|
||||||
be true (enabled) or false(disabled), and default value is true.
|
returned: success
|
||||||
If this parameter is set to false, newly created ECSs cannot
|
dns_address:
|
||||||
obtain IP addresses, and usernames and passwords cannot be
|
description:
|
||||||
injected using Cloud-init.
|
- Specifies the DNS server addresses for subnet. The address in the head will be used first.
|
||||||
type: bool
|
type: list
|
||||||
returned: success
|
returned: success
|
||||||
dns_address:
|
"""
|
||||||
description:
|
|
||||||
- Specifies the DNS server addresses for subnet. The address
|
|
||||||
in the head will be used first.
|
|
||||||
type: list
|
|
||||||
returned: success
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
from ansible_collections.community.general.plugins.module_utils.hwc_utils import (
|
||||||
Config, HwcClientException, HwcClientException404, HwcModule,
|
Config, HwcClientException, HwcClientException404, HwcModule,
|
||||||
|
|
Loading…
Reference in New Issue