blob: f8959c9a7a897ea88f733e9e43493ef4ff08605e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
- hosts: all
vars:
workspace: /tmp/quickstart-test
local: false
roles:
- name: install-docker
use_upstream_docker: false
- use-buildset-registry
tasks:
- name: Install docker-compose
package:
name:
- docker-compose
state: present
become: true
- name: Install git-review
command: python3 -m pip install git-review
become: true
- name: Create workspace directory
file:
state: directory
path: "{{ workspace }}"
- name: Generate example user ssh key
command: "ssh-keygen -f {{ workspace }}/id_rsa -N ''"
args:
creates: "{{ workspace }}/id_rsa.pub"
- name: Load example user SSH key
shell: "cat {{ workspace }}/id_rsa.pub"
register: ssh_key_cat
- name: Register example user SSH key
set_fact:
ssh_public_key: "{{ ssh_key_cat.stdout }}"
- name: Start ssh-agent
command: ssh-agent
register: ssh_agent
- name: Add key to ssh agent
shell:
executable: /bin/bash
cmd: |
{{ ssh_agent.stdout }}
ssh-add {{ workspace }}/id_rsa
- block:
- name: Run tasks in ssh agent
include_tasks: main.yaml
always:
- name: Stop ssh-agent
shell:
executable: /bin/bash
cmd: |
{{ ssh_agent.stdout }}
ssh-agent -k
|