community.general.android_sdk module – Manages Android SDK packages
Note
This module is part of the community.general collection (version 10.2.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.android_sdk
.
New in community.general 10.2.0
Synopsis
Manages Android SDK packages.
Allows installation from different channels (stable, beta, dev, canary).
Allows installation of packages to a non-default SDK root directory.
Requirements
The below requirements are needed on the host that executes this module.
java
>= 17sdkmanager
Command line tool for installing Android SDK packages.
Parameters
Parameter |
Comments |
---|---|
If this is set to Choices:
|
|
Indicates what channel must Choices:
|
|
A name of an Android SDK package (for instance, |
|
Provides path for an alternative directory to install Android SDK packages to. By default, all packages are installed to the directory where |
|
Indicates the desired package(s) state.
Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
For some of the packages installed by
sdkmanager
is it necessary to accept licenses. Usually it is done through command line prompt in a form of a Y/N question when a licensed package is requested to be installed. If there are several packages requested for installation and at least two of them belong to different licenses, thesdkmanager
tool will prompt for these licenses in a loop. In order to install packages, the module must be able to answer these license prompts. Currently, it is only possible to answer one license prompt at a time, meaning that instead of installing multiple packages as a single invocation of thesdkmanager --install
command, it will be done by executing the command independently for each package. This makes sure that at most only one license prompt will need to be answered. At the time of writing this module, asdkmanager
‘s package may belong to at most one license type that needs to be accepted. However, if this changes in the future, the module may hang as there might be more prompts generated by thesdkmanager
tool which the module will not be able to answer. If this becomes the case, file an issue and in the meantime, consider accepting all the licenses in advance, as it is described in thesdkmanager
documentation, for instance, using the ansible.builtin.command module.
See Also
See also
- sdkmanager tool documentation
Detailed information of how to install and use sdkmanager command line tool.
Examples
- name: Install build-tools;34.0.0
community.general.android_sdk:
name: build-tools;34.0.0
accept_licenses: true
state: present
- name: Install build-tools;34.0.0 and platform-tools
community.general.android_sdk:
name:
- build-tools;34.0.0
- platform-tools
accept_licenses: true
state: present
- name: Delete build-tools;34.0.0
community.general.android_sdk:
name: build-tools;34.0.0
state: absent
- name: Install platform-tools or update if installed
community.general.android_sdk:
name: platform-tools
accept_licenses: true
state: latest
- name: Install build-tools;34.0.0 to a different SDK root
community.general.android_sdk:
name: build-tools;34.0.0
accept_licenses: true
state: present
sdk_root: "/path/to/new/root"
- name: Install a package from another channel
community.general.android_sdk:
name: some-package-present-in-canary-channel
accept_licenses: true
state: present
channel: canary
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A list of packages that have been installed. Returned: when packages have changed Sample: |
|
A list of packages that have been removed. Returned: when packages have changed Sample: |