|
1 | 1 | - hosts: satellite6 |
2 | | - vars_files: |
3 | | - - Downloads/satperf.yaml |
| 2 | + gather_facts: false |
4 | 3 | vars: |
5 | | - test_sync_repositories_count: 8 |
6 | | - test_sync_repositories_product: "test_sync_repositories_product" |
7 | | - test_sync_repositories_upstream_url_template: "https://galaxy.ansible.com/" |
8 | | - test_sync_repositories_repo_template: "test_sync_repositories_repo*" |
9 | | - test_sync_repositories_max_sync_secs: 3600 |
10 | | - test_sync_repositories_cv_template: "test_sync_repositories_cv*" |
11 | | - test_sync_repositories_le: "test_sync_repositories_le" |
12 | | - sat_user: admin |
13 | | - sat_pass: changeme |
14 | | - organization: Default Organization |
| 4 | + test_sync_ansible_collections_count: 8 |
| 5 | + test_sync_ansible_collections_upstream_url_template: "https://galaxy.ansible.com/" |
| 6 | + test_sync_ansible_collections_max_sync_secs: 3600 |
| 7 | + test_sync_ansible_collections_product: "test_sync_ansible_collections_product" |
| 8 | + test_sync_ansible_collections_le: "test_sync_ansible_collections_le" |
| 9 | + test_sync_ansible_collections_repo_template: "test_sync_ansible_collections_repo*" |
| 10 | + test_sync_ansible_collections_cv_template: "test_sync_ansible_collections_cv*" |
| 11 | + roles: |
| 12 | + - wait-for-task-script |
15 | 13 | tasks: |
16 | | - - name: "Create product" |
17 | | - ansible.builtin.command: |
| 14 | + - name: "Create product" |
| 15 | + ansible.builtin.command: |
18 | 16 | cmd: | |
19 | | - hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" product create --organization "{{ organization }}" --name "{{ test_sync_repositories_product }}" |
20 | | - register: create_product |
21 | | - failed_when: |
| 17 | + hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" product create --organization "{{ organization }}" --name "{{ test_sync_ansible_collections_product }}" |
| 18 | + register: create_product |
| 19 | + failed_when: |
22 | 20 | - create_product.rc != 0 |
23 | 21 | - "'Name has already been taken for a product in this organization' not in create_product.stderr" |
24 | | - changed_when: |
| 22 | + changed_when: |
25 | 23 | - create_product.rc == 0 |
26 | 24 | - "'Product created' in create_product.stdout" |
27 | 25 |
|
28 | | - - name: "Create requirements file" |
29 | | - ansible.builtin.copy: |
30 | | - dest: "/tmp/blabllbl" |
31 | | - content: | |
32 | | - --- |
33 | | - collections: |
34 | | - - name: ansible.posix |
35 | | - version: 1.5.4 |
36 | | - - name: ansible.utils |
37 | | - version: 5.0.0 |
38 | | - - name: community.general |
39 | | - version: 9.1.0 |
40 | | - ... |
| 26 | + - name: "Create requirements file" |
| 27 | + ansible.builtin.tempfile: |
| 28 | + state: file |
| 29 | + suffix: .yaml |
| 30 | + register: requirements_yaml |
41 | 31 |
|
42 | | - - name: "Create repos" |
43 | | - ansible.builtin.command: |
| 32 | + - name: "Add collections to requirements file" |
| 33 | + ansible.builtin.copy: |
| 34 | + src: files/requirements.yaml |
| 35 | + dest: "{{ requirements_yaml.path }}" |
| 36 | + |
| 37 | + - name: "Create repos" |
| 38 | + ansible.builtin.command: |
44 | 39 | cmd: | |
45 | | - hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" repository create --organization "{{ organization }}" --product "{{ test_sync_repositories_product }}" --content-type ansible_collection --url "{{ test_sync_repositories_upstream_url_template }}" --requirements "/tmp/blabllbl" --name "{{ test_sync_repositories_repo_template | replace('*', item) }}" |
46 | | - register: create_repo |
47 | | - loop: "{{ range(1, test_sync_repositories_count | int + 1) | list }}" |
| 40 | + hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" repository create --organization "{{ organization }}" --product "{{ test_sync_ansible_collections_product }}" --content-type ansible_collection --url "{{ test_sync_ansible_collections_upstream_url_template }}" --ansible-collection-requirements-file "{{ requirements_yaml.path }}" --name "{{ test_sync_ansible_collections_repo_template | replace('*', item) }}" |
| 41 | + register: create_repo |
| 42 | + loop: "{{ range(1, test_sync_ansible_collections_count | int + 1) | list }}" |
48 | 43 |
|
49 | 44 | # Sync |
50 | | - - name: "Start sync asynchronously" |
51 | | - ansible.builtin.command: |
52 | | - cmd: | |
53 | | - hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" repository synchronize --organization "{{ organization }}" --product "{{ test_sync_repositories_product }}" --name "{{ test_sync_repositories_repo_template | replace('*', item) }}" --async |
54 | | - loop: "{{ range(1, test_sync_repositories_count | int + 1) | list }}" |
55 | | - register: start_sync |
56 | | - ignore_errors: true |
| 45 | + - name: "Start sync asynchronously" |
| 46 | + ansible.builtin.command: |
| 47 | + cmd: | |
| 48 | + hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" repository synchronize --organization "{{ organization }}" --product "{{ test_sync_ansible_collections_product }}" --name "{{ test_sync_ansible_collections_repo_template | replace('*', item) }}" --async |
| 49 | + loop: "{{ range(1, test_sync_ansible_collections_count | int + 1) | list }}" |
| 50 | + register: start_sync |
| 51 | + ignore_errors: true |
57 | 52 |
|
58 | | - - name: "Check that start message is sane" |
59 | | - ansible.builtin.assert: |
| 53 | + - name: "Check that start message is sane" |
| 54 | + ansible.builtin.assert: |
60 | 55 | that: "'Repository is being synchronized in task' in item.stdout" |
61 | 56 | msg: 'Pass' |
62 | 57 | quiet: true |
63 | | - loop: "{{ start_sync.results }}" |
64 | | - loop_control: |
65 | | - label: "{{ test_sync_repositories_repo_template | replace('*', item.item) }}" |
| 58 | + loop: "{{ start_sync.results }}" |
| 59 | + loop_control: |
| 60 | + label: "{{ test_sync_ansible_collections_repo_template | replace('*', item.item) }}" |
66 | 61 |
|
67 | | - - name: "Wait for synces to finish" |
68 | | - ansible.builtin.command: |
69 | | - cmd: | |
70 | | - /root/wait-for-task.sh "{{ sat_user }}" "{{ sat_pass }}" "{{ item.stdout.split()[6].split('.')[0] }}" "{{ test_sync_repositories_max_sync_secs }}" |
71 | | - loop: "{{ start_sync.results }}" |
72 | | - loop_control: |
73 | | - label: "{{ test_sync_repositories_repo_template | replace('*', item.item) }}" |
74 | | - register: wait_sync |
75 | | - ignore_errors: true |
| 62 | + - name: "Wait for synces to finish" |
| 63 | + ansible.builtin.command: |
| 64 | + cmd: | |
| 65 | + /root/wait-for-task.sh "{{ sat_user }}" "{{ sat_pass }}" "{{ item.stdout.split()[6].split('.')[0] }}" "{{ test_sync_ansible_collections_max_sync_secs }}" |
| 66 | + loop: "{{ start_sync.results }}" |
| 67 | + loop_control: |
| 68 | + label: "{{ test_sync_ansible_collections_repo_template | replace('*', item.item) }}" |
| 69 | + register: wait_sync |
| 70 | + ignore_errors: true |
76 | 71 |
|
77 | | - - name: "Print sync results" |
78 | | - ansible.builtin.debug: |
| 72 | + - name: "Print synchronizations results" |
| 73 | + ansible.builtin.debug: |
79 | 74 | msg: "SyncRepositories {{ item.stdout_lines[-2] }} to {{ item.stdout_lines[-1] }}" |
80 | | - loop: "{{ wait_sync.results }}" |
81 | | - when: "item.rc is defined and item.rc == 0" |
| 75 | + loop: "{{ wait_sync.results }}" |
| 76 | + when: "item.rc is defined and item.rc == 0" |
82 | 77 |
|
83 | | - - name: "Create lifecycle environment" |
84 | | - ansible.builtin.command: |
| 78 | + - name: "Create lifecycle environment" |
| 79 | + ansible.builtin.command: |
85 | 80 | cmd: | |
86 | | - hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" lifecycle-environment create --organization "{{ organization }}" --prior Library --name "{{ test_sync_repositories_le }}" |
87 | | - register: create_le |
| 81 | + hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" lifecycle-environment create --organization "{{ organization }}" --prior Library --name "{{ test_sync_ansible_collections_le }}" |
| 82 | + register: create_le |
88 | 83 |
|
89 | | - - name: "Create content views" |
90 | | - ansible.builtin.command: |
91 | | - cmd: | |
92 | | - hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" content-view create --organization "{{ organization }}" --name "{{ test_sync_repositories_cv_template | replace('*', item) }}" |
93 | | - register: create_cv |
94 | | - loop: "{{ range(1, test_sync_repositories_count | int + 1) | list }}" |
| 84 | + - name: "Create content views" |
| 85 | + ansible.builtin.command: |
| 86 | + cmd: | |
| 87 | + hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" content-view create --organization "{{ organization }}" --name "{{ test_sync_ansible_collections_cv_template | replace('*', item) }}" |
| 88 | + register: create_cv |
| 89 | + loop: "{{ range(1, test_sync_ansible_collections_count | int + 1) | list }}" |
95 | 90 |
|
96 | 91 | # Publish |
97 | | - - name: "Publish content views" |
98 | | - ansible.builtin.command: |
| 92 | + - name: "Publish content views" |
| 93 | + ansible.builtin.command: |
99 | 94 | cmd: | |
100 | | - hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" content-view publish --async --organization "{{ organization }}" --name "{{ test_sync_repositories_cv_template | replace('*', item) }}" |
101 | | - register: start_publish |
102 | | - loop: "{{ range(1, test_sync_repositories_count | int + 1) | list }}" |
| 95 | + hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" content-view publish --async --organization "{{ organization }}" --name "{{ test_sync_ansible_collections_cv_template | replace('*', item) }}" |
| 96 | + register: start_publish |
| 97 | + loop: "{{ range(1, test_sync_ansible_collections_count | int + 1) | list }}" |
103 | 98 |
|
104 | | - - name: "Wait for publish to finish" |
105 | | - ansible.builtin.command: |
| 99 | + - name: "Wait for publish to finish" |
| 100 | + ansible.builtin.command: |
106 | 101 | cmd: | |
107 | | - /root/wait-for-task.sh "{{ sat_user }}" "{{ sat_pass }}" "{{ item.stdout.split()[7].split('.')[0] }}" "{{ test_sync_repositories_max_sync_secs }}" |
108 | | - loop: "{{ start_publish.results }}" |
109 | | - loop_control: |
110 | | - label: "{{ test_sync_repositories_cv_template | replace('*', item.item) }}" |
111 | | - register: wait_publish |
112 | | - ignore_errors: true |
| 102 | + /root/wait-for-task.sh "{{ sat_user }}" "{{ sat_pass }}" "{{ item.stdout.split()[7].split('.')[0] }}" "{{ test_sync_ansible_collections_max_sync_secs }}" |
| 103 | + loop: "{{ start_publish.results }}" |
| 104 | + loop_control: |
| 105 | + label: "{{ test_sync_ansible_collections_cv_template | replace('*', item.item) }}" |
| 106 | + register: wait_publish |
| 107 | + ignore_errors: true |
113 | 108 |
|
114 | | - - name: "Print publish results" |
115 | | - ansible.builtin.debug: |
116 | | - msg: "PublishContentViews {{ item.stdout_lines[-2] }} to {{ item.stdout_lines[-1] }}" |
117 | | - loop: "{{ wait_publish.results }}" |
118 | | - when: "item.rc is defined and item.rc == 0" |
| 109 | + - name: "Print publication results" |
| 110 | + ansible.builtin.debug: |
| 111 | + msg: "PublishContentViews {{ item.stdout_lines[-2] }} to {{ item.stdout_lines[-1] }}" |
| 112 | + loop: "{{ wait_publish.results }}" |
| 113 | + when: "item.rc is defined and item.rc == 0" |
119 | 114 |
|
120 | 115 | # Promote |
121 | | - - name: "Promote content views" |
122 | | - ansible.builtin.command: |
123 | | - hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" content-view version promote --async --organization "{{ organization }}" --content-view "{{ test_sync_repositories_cv_template | replace('*', item) }}" --version "1.0" --to-lifecycle-environment "{{ test_sync_repositories_le }}" |
124 | | - register: start_promote |
125 | | - loop: "{{ range(1, test_sync_repositories_count | int + 1) | list }}" |
| 116 | + - name: "Promote content views" |
| 117 | + ansible.builtin.command: |
| 118 | + hammer -u "{{ sat_user }}" -p "{{ sat_pass }}" content-view version promote --async --organization "{{ organization }}" --content-view "{{ test_sync_ansible_collections_cv_template | replace('*', item) }}" --version "1.0" --to-lifecycle-environment "{{ test_sync_ansible_collections_le }}" |
| 119 | + register: start_promote |
| 120 | + loop: "{{ range(1, test_sync_ansible_collections_count | int + 1) | list }}" |
126 | 121 |
|
127 | | - - name: "Wait for promote to finish" |
128 | | - ansible.builtin.command: |
| 122 | + - name: "Wait for promote to finish" |
| 123 | + ansible.builtin.command: |
129 | 124 | cmd: | |
130 | | - /root/wait-for-task.sh "{{ sat_user }}" "{{ sat_pass }}" "{{ item.stdout.split()[7].split('.')[0] }}" "{{ test_sync_repositories_max_sync_secs }}" |
131 | | - loop: "{{ start_promote.results }}" |
132 | | - loop_control: |
133 | | - label: "{{ test_sync_repositories_cv_template | replace('*', item.item) }}" |
134 | | - register: wait_promote |
135 | | - ignore_errors: true |
136 | | - |
137 | | - - ansible.builtin.debug: |
138 | | - var: wait_promote |
| 125 | + /root/wait-for-task.sh "{{ sat_user }}" "{{ sat_pass }}" "{{ item.stdout.split()[7].split('.')[0] }}" "{{ test_sync_ansible_collections_max_sync_secs }}" |
| 126 | + loop: "{{ start_promote.results }}" |
| 127 | + loop_control: |
| 128 | + label: "{{ test_sync_ansible_collections_cv_template | replace('*', item.item) }}" |
| 129 | + register: wait_promote |
| 130 | + ignore_errors: true |
139 | 131 |
|
140 | | - - name: "Print promote results" |
141 | | - ansible.builtin.debug: |
| 132 | + - name: "Print promotion results" |
| 133 | + ansible.builtin.debug: |
142 | 134 | msg: "PromoteContentViews {{ item.stdout_lines[-2] }} to {{ item.stdout_lines[-1] }}" |
143 | | - loop: "{{ wait_promote.results }}" |
144 | | - when: "item.rc is defined and item.rc == 0" |
| 135 | + loop: "{{ wait_promote.results }}" |
| 136 | + when: "item.rc is defined and item.rc == 0" |
145 | 137 | ... |
0 commit comments