Skip to content

Instantly share code, notes, and snippets.

@stuartellis
Created September 25, 2023 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartellis/4918da955b0456c0f6671f5d384c32cd to your computer and use it in GitHub Desktop.
Save stuartellis/4918da955b0456c0f6671f5d384c32cd to your computer and use it in GitHub Desktop.
import ansible_runner
def run():
config = {
"project_dir": "./assets/project", # source directory
"playbook":"self_test.yml", # roles are relative to playbooks: use roles_path for other locations
"private_data_dir": "./data", # run-time directory
"inventory": ["inventory/localhost.yml"],
"suppress_env_files": True,
"timeout": 120 # timeout in seconds
}
runner = ansible_runner.run(**config)
if __name__ == "__main__":
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment