|
151 | 151 |
|
152 | 152 | # https://github.com/docker/docker-py/issues/1502
|
153 | 153 | - name: Workaround for issue - No module named ssl_match_hostname (Python 2.7)
|
154 |
| - become: yes |
155 |
| - command: cp -r /usr/local/lib/python2.7/dist-packages/backports/ssl_match_hostname/ /usr/lib/python2.7/dist-packages/backports |
| 154 | + block: |
| 155 | + - name: Test if module ssl_match_hostname exists |
| 156 | + command: python -c "import backports.ssl_match_hostname" |
| 157 | + register: _docker_check_smh |
| 158 | + changed_when: no |
| 159 | + failed_when: _docker_check_smh.rc > 1 |
| 160 | + check_mode: no |
| 161 | + |
| 162 | + - name: Apply workaround for issue - No module named ssl_match_hostname (Python 2.7) |
| 163 | + become: yes |
| 164 | + command: cp -r /usr/local/lib/python2.7/dist-packages/backports/ssl_match_hostname/ /usr/lib/python2.7/dist-packages/backports |
| 165 | + when: _docker_check_smh.rc == 1 |
156 | 166 | when:
|
157 | 167 | - docker_x_ssl_match_hostname | bool
|
| 168 | + - not _docker_python3 | bool |
158 | 169 | - _docker_additional_packages_pip | length > 0
|
| 170 | + |
| 171 | +- name: Workaround for issue - No module named shutil_get_terminal_size (Python 2.7) |
| 172 | + block: |
| 173 | + - name: Test if module shutil_get_terminal_size exists |
| 174 | + command: python -c "import backports.shutil_get_terminal_size" |
| 175 | + register: _docker_check_shutil |
| 176 | + changed_when: no |
| 177 | + failed_when: _docker_check_shutil.rc > 1 |
| 178 | + check_mode: no |
| 179 | + |
| 180 | + - name: Apply workaround for issue - No module named shutil_get_terminal_size (Python 2.7) |
| 181 | + become: yes |
| 182 | + command: cp -r /usr/local/lib/python2.7/dist-packages/backports/shutil_get_terminal_size/ /usr/lib/python2.7/dist-packages/backports |
| 183 | + when: _docker_check_shutil.rc == 1 |
| 184 | + when: |
| 185 | + - docker_x_shutil_get_terminal_size | bool |
159 | 186 | - not _docker_python3 | bool
|
| 187 | + - _docker_additional_packages_pip | length > 0 |
160 | 188 |
|
161 | 189 | - name: Stat /usr/bin/docker-compose
|
162 | 190 | stat:
|
|
192 | 220 | when:
|
193 | 221 | - not docker_compose_no_pip_detect_version | bool
|
194 | 222 |
|
195 |
| - - name: Fetch docker-compose SHA265 sum file |
196 |
| - get_url: |
197 |
| - url: "https://github.com/docker/compose/releases/download/\ |
198 |
| - {{ _docker_compose_version }}/docker-compose-{{ ansible_system }}-{{ ansible_architecture }}.sha256" |
199 |
| - dest: "/tmp/ansible.docker-compose-sha256" |
200 |
| - register: _github_docker_compose_shasum_file |
201 |
| - changed_when: false |
202 |
| - until: _github_docker_compose_shasum_file.status_code == 200 |
203 |
| - retries: 10 |
204 |
| - check_mode: no |
| 223 | + - name: Fetch SHA256 of docker-compose |
| 224 | + block: |
| 225 | + - name: Fetch docker-compose SHA265 sum file |
| 226 | + get_url: |
| 227 | + url: "https://github.com/docker/compose/releases/download/\ |
| 228 | + {{ _docker_compose_version }}/docker-compose-{{ ansible_system }}-{{ ansible_architecture }}.sha256" |
| 229 | + dest: "/tmp/ansible.docker-compose-sha256" |
| 230 | + register: _github_docker_compose_shasum_file |
| 231 | + changed_when: false |
| 232 | + until: _github_docker_compose_shasum_file.status_code == 200 |
| 233 | + retries: 10 |
| 234 | + check_mode: no |
205 | 235 |
|
206 |
| - - name: Dump SHA256 file contents to variable |
207 |
| - command: cat /tmp/ansible.docker-compose-sha256 |
208 |
| - register: _github_docker_compose_shasum |
209 |
| - changed_when: false |
210 |
| - check_mode: no |
| 236 | + - name: Dump SHA256 file contents to variable |
| 237 | + command: cat /tmp/ansible.docker-compose-sha256 |
| 238 | + register: _github_docker_compose_shasum |
| 239 | + changed_when: false |
| 240 | + check_mode: no |
211 | 241 |
|
212 |
| - - name: Remove temporary file for SHA256 sum |
213 |
| - file: |
214 |
| - path: "/tmp/ansible.docker-compose-sha256" |
215 |
| - state: absent |
216 |
| - changed_when: false |
217 |
| - check_mode: no |
| 242 | + - name: Remove temporary file for SHA256 sum |
| 243 | + file: |
| 244 | + path: "/tmp/ansible.docker-compose-sha256" |
| 245 | + state: absent |
| 246 | + changed_when: false |
| 247 | + check_mode: no |
218 | 248 |
|
219 |
| - - name: Set SHA256 facts related to docker-compose |
220 |
| - set_fact: |
221 |
| - _docker_compose_checksum: "sha256:{{ _github_docker_compose_shasum.stdout | \ |
222 |
| - regex_replace('^([0-9a-zA-Z]*)[\\s\\t]+.+', '\\1') }}" |
223 |
| - |
224 |
| - # Use when moving to Ansible 2.7 as minimum version |
225 |
| - # - name: Set SHA256 facts related to docker-compose (Ansible >= 2.7) |
226 |
| - # set_fact: |
227 |
| - # _docker_compose_checksum: "sha256:https://github.com/docker/compose/releases/download/\ |
228 |
| - # {{ _github_docker_compose.json.tag_name }}/\ |
229 |
| - # docker-compose-{{ ansible_system }}-{{ ansible_architecture }}.sha256" |
230 |
| - # when: ansible_version.full is version_compare('2.7', '>=') |
| 249 | + - name: Set SHA256 facts related to docker-compose |
| 250 | + set_fact: |
| 251 | + _docker_compose_checksum: "sha256:{{ _github_docker_compose_shasum.stdout | \ |
| 252 | + regex_replace('^([0-9a-zA-Z]*)[\\s\\t]+.+', '\\1') }}" |
231 | 253 |
|
232 | 254 | - name: Install docker-compose {{ _docker_compose_version }} (Linux)
|
233 | 255 | become: true
|
|
0 commit comments