feat(github_artifact): add force parameter to force installation
This commit is contained in:
parent
890c7646fa
commit
5c67a916ee
1 changed files with 12 additions and 2 deletions
|
@ -36,9 +36,14 @@ options:
|
||||||
required: false
|
required: false
|
||||||
default: []
|
default: []
|
||||||
creates:
|
creates:
|
||||||
description: if provided and target file / directory exists, this step will **not** be run
|
description: if provided and target file / directory exists, this step will **not** be run unless `--force` is specified
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
|
force:
|
||||||
|
description: forces the re-installation of the package no matter its state
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
github_token:
|
github_token:
|
||||||
description: a GitHub app token if you have one; limits impact of rate-limiting errors
|
description: a GitHub app token if you have one; limits impact of rate-limiting errors
|
||||||
type: str
|
type: str
|
||||||
|
@ -291,6 +296,11 @@ def main():
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"required": False
|
"required": False
|
||||||
},
|
},
|
||||||
|
"force": {
|
||||||
|
"type": "bool",
|
||||||
|
"required": False,
|
||||||
|
"default": False
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"required": True
|
"required": True
|
||||||
|
@ -323,7 +333,7 @@ def main():
|
||||||
DEFAULT_HEADERS["Authorization"] = "Bearer {}".format(ANSIBLE_MODULE.params["github_token"])
|
DEFAULT_HEADERS["Authorization"] = "Bearer {}".format(ANSIBLE_MODULE.params["github_token"])
|
||||||
|
|
||||||
creates_file: str | None = ANSIBLE_MODULE.params.get("creates", None)
|
creates_file: str | None = ANSIBLE_MODULE.params.get("creates", None)
|
||||||
if creates_file and path.exists(creates_file):
|
if creates_file and path.exists(creates_file) and not ANSIBLE_MODULE.params.get("force", False):
|
||||||
result["state"] = "ignored"
|
result["state"] = "ignored"
|
||||||
ANSIBLE_MODULE.exit_json(**result)
|
ANSIBLE_MODULE.exit_json(**result)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue