Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
name = "boardwalk"
description = "Boardwalk is a linear Ansible workflow engine"
readme = "README.md"
version = "0.8.26"
version = "0.8.27"
requires-python = ">=3.11,<4"
authors = [
{name="Mat Hornbeek", email="84995001+m4wh6k@users.noreply.github.com"},
Expand Down
5 changes: 3 additions & 2 deletions src/boardwalk/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,15 @@ def ansible_runner_run_tasks(
"gather_facts": gather_facts,
"become": become,
"tasks": tasks,
"vars": {"boardwalk_operation": True},
}
if job_type == boardwalk.manifest.JobTypes.PLAYBOOK:
# Executing a (list of) playbook(s) requires some different settings
runner_kwargs["limit"] = hosts
runner_kwargs["extravars"] = {"boardwalk_operation": True} | extra_vars
runner_kwargs["playbook"] = tasks

# Load extra_vars into the runner kwargs
runner_kwargs["extravars"] = {"boardwalk_operation": True} | extra_vars

output_msg_prefix = f"{hosts}: ansible_runner invocation"
if limit:
output_msg_prefix = f"{hosts}(limit: {limit}): ansible_runner invocation"
Expand Down
18 changes: 18 additions & 0 deletions test/server-client/Boardwalkfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
os.environ["ANSIBLE_CONFIG"] = os.path.abspath("ansible.cfg")


class DumpHostvarsWorkspace(Workspace):
def config(self):
return WorkspaceConfig(
host_pattern="localhost",
workflow=DumpHostvarsWorkflow(),
)


class ShouldSucceedTestWorkspace(Workspace):
def config(self):
return WorkspaceConfig(
Expand Down Expand Up @@ -124,6 +132,16 @@ def exit_jobs(self):
return TestJob()


class DumpHostvarsWorkflow(Workflow):
def jobs(self):
return DumpHostvarsJob()


class DumpHostvarsJob(TaskJob):
def tasks(self) -> AnsibleTasksType:
return [{"ansible.builtin.debug": {"var": "hostvars[inventory_hostname]"}}]


class TestJob(TaskJob):
def tasks(self) -> AnsibleTasksType:
return [{"ansible.builtin.debug": {"msg": "Hello, Boardwalk!"}}]
Expand Down