Merge "Add two roles for publishing artifacts over ssh"
This commit is contained in:
commit
a77bf054fb
21
roles/add-fileserver/tasks/main.yaml
Normal file
21
roles/add-fileserver/tasks/main.yaml
Normal 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 }}"
|
15
roles/publish-artifacts-to-fileserver/tasks/main.yaml
Normal file
15
roles/publish-artifacts-to-fileserver/tasks/main.yaml
Normal 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 }}/"
|
Loading…
x
Reference in New Issue
Block a user