Merge "Add two roles for publishing artifacts over ssh"

This commit is contained in:
Zuul 2017-08-16 18:31:08 +00:00 committed by Gerrit Code Review
commit a77bf054fb
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,21 @@
- name: Create SSH private key from secret
copy:
content: "{{ fileserver.ssh_private_key }}"
dest: ~/.ssh/tarballs_id_rsa
mode: 0600
- name: Add tarballs server ssh key
command: ssh-add ~/.ssh/tarballs_id_rsa
- name: Remove SSH private key from disk
command: shred ~/.ssh/tarballs_id_rsa
- name: Add tarballs server to inventory
add_host:
name: "{{ fileserver.fqdn }}"
ansible_user: "{{ fileserver.ssh_username }}"
- name: Add tarballs server to known hosts
known_hosts:
name: "{{ fileserver.fqdn }}"
key: "{{ fileserver.ssh_known_hosts }}"

View File

@ -0,0 +1,15 @@
- name: Set tarball path
set_fact:
tarball_path: "{{ fileserver.path }}/{{ zuul.project.short_name }}"
- name: Ensure project directory exists
file:
path: "{{ tarball_path }}"
state: directory
recurse: yes
mode: 0775
- name: Upload contents of the artifacts folder
synchronize:
src: "{{ zuul.executor.work_root }}/artifacts/"
dest: "{{ tarball_path }}/"