Improve CI (#198)

* Use remote temp path, replace remote lookups.

* Copy local files.

* Change docker resource name prefix from ansible-test to ansible-docker-test to avoid collision with ansible-test's containers.

* Fix typos.

* We don't neceessarily have a TTY.

* Use hopefully less collision-likely subnet.

* More collision avoidance.

* More changes.
This commit is contained in:
Felix Fontein
2021-09-08 09:43:35 +02:00
committed by GitHub
parent 451bc0e94e
commit 5a3ce51049
42 changed files with 190 additions and 139 deletions
@@ -1,3 +1,4 @@
dependencies:
#- setup_docker -- done in setup.yml, to work around cleanup problems!
- setup_openssl
- setup_remote_tmp_dir
@@ -25,8 +25,16 @@
}}
register: nginx_container
- name: Copy config files
copy:
src: "{{ item }}"
dest: "{{ remote_tmp_dir }}/{{ item }}"
loop:
- nginx.conf
- nginx.htpasswd
- name: Copy static files into volume
command: docker cp {{ role_path }}/files/{{ item }} {{ docker_registry_container_name_frontend }}:/etc/nginx/{{ item }}
command: docker cp {{ remote_tmp_dir }}/{{ item }} {{ docker_registry_container_name_frontend }}:/etc/nginx/{{ item }}
loop:
- nginx.conf
- nginx.htpasswd
@@ -38,27 +46,27 @@
- name: Create private key for frontend certificate
community.crypto.openssl_privatekey:
path: '{{ output_dir }}/cert.key'
path: '{{ remote_tmp_dir }}/cert.key'
type: ECC
curve: secp256r1
force: yes
- name: Create CSR for frontend certificate
community.crypto.openssl_csr:
path: '{{ output_dir }}/cert.csr'
privatekey_path: '{{ output_dir }}/cert.key'
path: '{{ remote_tmp_dir }}/cert.csr'
privatekey_path: '{{ remote_tmp_dir }}/cert.key'
subject_alt_name:
- DNS:test-registry.ansible.com
- name: Create frontend certificate
community.crypto.openssl_certificate:
path: '{{ output_dir }}/cert.pem'
csr_path: '{{ output_dir }}/cert.csr'
privatekey_path: '{{ output_dir }}/cert.key'
path: '{{ remote_tmp_dir }}/cert.pem'
csr_path: '{{ remote_tmp_dir }}/cert.csr'
privatekey_path: '{{ remote_tmp_dir }}/cert.key'
provider: selfsigned
- name: Copy dynamic files into volume
command: docker cp {{ output_dir }}/{{ item }} {{ docker_registry_container_name_frontend }}:/etc/nginx/{{ item }}
command: docker cp {{ remote_tmp_dir }}/{{ item }} {{ docker_registry_container_name_frontend }}:/etc/nginx/{{ item }}
loop:
- cert.pem
- cert.key
@@ -14,9 +14,9 @@
- name: Create random name prefix and test registry name
set_fact:
docker_registry_container_name_registry: '{{ ''ansible-test-registry-%0x'' % ((2**32) | random) }}'
docker_registry_container_name_nginx: '{{ ''ansible-test-registry-frontend-%0x'' % ((2**32) | random) }}'
docker_registry_container_name_nginx2: '{{ ''ansible-test-registry-frontend2-%0x'' % ((2**32) | random) }}'
docker_registry_container_name_registry: '{{ ''ansible-docker-test-registry-%0x'' % ((2**32) | random) }}'
docker_registry_container_name_nginx: '{{ ''ansible-docker-test-registry-frontend-%0x'' % ((2**32) | random) }}'
docker_registry_container_name_nginx2: '{{ ''ansible-docker-test-registry-frontend2-%0x'' % ((2**32) | random) }}'
- name: Create image and container list
set_fact: