|
1 | 1 | # Ansible playbook to start the pulp service container and its supporting services |
2 | 2 | --- |
3 | | -- hosts: "localhost" |
| 3 | +- name: "Start CI Containers" |
| 4 | + hosts: "localhost" |
4 | 5 | gather_facts: false |
5 | 6 | vars_files: |
6 | 7 | - "vars/main.yaml" |
|
14 | 15 | - "settings" |
15 | 16 |
|
16 | 17 | - name: "Generate Pulp Settings" |
17 | | - template: |
| 18 | + ansible.builtin.template: |
18 | 19 | src: "settings.py.j2" |
19 | 20 | dest: "settings/settings.py" |
| 21 | + vars: |
| 22 | + django_secret: "lookup('community.general.random_string', length=50, overwrite_all='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')" |
20 | 23 |
|
21 | 24 | - name: "Setup docker networking" |
22 | | - docker_network: |
| 25 | + community.docker.docker_network: |
23 | 26 | name: "pulp_ci_bridge" |
24 | 27 |
|
25 | 28 | - name: "Start Service Containers" |
26 | | - docker_container: |
| 29 | + community.docker.docker_container: |
27 | 30 | name: "{{ item.name }}" |
28 | 31 | image: "{{ item.image }}" |
29 | 32 | auto_remove: true |
|
39 | 42 | loop: "{{ services | default([]) }}" |
40 | 43 |
|
41 | 44 | - name: "Retrieve Docker Network Info" |
42 | | - docker_network_info: |
| 45 | + community.docker.docker_network_info: |
43 | 46 | name: "pulp_ci_bridge" |
44 | 47 | register: "pulp_ci_bridge_info" |
45 | 48 |
|
46 | 49 | - name: "Update /etc/hosts" |
47 | | - lineinfile: |
| 50 | + ansible.builtin.lineinfile: |
48 | 51 | path: "/etc/hosts" |
49 | 52 | regexp: "\\s{{ item.value.Name }}\\s*$" |
50 | 53 | line: "{{ item.value.IPv4Address | ansible.utils.ipaddr('address') }}\t{{ item.value.Name }}" |
|
55 | 58 | amazon.aws.s3_bucket: |
56 | 59 | aws_access_key: "{{ minio_access_key }}" |
57 | 60 | aws_secret_key: "{{ minio_secret_key }}" |
58 | | - s3_url: "http://minio:9000" |
| 61 | + endpoint_url: "http://minio:9000" |
59 | 62 | region: "eu-central-1" |
60 | 63 | name: "pulp3" |
61 | 64 | state: "present" |
62 | 65 | when: "s3_test | default(false)" |
63 | 66 |
|
64 | | - - block: |
| 67 | + - name: "Wait on Services" |
| 68 | + block: |
| 69 | + - name: "Wait for azurite" |
| 70 | + ansible.builtin.uri: |
| 71 | + url: "http://ci-azurite:10000/" |
| 72 | + status_code: |
| 73 | + - 200 |
| 74 | + - 400 |
| 75 | + when: "azure_test | default(false)" |
| 76 | + retries: 2 |
| 77 | + delay: 5 |
| 78 | + |
65 | 79 | - name: "Wait for Pulp" |
66 | | - uri: |
67 | | - url: "http://pulp{{ lookup('env', 'PULP_API_ROOT') | default('\/pulp\/', True) }}api/v3/status/" |
| 80 | + ansible.builtin.uri: |
| 81 | + url: "http://pulp{{ pulp_scenario_settings.api_root | default(pulp_settings.api_root | default('\/pulp\/', True), True) }}api/v3/status/" |
68 | 82 | follow_redirects: "all" |
69 | 83 | validate_certs: "no" |
70 | 84 | register: "result" |
|
73 | 87 | delay: 5 |
74 | 88 | rescue: |
75 | 89 | - name: "Output pulp container log" |
76 | | - command: "docker logs pulp" |
| 90 | + ansible.builtin.command: |
| 91 | + cmd: "docker logs pulp" |
77 | 92 | failed_when: true |
78 | 93 |
|
79 | 94 | - name: "Check version of component being tested" |
80 | | - assert: |
| 95 | + ansible.builtin.assert: |
81 | 96 | that: |
82 | 97 | - "(result.json.versions | items2dict(key_name='component', value_name='version'))[item.app_label] | canonical_semver == (component_version | canonical_semver)" |
83 | 98 | fail_msg: | |
|
86 | 101 | loop: "{{ 'plugins' | ansible.builtin.extract(lookup('ansible.builtin.file', '../../template_config.yml') | from_yaml) }}" |
87 | 102 |
|
88 | 103 | - name: "Set pulp password in .netrc" |
89 | | - copy: |
| 104 | + ansible.builtin.copy: |
90 | 105 | dest: "~/.netrc" |
91 | 106 | content: | |
92 | 107 | machine pulp |
93 | 108 | login admin |
94 | 109 | password password |
95 | 110 |
|
96 | | -- hosts: "pulp" |
| 111 | +- name: "Prepare Pulp Application Container" |
| 112 | + hosts: "pulp" |
97 | 113 | gather_facts: false |
98 | 114 | tasks: |
99 | 115 | - name: "Create directory for pulp-smash config" |
|
108 | 124 | dest: "/var/lib/pulp/.config/pulp_smash/settings.json" |
109 | 125 |
|
110 | 126 | - name: "Set pulp admin password" |
111 | | - command: |
| 127 | + ansible.builtin.command: |
112 | 128 | cmd: "pulpcore-manager reset-admin-password --password password" |
113 | 129 | ... |
0 commit comments