Add pingall and fix env vars
This commit is contained in:
parent
58b09694df
commit
1adab407e8
@ -5,9 +5,10 @@ from os import environ
|
||||
import click
|
||||
from PyInquirer import prompt
|
||||
|
||||
from autonomic.config import ACTIONS_DIR, INFRA_DIR
|
||||
from autonomic.config import ACTIONS_DIR, INFRA_DIR, PASS_STORE_DIR
|
||||
from autonomic.infra import get_passwd, run_play
|
||||
from autonomic.utils import git_status, qlist
|
||||
from autonomic.settings import get
|
||||
|
||||
|
||||
@click.command()
|
||||
@ -16,7 +17,11 @@ def actions(ctx):
|
||||
"""Run an Ansible action."""
|
||||
env = environ.copy()
|
||||
|
||||
choices = ["addusers", "newhetzner", "rmhetzner", "newdokku"]
|
||||
env.update({"ANSIBLE_USER": get("username")})
|
||||
env.update({"REMOTE_USER": get("username")})
|
||||
env.update({"PASSWORD_STORE_DIR": PASS_STORE_DIR})
|
||||
|
||||
choices = ["addusers", "newhetzner", "rmhetzner", "newdokku", "pingall"]
|
||||
question = qlist("action", "Which Ansible action?", choices,)
|
||||
action = prompt(question)["action"]
|
||||
|
||||
|
@ -28,9 +28,6 @@ def members(flatten=None):
|
||||
|
||||
def run_play(play, env=None):
|
||||
"""Run an Ansible playbook."""
|
||||
if env is None:
|
||||
env = environ.copy()
|
||||
|
||||
cmd = [".venv/bin/ansible-playbook", play]
|
||||
run(cmd, cwd=INFRA_DIR, interactive=True, env=env)
|
||||
|
||||
|
Reference in New Issue
Block a user