add role_name config option
This commit is contained in:
parent
ea22d67ee3
commit
97d39351e4
|
@ -1,8 +1,4 @@
|
||||||
* BUGFIX
|
* BUGFIX
|
||||||
* add missing default for `role_dir`
|
* add `role_name` config option to overwrite name of the role
|
||||||
* fix value mapping in jinja2 source dict
|
|
||||||
* add missing exception handling for dict merge
|
|
||||||
* fix handling of multiline default values in template
|
|
||||||
* FEATURE
|
* FEATURE
|
||||||
* use explicit marker to convert annotation values to json
|
* add basic hugo theme
|
||||||
* use dictsort filter in template for ordered variable list
|
|
||||||
|
|
|
@ -41,6 +41,11 @@ class Config():
|
||||||
"env": "ROLE_DIR",
|
"env": "ROLE_DIR",
|
||||||
"type": environs.Env().str
|
"type": environs.Env().str
|
||||||
},
|
},
|
||||||
|
"role_name": {
|
||||||
|
"default": "",
|
||||||
|
"env": "ROLE_NAME",
|
||||||
|
"type": environs.Env().str
|
||||||
|
},
|
||||||
"dry_run": {
|
"dry_run": {
|
||||||
"default": False,
|
"default": False,
|
||||||
"env": "DRY_RUN",
|
"env": "DRY_RUN",
|
||||||
|
@ -168,6 +173,9 @@ class Config():
|
||||||
for key, item in self.SETTINGS.items():
|
for key, item in self.SETTINGS.items():
|
||||||
normalized = self._add_dict_branch(normalized, key.split("."), item["default"])
|
normalized = self._add_dict_branch(normalized, key.split("."), item["default"])
|
||||||
|
|
||||||
|
# compute role_name default
|
||||||
|
normalized["role_name"] = os.path.basename(self.role_dir)
|
||||||
|
|
||||||
self.schema = anyconfig.gen_schema(normalized)
|
self.schema = anyconfig.gen_schema(normalized)
|
||||||
return normalized
|
return normalized
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Parser:
|
||||||
if data.get("dependencies") is not None:
|
if data.get("dependencies") is not None:
|
||||||
self._data["meta"]["dependencies"] = {"value": data.get("dependencies")}
|
self._data["meta"]["dependencies"] = {"value": data.get("dependencies")}
|
||||||
|
|
||||||
self._data["meta"]["name"] = {"value": os.path.basename(self.config.role_dir)}
|
self._data["meta"]["name"] = {"value": self.config.config["role_name"]}
|
||||||
except (ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError) as e:
|
except (ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError) as e:
|
||||||
message = "{} {}".format(e.context, e.problem)
|
message = "{} {}".format(e.context, e.problem)
|
||||||
self.log.sysexit_with_message("Unable to read yaml file {}\n{}".format(rfile, message))
|
self.log.sysexit_with_message("Unable to read yaml file {}\n{}".format(rfile, message))
|
||||||
|
|
|
@ -6,6 +6,8 @@ title: Default settings
|
||||||
---
|
---
|
||||||
# default is your current working dir
|
# default is your current working dir
|
||||||
role_dir:
|
role_dir:
|
||||||
|
# default is the basename of 'role_name'
|
||||||
|
role_name:
|
||||||
# don't write anything to filesystem
|
# don't write anything to filesystem
|
||||||
dry_run: False
|
dry_run: False
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ title: Environment Variables
|
||||||
{{< highlight Shell "linenos=table" >}}
|
{{< highlight Shell "linenos=table" >}}
|
||||||
ANSIBLE_DOCTOR_CONFIG_FILE=
|
ANSIBLE_DOCTOR_CONFIG_FILE=
|
||||||
ANSIBLE_DOCTOR_ROLE_DIR=
|
ANSIBLE_DOCTOR_ROLE_DIR=
|
||||||
|
ANSIBLE_DOCTOR_ROLE_NAME=
|
||||||
ANSIBLE_DOCTOR_DRY_RUN=false
|
ANSIBLE_DOCTOR_DRY_RUN=false
|
||||||
ANSIBLE_DOCTOR_LOG_LEVEL=warning
|
ANSIBLE_DOCTOR_LOG_LEVEL=warning
|
||||||
ANSIBLE_DOCTOR_LOG_JSON=false
|
ANSIBLE_DOCTOR_LOG_JSON=false
|
||||||
|
|
Loading…
Reference in New Issue