mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Introduce force
and verbose
options in serverless module (#43947)
* Introduce `force` and `verbose` options in serverless module * Add "version_added: 2.7" for the new `force` and `verbose` options
This commit is contained in:
parent
c1c229c6d4
commit
7a4517a067
1 changed files with 25 additions and 3 deletions
|
@ -56,6 +56,18 @@ options:
|
|||
run to send them out. This is mostly useful for generating artifacts to be stored/deployed elsewhere.
|
||||
required: false
|
||||
default: true
|
||||
force:
|
||||
description:
|
||||
- Whether or not to force full deployment, equivalent to serverless `--force` option.
|
||||
required: false
|
||||
default: false
|
||||
version_added: "2.7"
|
||||
verbose:
|
||||
description:
|
||||
- Shows all stack events during deployment, and display any Stack Output.
|
||||
required: false
|
||||
default: false
|
||||
version_added: "2.7"
|
||||
notes:
|
||||
- Currently, the `serverless` command must be in the path of the node executing the task. In the future this may be a flag.
|
||||
requirements: [ "serverless", "yaml" ]
|
||||
|
@ -160,7 +172,9 @@ def main():
|
|||
region=dict(default='', required=False),
|
||||
stage=dict(default='', required=False),
|
||||
deploy=dict(default=True, type='bool', required=False),
|
||||
serverless_bin_path=dict(required=False, type='path')
|
||||
serverless_bin_path=dict(required=False, type='path'),
|
||||
force=dict(default=False, required=False),
|
||||
verbose=dict(default=False, required=False)
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -173,6 +187,8 @@ def main():
|
|||
region = module.params.get('region')
|
||||
stage = module.params.get('stage')
|
||||
deploy = module.params.get('deploy', True)
|
||||
force = module.params.get('force', False)
|
||||
verbose = module.params.get('verbose', False)
|
||||
serverless_bin_path = module.params.get('serverless_bin_path')
|
||||
|
||||
if serverless_bin_path is not None:
|
||||
|
@ -187,12 +203,18 @@ def main():
|
|||
else:
|
||||
module.fail_json(msg="State must either be 'present' or 'absent'. Received: {}".format(state))
|
||||
|
||||
if not deploy and state == 'present':
|
||||
command += '--noDeploy '
|
||||
if state == 'present':
|
||||
if not deploy:
|
||||
command += '--noDeploy '
|
||||
elif force:
|
||||
command += '--force '
|
||||
|
||||
if region:
|
||||
command += '--region {} '.format(region)
|
||||
if stage:
|
||||
command += '--stage {} '.format(stage)
|
||||
if verbose:
|
||||
command += '--verbose '
|
||||
|
||||
rc, out, err = module.run_command(command, cwd=service_path)
|
||||
if rc != 0:
|
||||
|
|
Loading…
Reference in a new issue