
These two roles no longer need the delegation variable used in testing, so it is removed. Role execution now happens on the executor. Since the remote servers are still on the worker node, we open the firewall on the remote node in both cases. In the artifactory role, the ensure-docker role is moved to a "roles" section for simplicity. Additionally, one of the artifactory API calls is wrapped in retries as a precaution since I saw that fail in local testing. Change-Id: Ia4409edc217e1935775a5aece2e7d9bcfd935762
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
- hosts: all
|
|
vars:
|
|
zuul_log_aws_access_key: minioadmin
|
|
zuul_log_aws_secret_key: minioadmin
|
|
zuul_log_bucket: zuul
|
|
test_content: "123abc"
|
|
roles:
|
|
- clear-firewall
|
|
- ensure-docker
|
|
- ensure-pip
|
|
tasks:
|
|
- name: Install boto
|
|
pip:
|
|
extra_args: "--break-system-packages"
|
|
name:
|
|
- boto3
|
|
- botocore
|
|
|
|
- name: Start minio server
|
|
command: >-
|
|
docker run -d -p 9000:9000
|
|
-e MINIO_ACCESS_KEY={{ zuul_log_aws_access_key }}
|
|
-e MINIO_SECRET_KEY={{ zuul_log_aws_secret_key }}
|
|
quay.io/minio/minio server /data
|
|
|
|
- name: Make sure bucket exists
|
|
s3_bucket:
|
|
name: "{{ zuul_log_bucket }}"
|
|
state: present
|
|
s3_url: 'http://localhost:9000'
|
|
aws_access_key: "{{ zuul_log_aws_access_key }}"
|
|
aws_secret_key: "{{ zuul_log_aws_secret_key }}"
|
|
|
|
- name: Add content to tempfile
|
|
delegate_to: localhost
|
|
copy:
|
|
content: "{{ test_content }}"
|
|
dest: "{{ zuul.executor.log_root }}/testfile"
|
|
|
|
- name: Upload file to s3
|
|
include_role:
|
|
name: upload-logs-s3
|
|
vars:
|
|
upload_logs_s3_endpoint: 'http://{{ ansible_host }}:9000'
|
|
|
|
- name: Download mc
|
|
get_url:
|
|
url: https://dl.min.io/client/mc/release/linux-amd64/mc
|
|
dest: "{{ ansible_user_dir }}/mc"
|
|
mode: 0755
|
|
|
|
- name: Add localhost minio host
|
|
command: "{{ ansible_user_dir }}/mc alias set local http://localhost:9000 {{ zuul_log_aws_access_key }} {{ zuul_log_aws_secret_key }}"
|
|
|
|
- name: List files in minio bucket
|
|
command: "{{ ansible_user_dir }}/mc find local/zuul"
|
|
|
|
- name: Check for testfile in minio bucket
|
|
command: "{{ ansible_user_dir }}/mc find local/zuul/{{ zuul_log_path }}/testfile"
|