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.
pull/86016/head
Martin Krizek 2 months ago committed by GitHub
parent 726e8d6548
commit 05d5b0f168
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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…
Cancel
Save