zuul-jobs/test-playbooks/intercept-job.yaml
Clint Byrum 7eab57ab1e intercept-job -- self-service SSH access
This role is an attempt to allow self-service SSH access to nodes.

Change-Id: Icb6fb50b779c0bf2296e14436e4746355703f2ae
2021-04-23 15:14:06 +00:00

34 lines
984 B
YAML

- name: Set up async task that will add intercept key
hosts: all
tasks:
- name: Start keygen
command: ssh-keygen -N '' -t ed25519 -f {{ zuul.project.src_dir }}/intercept_job
async: 300
poll: 0
register: keygen
- name: Start background script to stop the waiting
shell: |
sleep 60
touch "{{ zuul.project.src_dir }}/intercept_job.stop"
async: 120
poll: 0
register: touched_file
- async_status:
jid: "{{ keygen.ansible_job_id }}"
register: keygen_check
until: keygen_check.finished == 1
retries: 2
- include_role:
name: intercept-job
- async_status:
jid: "{{ touched_file.ansible_job_id }}"
register: touched_file_check
until: touched_file_check.finished == 1
retries: 3
- stat:
path: "{{ zuul.project.src_dir }}/intercept_job.stop"
register: stop_waiting
- assert:
that:
- stop_waiting.stat.exists