mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
feat/fix typo
This commit is contained in:
parent
8ce38665cd
commit
2c694f246d
1 changed files with 63 additions and 83 deletions
|
@ -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 = r'''
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
---
|
||||||
module: proxmox_backup
|
module: proxmox_backup
|
||||||
short_description: Get, delete, create or update Proxmox VE backup jobs.
|
short_description: Get, delete, create or update Proxmox VE backup jobs.
|
||||||
|
@ -27,12 +26,11 @@ attributes:
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Indicate desired state of the job.
|
|
||||||
- Set to list to get one or all jobs.
|
|
||||||
- Set to present to create or update job.
|
- Set to present to create or update job.
|
||||||
- Set to absent to delete job.
|
- Set to absent to delete job.
|
||||||
choices: ['list', 'present', 'absent']
|
choices: ['present', 'absent']
|
||||||
type: str
|
type: str
|
||||||
|
required: true
|
||||||
all:
|
all:
|
||||||
description:
|
description:
|
||||||
- Backup all known guest systems on this host.
|
- Backup all known guest systems on this host.
|
||||||
|
@ -42,24 +40,23 @@ options:
|
||||||
bwlimit:
|
bwlimit:
|
||||||
description:
|
description:
|
||||||
- Limit I/O bandwidth (in KiB/s).
|
- Limit I/O bandwidth (in KiB/s).
|
||||||
format: <integer> (0 - N)
|
|
||||||
type: int
|
type: int
|
||||||
default: 0
|
default: 0
|
||||||
comment:
|
comment:
|
||||||
description:
|
description:
|
||||||
- Description for the Job.
|
- Description for the Job.
|
||||||
choices: ['0', '1', 'gzip', 'lzo', 'zstd']
|
|
||||||
type: str
|
type: str
|
||||||
compress:
|
compress:
|
||||||
description:
|
description:
|
||||||
- Compress dump file.
|
- Compress dump file.
|
||||||
|
choices: ['0', '1', 'gzip', 'lzo', 'zstd']
|
||||||
type: str
|
type: str
|
||||||
default: 0
|
default: "0"
|
||||||
dow:
|
dow:
|
||||||
description:
|
description:
|
||||||
- Day of week selection.
|
- Day of week selection.
|
||||||
type: str
|
type: str
|
||||||
default: mon,tue,wed,thu,fri,sat,sun
|
default: "mon,tue,wed,thu,fri,sat,sun"
|
||||||
dumpdir:
|
dumpdir:
|
||||||
description:
|
description:
|
||||||
- Store resulting files to specified directory.
|
- Store resulting files to specified directory.
|
||||||
|
@ -75,15 +72,15 @@ options:
|
||||||
type: str
|
type: str
|
||||||
exclude_path:
|
exclude_path:
|
||||||
description:
|
description:
|
||||||
- Exclude certain files/directories (shell globs).
|
- >
|
||||||
- Paths starting with '/' are anchored to the container's root,
|
Exclude certain files/directories (shell globs).
|
||||||
- other paths match relative to each subdirectory.
|
Paths starting with '/' are anchored to the container's root,
|
||||||
format: [<string>, ...]
|
other paths match relative to each subdirectory.
|
||||||
type: list
|
choices: ['ignore', 'on']
|
||||||
|
type: str
|
||||||
fleecing:
|
fleecing:
|
||||||
description:
|
description:
|
||||||
- Options for backup fleecing (VM only).
|
- Options for backup fleecing (VM only).
|
||||||
format: "[enabled=<1|0>][,storage=<storage ID>]"
|
|
||||||
type: str
|
type: str
|
||||||
id:
|
id:
|
||||||
description:
|
description:
|
||||||
|
@ -100,13 +97,11 @@ options:
|
||||||
- For snapshot and suspend mode backups of VMs, this only affects the compressor.
|
- For snapshot and suspend mode backups of VMs, this only affects the compressor.
|
||||||
- A value of 8 means the idle priority is used,
|
- A value of 8 means the idle priority is used,
|
||||||
- otherwise the best-effort priority is used with the specified value.
|
- otherwise the best-effort priority is used with the specified value.
|
||||||
format: <integer> (0 - 8)
|
|
||||||
type: int
|
type: int
|
||||||
default: 7
|
default: 7
|
||||||
lockwait:
|
lockwait:
|
||||||
description:
|
description:
|
||||||
- Maximal time to wait for the global lock (minutes).
|
- Maximal time to wait for the global lock (minutes).
|
||||||
format: <integer> (0 - N)
|
|
||||||
type: int
|
type: int
|
||||||
default: 180
|
default: 180
|
||||||
mailnotification:
|
mailnotification:
|
||||||
|
@ -122,7 +117,6 @@ options:
|
||||||
maxfiles:
|
maxfiles:
|
||||||
description:
|
description:
|
||||||
- Maximal number of backup files per guest system.
|
- Maximal number of backup files per guest system.
|
||||||
format: <integer> (1 - N)
|
|
||||||
type: int
|
type: int
|
||||||
mode:
|
mode:
|
||||||
description:
|
description:
|
||||||
|
@ -144,7 +138,6 @@ options:
|
||||||
performance:
|
performance:
|
||||||
description:
|
description:
|
||||||
- Other performance-related settings.
|
- Other performance-related settings.
|
||||||
format: (Possible values [max-workers=<integer>] [,pbs-entries-max=<integer>])
|
|
||||||
type: str
|
type: str
|
||||||
pigz:
|
pigz:
|
||||||
description:
|
description:
|
||||||
|
@ -164,7 +157,6 @@ options:
|
||||||
prune_backups:
|
prune_backups:
|
||||||
description:
|
description:
|
||||||
- Use these retention options instead of those from the storage configuration.
|
- Use these retention options instead of those from the storage configuration.
|
||||||
Format: "[keep-all=<1|0>], [keep-daily=<N>], [keep-hourly=<N>], [keep-last=<N>], [keep-monthly=<N>], [keep-weekly=<N>], [keep-yearly=<N>]"
|
|
||||||
type: str
|
type: str
|
||||||
default: keep-all=1
|
default: keep-all=1
|
||||||
quiet:
|
quiet:
|
||||||
|
@ -185,7 +177,6 @@ options:
|
||||||
schedule:
|
schedule:
|
||||||
description:
|
description:
|
||||||
- Backup schedule. The format is a subset of `systemd` calendar events.
|
- Backup schedule. The format is a subset of `systemd` calendar events.
|
||||||
example: "*-*-* 22:00:00"
|
|
||||||
type: str
|
type: str
|
||||||
script:
|
script:
|
||||||
description:
|
description:
|
||||||
|
@ -194,13 +185,12 @@ options:
|
||||||
starttime:
|
starttime:
|
||||||
description:
|
description:
|
||||||
- Job Start time.
|
- Job Start time.
|
||||||
format: "HH:MM"
|
|
||||||
type: str
|
type: str
|
||||||
stdexcludes:
|
stdexcludes:
|
||||||
description:
|
description:
|
||||||
- Exclude temporary files and logs.
|
- Exclude temporary files and logs.
|
||||||
type: bool
|
type: bool
|
||||||
default: 0
|
default: 1
|
||||||
stop:
|
stop:
|
||||||
description:
|
description:
|
||||||
- Stop running backup jobs on this host.
|
- Stop running backup jobs on this host.
|
||||||
|
@ -209,13 +199,11 @@ options:
|
||||||
stopwait:
|
stopwait:
|
||||||
description:
|
description:
|
||||||
- Maximal time to wait until a guest system is stopped (minutes).
|
- Maximal time to wait until a guest system is stopped (minutes).
|
||||||
format: "<integer> (0 - N)"
|
|
||||||
type: int
|
type: int
|
||||||
default: 10
|
default: 10
|
||||||
storage:
|
storage:
|
||||||
description:
|
description:
|
||||||
- Store resulting file to this storage.
|
- Store resulting file to this storage.
|
||||||
format: "<storage ID>"
|
|
||||||
type: str
|
type: str
|
||||||
tmpdir:
|
tmpdir:
|
||||||
description:
|
description:
|
||||||
|
@ -239,7 +227,6 @@ extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: List all backup jobs
|
- name: List all backup jobs
|
||||||
community.general.proxmox_backup:
|
community.general.proxmox_backup:
|
||||||
|
@ -298,7 +285,6 @@ EXAMPLES = '''
|
||||||
state: present
|
state: present
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
proxmox_backup:
|
proxmox_backup:
|
||||||
description: List of Proxmox VE backup.
|
description: List of Proxmox VE backup.
|
||||||
|
@ -340,9 +326,9 @@ proxmox_backup:
|
||||||
type: str
|
type: str
|
||||||
exclude_path:
|
exclude_path:
|
||||||
description:
|
description:
|
||||||
- Exclude certain files/directories (shell globs).
|
- >
|
||||||
- Paths starting with '/' are anchored to the container's root,
|
Exclude certain files/directories (shell globs).
|
||||||
- other paths match relative to each subdirectory.
|
Paths starting with '/' are anchored to the container's root, other paths match relative to each subdirectory.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: list
|
type: list
|
||||||
fleecing:
|
fleecing:
|
||||||
|
@ -355,11 +341,11 @@ proxmox_backup:
|
||||||
type: str
|
type: str
|
||||||
ionice:
|
ionice:
|
||||||
description:
|
description:
|
||||||
- Set IO priority when using the BFQ scheduler.
|
- >
|
||||||
- For snapshot and suspend mode backups of VMs,
|
Set IO priority when using the BFQ scheduler.
|
||||||
- this only affects the compressor.
|
For snapshot and suspend mode backups of VMs, this only affects the compressor.
|
||||||
- A value of 8 means the idle priority is used,
|
- >
|
||||||
- otherwise the best-effort priority is used with the specified value.
|
A value of 8 means the idle priority is used, otherwise the best-effort priority is used with the specified value.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: int
|
type: int
|
||||||
lockwait:
|
lockwait:
|
||||||
|
@ -372,8 +358,8 @@ proxmox_backup:
|
||||||
type: str
|
type: str
|
||||||
mailto:
|
mailto:
|
||||||
description:
|
description:
|
||||||
- Comma-separated list of email addresses or users
|
- >
|
||||||
- that should receive email notifications.
|
Comma-separated list of email addresses or users that should receive email notifications.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
maxfiles:
|
maxfiles:
|
||||||
|
@ -392,21 +378,22 @@ proxmox_backup:
|
||||||
description:
|
description:
|
||||||
- Template string for generating notes for the backup(s).
|
- Template string for generating notes for the backup(s).
|
||||||
- It can contain variables which will be replaced by their values.
|
- It can contain variables which will be replaced by their values.
|
||||||
- Currently supported are {{cluster}}, {{guestname}}, {{node}},
|
- Currently supported are {{cluster}}, {{guestname}}, {{node}} and {{vmid}}, but more might be added in the future.
|
||||||
- and {{vmid}}, but more might be added in the future.
|
- Needs to be a single line, newline and backslash need to be escaped.
|
||||||
- Needs to be a single line, newline and backslash need to be escaped as '\n' and '\\' respectively.
|
|
||||||
returned: on success
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
performance:
|
performance:
|
||||||
description:
|
description:
|
||||||
- Other performance-related settings.
|
- >
|
||||||
- (Possible values [max-workers=<integer>] [,pbs-entries-max=<integer>])
|
Other performance-related settings.
|
||||||
|
(Possible values [max-workers=<integer>] [,pbs-entries-max=<integer>])
|
||||||
returned: on success
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
pigz:
|
pigz:
|
||||||
description:
|
description:
|
||||||
- Use pigz instead of gzip when N>0. N=1 uses half of cores,
|
- >
|
||||||
- N>1 uses N as thread count.
|
Use pigz instead of gzip when N>0. N=1 uses half of cores,
|
||||||
|
N>1 uses N as thread count.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: int
|
type: int
|
||||||
pool:
|
pool:
|
||||||
|
@ -420,9 +407,9 @@ proxmox_backup:
|
||||||
type: bool
|
type: bool
|
||||||
prune_backups:
|
prune_backups:
|
||||||
description:
|
description:
|
||||||
- Use these retention options instead of those from the storage configuration.
|
- >
|
||||||
- (Format [keep-all=<1|0>] [,keep-daily=<N>] [,keep-hourly=<N>]
|
Use these retention options instead of those from the storage configuration.
|
||||||
- [,keep-last=<N>] [,keep-monthly=<N>] [,keep-weekly=<N>] [,keep-yearly=<N>])
|
(Format [keep-all=<1|0>] [,keep-daily=<N>] [,keep-hourly=<N>] [,keep-last=<N>] [,keep-monthly=<N>] [,keep-weekly=<N>] [,keep-yearly=<N>])
|
||||||
returned: on success
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
quiet:
|
quiet:
|
||||||
|
@ -435,14 +422,16 @@ proxmox_backup:
|
||||||
type: bool
|
type: bool
|
||||||
repeat_missed:
|
repeat_missed:
|
||||||
description:
|
description:
|
||||||
- If true, the job will be run as soon as possible
|
- >
|
||||||
- if it was missed while the scheduler was not running.
|
If true, the job will be run as soon as possible
|
||||||
|
if it was missed while the scheduler was not running.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: bool
|
type: bool
|
||||||
schedule:
|
schedule:
|
||||||
description:
|
description:
|
||||||
- Backup schedule.
|
- >
|
||||||
- The format is a subset of `systemd` calendar events.
|
Backup schedule.
|
||||||
|
The format is a subset of `systemd` calendar events.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
script:
|
script:
|
||||||
|
@ -480,8 +469,9 @@ proxmox_backup:
|
||||||
type: str
|
type: str
|
||||||
zstd:
|
zstd:
|
||||||
description:
|
description:
|
||||||
- Zstd threads. N=0 uses half of the available cores,
|
- >
|
||||||
- if N is set to a value bigger than 0, N is used as thread count.
|
Zstd threads. N=0 uses half of the available cores,
|
||||||
|
if N is set to a value bigger than 0, N is used as thread count.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: int
|
type: int
|
||||||
'''
|
'''
|
||||||
|
@ -628,7 +618,7 @@ def proxmox_backup_argument_spec():
|
||||||
},
|
},
|
||||||
'state': {
|
'state': {
|
||||||
'type': 'str',
|
'type': 'str',
|
||||||
'choices': ['list', 'present', 'absent'],
|
'choices': ['present', 'absent'],
|
||||||
'required': True
|
'required': True
|
||||||
},
|
},
|
||||||
'all': {
|
'all': {
|
||||||
|
@ -645,10 +635,11 @@ def proxmox_backup_argument_spec():
|
||||||
'compress': {
|
'compress': {
|
||||||
'type': 'str',
|
'type': 'str',
|
||||||
'choices': ['0', '1', 'gzip', 'lzo', 'zstd'],
|
'choices': ['0', '1', 'gzip', 'lzo', 'zstd'],
|
||||||
'default': '0'
|
'default': "0"
|
||||||
},
|
},
|
||||||
'dow': {
|
'dow': {
|
||||||
'type': 'str'
|
'type': 'str',
|
||||||
|
'default': "mon,tue,wed,thu,fri,sat,sun"
|
||||||
},
|
},
|
||||||
'dumpdir': {
|
'dumpdir': {
|
||||||
'type': 'str'
|
'type': 'str'
|
||||||
|
@ -661,24 +652,22 @@ def proxmox_backup_argument_spec():
|
||||||
'type': 'str'
|
'type': 'str'
|
||||||
},
|
},
|
||||||
'exclude_path': {
|
'exclude_path': {
|
||||||
'type': 'list',
|
'type': 'str',
|
||||||
'choices': ['ignore', 'on'],
|
'choices': ['ignore', 'on']
|
||||||
'format': '[<string>, ...]'
|
|
||||||
},
|
},
|
||||||
'fleecing': {
|
'fleecing': {
|
||||||
'type': 'str',
|
'type': 'str'
|
||||||
'format': '[[enabled:]<1|0>] [,storage:<storage ID>]'
|
|
||||||
},
|
},
|
||||||
'id': {
|
'id': {
|
||||||
'type': 'str'
|
'type': 'str'
|
||||||
},
|
},
|
||||||
'ionice': {
|
'ionice': {
|
||||||
'type': 'int',
|
'type': 'int',
|
||||||
'default': 8,
|
'default': 7
|
||||||
'format': '<integer> (0 - 8)'
|
|
||||||
},
|
},
|
||||||
'lockwait': {
|
'lockwait': {
|
||||||
'type': 'int'
|
'type': 'int',
|
||||||
|
'default': 180
|
||||||
},
|
},
|
||||||
'mailnotification': {
|
'mailnotification': {
|
||||||
'type': 'str',
|
'type': 'str',
|
||||||
|
@ -689,8 +678,7 @@ def proxmox_backup_argument_spec():
|
||||||
'type': 'str'
|
'type': 'str'
|
||||||
},
|
},
|
||||||
'maxfiles': {
|
'maxfiles': {
|
||||||
'type': 'int',
|
'type': 'int'
|
||||||
'format': '<integer> (1 - N)'
|
|
||||||
},
|
},
|
||||||
'mode': {
|
'mode': {
|
||||||
'type': 'str',
|
'type': 'str',
|
||||||
|
@ -703,9 +691,6 @@ def proxmox_backup_argument_spec():
|
||||||
'notes_template': {
|
'notes_template': {
|
||||||
'type': 'str'
|
'type': 'str'
|
||||||
},
|
},
|
||||||
'notification_target': {
|
|
||||||
'type': 'str'
|
|
||||||
},
|
|
||||||
'performance': {
|
'performance': {
|
||||||
'type': 'str'
|
'type': 'str'
|
||||||
},
|
},
|
||||||
|
@ -721,9 +706,7 @@ def proxmox_backup_argument_spec():
|
||||||
},
|
},
|
||||||
'prune_backups': {
|
'prune_backups': {
|
||||||
'type': 'str',
|
'type': 'str',
|
||||||
'format': '''[keep-all:<1|0>] [,keep-daily:<N>] [,keep-hourly:<N>]
|
'default': 'keep-all=1'
|
||||||
[,keep-last:<N>] [,keep-monthly:<N>] [,keep-weekly:<N>]
|
|
||||||
[,keep-yearly:<N>]'''
|
|
||||||
},
|
},
|
||||||
'quiet': {
|
'quiet': {
|
||||||
'type': 'bool',
|
'type': 'bool',
|
||||||
|
@ -738,15 +721,13 @@ def proxmox_backup_argument_spec():
|
||||||
'default': 0
|
'default': 0
|
||||||
},
|
},
|
||||||
'schedule': {
|
'schedule': {
|
||||||
'type': 'str',
|
'type': 'str'
|
||||||
'format': '*-*-* 22:00'
|
|
||||||
},
|
},
|
||||||
'script': {
|
'script': {
|
||||||
'type': 'str'
|
'type': 'str'
|
||||||
},
|
},
|
||||||
'starttime': {
|
'starttime': {
|
||||||
'type': 'str',
|
'type': 'str'
|
||||||
'format': 'HH:MM'
|
|
||||||
},
|
},
|
||||||
'stdexcludes': {
|
'stdexcludes': {
|
||||||
'type': 'bool',
|
'type': 'bool',
|
||||||
|
@ -758,8 +739,7 @@ def proxmox_backup_argument_spec():
|
||||||
},
|
},
|
||||||
'stopwait': {
|
'stopwait': {
|
||||||
'type': 'int',
|
'type': 'int',
|
||||||
'default': 10,
|
'default': 10
|
||||||
'format': '<integer> (0 - N)'
|
|
||||||
},
|
},
|
||||||
'storage': {
|
'storage': {
|
||||||
'type': 'str'
|
'type': 'str'
|
||||||
|
@ -787,17 +767,17 @@ def main():
|
||||||
argument_spec=module_args,
|
argument_spec=module_args,
|
||||||
required_one_of=[('api_password', 'api_token_id')],
|
required_one_of=[('api_password', 'api_token_id')],
|
||||||
required_together=[('api_token_id', 'api_token_secret')],
|
required_together=[('api_token_id', 'api_token_secret')],
|
||||||
mutually_exclusive=[('all', 'pool', 'wmid')],
|
mutually_exclusive=[('all', 'vmid', 'pool')],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
proxmox = ProxmoxBackupAnsible(module)
|
proxmox = ProxmoxBackupAnsible(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if module.params['state'] == 'list':
|
#if module.params['state'] == 'list':
|
||||||
backups = proxmox.get_backups(module.params.get('id'))
|
# backups = proxmox.get_backups(module.params.get('id'))
|
||||||
result['backups'] = backups
|
# result['backups'] = backups
|
||||||
elif module.params['state'] == 'absent':
|
if module.params['state'] == 'absent':
|
||||||
proxmox.delete_backup(module.params['id'])
|
proxmox.delete_backup(module.params['id'])
|
||||||
elif module.params['state'] == 'present':
|
elif module.params['state'] == 'present':
|
||||||
if module.params['id']:
|
if module.params['id']:
|
||||||
|
|
Loading…
Reference in a new issue