mirror of
https://github.com/zebrajr/ansible.git
synced 2025-12-06 12:19:53 +01:00
Avoid the ssh-agent exiting before tests end (#85979)
There were couple of occurrences where the hard 30 seconds limit on running ssh-agent was not enough for the test to run and the ssh-agent was killed resulting in the test failing with "Connection refused". This change just lets the agent run in the background and kills it manually after the tests finish.
This commit is contained in:
parent
726e8d6548
commit
05d5b0f168
|
|
@ -29,15 +29,17 @@
|
|||
vars:
|
||||
pid: '{{ auto.stdout|regex_findall("ssh-agent\[(\d+)\]")|first }}'
|
||||
|
||||
- command: ssh-agent -D -s -a '{{ output_dir }}/agent.sock'
|
||||
async: 30
|
||||
poll: 0
|
||||
- shell: ssh-agent -D -s -a '{{ output_dir }}/agent.sock' &
|
||||
register: ssh_agent_result
|
||||
|
||||
- command: ansible-playbook -i {{ ansible_inventory_sources|first|quote }} -vvv {{ role_path }}/auto.yml
|
||||
environment:
|
||||
ANSIBLE_CALLBACK_RESULT_FORMAT: yaml
|
||||
ANSIBLE_SSH_AGENT: '{{ output_dir }}/agent.sock'
|
||||
register: existing
|
||||
- block:
|
||||
- command: ansible-playbook -i {{ ansible_inventory_sources|first|quote }} -vvv {{ role_path }}/auto.yml
|
||||
environment:
|
||||
ANSIBLE_CALLBACK_RESULT_FORMAT: yaml
|
||||
ANSIBLE_SSH_AGENT: '{{ output_dir }}/agent.sock'
|
||||
register: existing
|
||||
always:
|
||||
- command: "kill {{ ssh_agent_result.stdout | regex_search('Agent pid ([0-9]+)', '\\1') | first }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user