blob: 46a2d7a74eccb2b8c064dd9a3c493925cd3cf0c6 [file] [log] [blame]
Zack Williams04575aa2022-03-19 21:51:44 -07001---
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 Williamsa3ecef42022-03-19 21:51:44 -070013# 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 Williams04575aa2022-03-19 21:51:44 -070022# repo
23- name: Download repo launcher
24 get_url:
25 url: "{{ devtools_repo_url }}"
26 checksum: "{{ devtools_repo_checksum }}"
Zack Williamsa3ecef42022-03-19 21:51:44 -070027 dest: "{{ devtools_dist_dir }}/repo.b64"
Zack Williams04575aa2022-03-19 21:51:44 -070028
29- name: Decode, fix shebang, and make repo launcher executable
30 shell:
31 cmd: |
Zack Williamsa3ecef42022-03-19 21:51:44 -070032 base64 --decode "{{ devtools_dist_dir }}/repo.b64" > \
33 "{{ devtools_dist_dir }}/repo"
Zack Williams04575aa2022-03-19 21:51:44 -070034 # force repo launcher to use python3 - not needed if python-is-python3 installed
Zack Williamsa3ecef42022-03-19 21:51:44 -070035 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 Williams04575aa2022-03-19 21:51:44 -070038 chmod 755 /usr/local/bin/repo
39 creates: /usr/local/bin/repo
40
Zack Williams04575aa2022-03-19 21:51:44 -070041- 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 Williamsa3ecef42022-03-19 21:51:44 -070046
47# cleanup
48- name: Delete devtools dist dir
49 when: devtools_delete_dist
50 file:
51 path: "{{ devtools_dist_dir }}"
52 state: absent