Zack Williams | 04575aa | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 1 | --- |
| 2 | # devtools tasks/main.yml |
| 3 | # |
| 4 | # SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org> |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | - name: include OS-specific vars |
| 8 | include_vars: "{{ ansible_os_family }}.yml" |
| 9 | |
| 10 | - name: include OS-specific tasks |
| 11 | include_tasks: "{{ ansible_os_family }}.yml" |
| 12 | |
Zack Williams | a3ecef4 | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 13 | # create devtools dist dir |
| 14 | - name: create devtools dist dir |
| 15 | file: |
| 16 | path: "{{ devtools_dist_dir }}" |
| 17 | state: directory |
| 18 | owner: root |
| 19 | group: root |
| 20 | mode: 0755 |
| 21 | |
Zack Williams | 04575aa | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 22 | # repo |
| 23 | - name: Download repo launcher |
| 24 | get_url: |
| 25 | url: "{{ devtools_repo_url }}" |
| 26 | checksum: "{{ devtools_repo_checksum }}" |
Zack Williams | a3ecef4 | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 27 | dest: "{{ devtools_dist_dir }}/repo.b64" |
Zack Williams | 04575aa | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 28 | |
| 29 | - name: Decode, fix shebang, and make repo launcher executable |
| 30 | shell: |
| 31 | cmd: | |
Zack Williams | a3ecef4 | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 32 | base64 --decode "{{ devtools_dist_dir }}/repo.b64" > \ |
| 33 | "{{ devtools_dist_dir }}/repo" |
Zack Williams | 04575aa | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 34 | # force repo launcher to use python3 - not needed if python-is-python3 installed |
Zack Williams | a3ecef4 | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 35 | sed -i.bak 's"#!/usr/bin/env python"#!/usr/bin/env python3"' \ |
| 36 | "{{ devtools_dist_dir }}/repo" |
| 37 | cp "{{ devtools_dist_dir }}/repo" /usr/local/bin/repo |
Zack Williams | 04575aa | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 38 | chmod 755 /usr/local/bin/repo |
| 39 | creates: /usr/local/bin/repo |
| 40 | |
Zack Williams | 04575aa | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 41 | - name: Install additional devtools |
| 42 | include_tasks: "{{ dt_inst_item }}.yml" |
| 43 | loop: "{{ devtools_install | flatten(levels=1) }}" |
| 44 | loop_control: |
| 45 | loop_var: dt_inst_item |
Zack Williams | a3ecef4 | 2022-03-19 21:51:44 -0700 | [diff] [blame] | 46 | |
| 47 | # cleanup |
| 48 | - name: Delete devtools dist dir |
| 49 | when: devtools_delete_dist |
| 50 | file: |
| 51 | path: "{{ devtools_dist_dir }}" |
| 52 | state: absent |