Commit cabbf25a authored by Swann Perarnau's avatar Swann Perarnau
Browse files

Merge branch 'options' into 'master'

Add usefull options to lease/appliance

See merge request !12
parents 550e4629 d4357578
...@@ -220,7 +220,11 @@ def do_configure(argv): ...@@ -220,7 +220,11 @@ def do_configure(argv):
# call the remote ansible # call the remote ansible
remote_cmd = ('cd ansible;' remote_cmd = ('cd ansible;'
'ANSIBLE_HOST_KEY_CHECKING=False ' 'ANSIBLE_HOST_KEY_CHECKING=False '
'ansible-playbook -i inventory.yaml ' + playpath) 'ansible-playbook -i inventory.yaml'
)
if argv.vault:
remote_cmd += ' --ask-vault-pass'
remote_cmd += ' ' + playpath
# forward agent, auto accept host, don't save it in the host file # forward agent, auto accept host, don't save it in the host file
cmd = ["ssh", "-A", "-oUserKnownHostsFile=/dev/null", cmd = ["ssh", "-A", "-oUserKnownHostsFile=/dev/null",
"-oStrictHostKeyChecking=no", "cc@" + public_ip, remote_cmd] "-oStrictHostKeyChecking=no", "cc@" + public_ip, remote_cmd]
...@@ -263,6 +267,8 @@ def main(): ...@@ -263,6 +267,8 @@ def main():
parser_config = subparsers.add_parser("configure", parser_config = subparsers.add_parser("configure",
help="Configure an appliance") help="Configure an appliance")
parser_config.add_argument("--vault", action='store_true',
help="Ask for vault password on frontend play")
parser_config.add_argument("name", help="Name of the appliance") parser_config.add_argument("name", help="Name of the appliance")
parser_config.add_argument("playbook", default="main.yaml", nargs='?', parser_config.add_argument("playbook", default="main.yaml", nargs='?',
help="Playbook for remote configuration") help="Playbook for remote configuration")
......
...@@ -48,6 +48,7 @@ def do_create(argv): ...@@ -48,6 +48,7 @@ def do_create(argv):
'resource_type': 'physical:host', 'resource_type': 'physical:host',
'hypervisor_properties': "", 'hypervisor_properties': "",
'resource_properties': props, 'resource_properties': props,
'before_end': 'email' if argv.email else '',
} }
resources = {k: v if isinstance(v, str) else json.dumps(v) resources = {k: v if isinstance(v, str) else json.dumps(v)
for k, v in resources.items()} for k, v in resources.items()}
...@@ -116,6 +117,9 @@ def main(): ...@@ -116,6 +117,9 @@ def main():
parser_create.add_argument("--haswell", parser_create.add_argument("--haswell",
help="Use haswell nodes instead of skylake", help="Use haswell nodes instead of skylake",
action='store_true') action='store_true')
parser_create.add_argument("--email",
help="Send email reminder before lease ends",
action='store_true')
parser_create.add_argument("name", help="Lease name") parser_create.add_argument("name", help="Lease name")
parser_create.add_argument("size", help="Number of hosts to lease", parser_create.add_argument("size", help="Number of hosts to lease",
type=int) type=int)
......
Markdown is supported
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