-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.yml
54 lines (50 loc) · 1.82 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
# tasks file for android
- name: Run specified tasks on current platform
include: "{{ ansible_os_family }}.yml"
- name: Check whether adb command exists
stat: path="{{ android_home }}/platform-tools/adb"
register: stat_adb_command
changed_when: no
- name: Check whether lock file for extra components exists
stat: path="{{ android_extra_components_lockpath }}"
register: stat_extra_components_lockpath
changed_when: no
- block:
- name: Ensure a directory for licenses
file:
path: "{{ android_home }}/licenses"
state: 'directory'
- name: Copy license files
copy:
src: "{{ android_license_src_dir }}"
dest: "{{ android_home }}/licenses"
when: android_license_src_dir is defined
become: yes
when: (not stat_adb_command.stat.exists) or
((android_extra_components|length != 0) and (not stat_extra_components_lockpath.stat.exists))
- name: Check repositories.cfg
stat:
path: "{{ ansible_env.HOME }}/.android/repositories.cfg"
register: stat_repositories_cfg
changed_when: no
- block:
- name: Create .android directory
file:
path: "{{ ansible_env.HOME }}/.android"
state: directory
- name: Create repositories.cfg
file:
path: "{{ ansible_env.HOME }}/.android/repositories.cfg"
state: touch
when: not stat_repositories_cfg.stat.exists
- name: Install platform tool
command: "{{ android_home }}/tools/bin/sdkmanager platform-tools"
when: not stat_adb_command.stat.exists
- block:
- name: Install extra components
command: "{{ android_home }}/tools/bin/sdkmanager {{ item }}"
with_items: "{{ android_extra_components }}"
- name: Create lock file for extra components
file: path="{{ android_extra_components_lockpath }}" state="touch"
when: (android_extra_components|length != 0) and (not stat_extra_components_lockpath.stat.exists)