Commit ed8c22fb authored by Aleksey Shirokih's avatar Aleksey Shirokih
Browse files

Introduce deploy option to show secrets in deploy log

Technically option is passed as environment variable TOWER_SHOW_SECRETS.
That variable should be parsed and reversed in ansible playbook.
It has to be passed to templates tasks with no_log: var_name
parent c5d93d91
...@@ -59,6 +59,7 @@ class DeployHandler(BaseHandler): ...@@ -59,6 +59,7 @@ class DeployHandler(BaseHandler):
self.deploy_options = set([int(i) for i in self.get_argument("deployment_options").split(",")]) self.deploy_options = set([int(i) for i in self.get_argument("deployment_options").split(",")])
except: # noqa except: # noqa
raise tornado.web.HTTPError(404) raise tornado.web.HTTPError(404)
env = os.environ.copy()
if self.get_argument("deployment_options"): if self.get_argument("deployment_options"):
tags = [] tags = []
if 1 in self.deploy_options: if 1 in self.deploy_options:
...@@ -79,6 +80,10 @@ class DeployHandler(BaseHandler): ...@@ -79,6 +80,10 @@ class DeployHandler(BaseHandler):
self.ansible_verbose = "-v" self.ansible_verbose = "-v"
if 91 in self.deploy_options: if 91 in self.deploy_options:
self.ansible_verbose = "-vvvvvvvv" self.ansible_verbose = "-vvvvvvvv"
if 92 in self.deploy_options:
env.update({
"TOWER_SHOW_SECRETS": "1"
})
if tags: if tags:
self.tags = "--tags=" + ",".join(tags) self.tags = "--tags=" + ",".join(tags)
logger.info("Running deploy on %s %s", self.env.name, self.deploy_options) logger.info("Running deploy on %s %s", self.env.name, self.deploy_options)
...@@ -105,7 +110,6 @@ class DeployHandler(BaseHandler): ...@@ -105,7 +110,6 @@ class DeployHandler(BaseHandler):
ansible_ssh_cp = os.path.join( ansible_ssh_cp = os.path.join(
"/tmp/tower-%%r-%%h-%%r" "/tmp/tower-%%r-%%h-%%r"
) )
env = os.environ.copy()
env.update({ env.update({
"NOC_ENV": str(self.env.name), "NOC_ENV": str(self.env.name),
"ANSIBLE_SSH_CONTROL_PATH": ansible_ssh_cp, "ANSIBLE_SSH_CONTROL_PATH": ansible_ssh_cp,
......
...@@ -69,7 +69,8 @@ var environment_list = { ...@@ -69,7 +69,8 @@ var environment_list = {
{id: 50, value: "Restart quick", tooltip: "Stop all, start all"}, {id: 50, value: "Restart quick", tooltip: "Stop all, start all"},
{id: 51, value: "Restart gentle", tooltip: "Restart one by one"}, {id: 51, value: "Restart gentle", tooltip: "Restart one by one"},
{id: 90, value: "Be verbose", tooltip: "Debug output -v"}, {id: 90, value: "Be verbose", tooltip: "Debug output -v"},
{id: 91, value: "Be extremely verbose", tooltip: "Debug output -vvvv"} {id: 91, value: "Be extremely verbose", tooltip: "Debug output -vvvv"},
{id: 92, value: "Show secrets in deploy log", tooltip: "Disable no_log"}
], ],
value: "1" value: "1"
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment