|
|
@ -211,15 +211,24 @@
|
|
|
|
- name: test the task invocation by running ansible in command task
|
|
|
|
- name: test the task invocation by running ansible in command task
|
|
|
|
vars:
|
|
|
|
vars:
|
|
|
|
pexpect_python: "{{ hostvars['localhost']['ansible_python_interpreter'] }}"
|
|
|
|
pexpect_python: "{{ hostvars['localhost']['ansible_python_interpreter'] }}"
|
|
|
|
|
|
|
|
localhost_cmd_file: "{{ output_dir }}/test_command.py"
|
|
|
|
module_defaults:
|
|
|
|
module_defaults:
|
|
|
|
ansible.builtin.pip:
|
|
|
|
ansible.builtin.pip:
|
|
|
|
virtualenv_python: "{{ pexpect_python }}"
|
|
|
|
virtualenv_python: "{{ pexpect_python }}"
|
|
|
|
block:
|
|
|
|
block:
|
|
|
|
- include_role:
|
|
|
|
- include_role:
|
|
|
|
name: setup_pexpect
|
|
|
|
name: setup_pexpect
|
|
|
|
|
|
|
|
apply:
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
vars:
|
|
|
|
|
|
|
|
setup_pexpect_tmpdir: "{{ output_dir }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: copy script into output directory
|
|
|
|
|
|
|
|
copy: src=test_command.py dest={{ localhost_cmd_file }} mode=0444
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
- command: |
|
|
|
|
- command: |
|
|
|
|
ansible localhost -m expect -a "command='{{pexpect_python}} {{test_command_file}} foo --quiet' responses='{\"foo\": \"bar\"}'" -vvv
|
|
|
|
ansible localhost -m expect -a "command='{{pexpect_python}} {{localhost_cmd_file}} foo --quiet' responses='{\"foo\": \"bar\"}'" -vvv
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
register: task_invocation
|
|
|
|
register: task_invocation
|
|
|
|
|
|
|
|
|
|
|
|