ansible / pytest-ansible

A pytest plugin that enables the use of ansible in tests, enables the use of pytest as a collection unit test runner, and exposes molecule scenarios through a pytest fixture.

Home Page:https://ansible.readthedocs.io/projects/pytest-ansible/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

run ansible module with vars

lguohan opened this issue · comments

how can i implement such playbook task

    - name: Generate configurations for exabgp instances
      template: src=roles/test/templates/exabgp/config.j2 dest={{exabgp_dir}}/{{item.file_name}}
      with_items:
        - {file_name: "config_1.ini", local_ip: '{{speaker_ips[0]}}', port_num: '5000'}
        - {file_name: "config_2.ini", local_ip: '{{speaker_ips[1]}}', port_num: '6000'}
        - {file_name: "config_3.ini", local_ip: '{{vlan_ips[0]}}', port_num: '7000'}

when I call template module, how can i supply additional vars such as local_ip, port_num. Is there an example?

can override extra_vars.