Skip to content

Enable passing hosts via python API #27

Description

@ckunki

Originally posted by @tkilias in #23 (comment):

test/resources/itest/docker_playbook.yml:

  hosts: localhost
  tasks:
    - name: Add Docker Container to Ansible Inventory
      add_host:

In theory, this wouldn't be necessary when we can provide an inventory via Python.

for the moment we can keep it, but we should think about the inventory.
Long term, we also need to think about the feature to use vaults.

References

See parameter inventory for method run() in src/ansible_runner/interface.py:

:param str or dict or list inventory:
Overrides the inventory directory/file (supplied at private_data_dir/inventory) with a specific host or list of hosts.

This can take the form of:

  • Path to the inventory file in the private_data_dir/inventory directory or an absolute path to the inventory file
  • Native python dict supporting the YAML/json inventory structure
  • A text INI formatted string
  • A list of inventory sources, or an empty list to disable passing inventory

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringCode improvement without behavior change

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions