53 lines
1.5 KiB
YAML
53 lines
1.5 KiB
YAML
- hosts: all
|
|
vars:
|
|
workspace: /tmp/quickstart-test
|
|
tasks:
|
|
# Our test images disable installation of recommended packages;
|
|
# re-enable that (the default) to make this test more closely
|
|
# resemble what a user will encounter.
|
|
- name: Remove disable-recommends
|
|
file:
|
|
name: /etc/apt/apt.conf.d/95disable-recommends
|
|
state: absent
|
|
become: true
|
|
- name: Install docker-compose and git-review
|
|
package:
|
|
name:
|
|
- docker-compose
|
|
- git-review
|
|
state: present
|
|
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
|