cimon-io.asdf
Ansible ASDF Role
This is an Ansible Role that installs the asdf version manager along with its plugins.
Requirements
No special requirements.
Role Variables
Below are the available variables along with their default values (check defaults/main.yml
). The variable asdf_plugins
lists the plugins to be installed:
asdf_plugins: []
You can specify each plugin like this:
asdf_plugins:
- name: "erlang" # the name of the plugin
repository: "" # the plugin's repository (optional)
versions: # list of versions to install
- 18.3
- 20.1
global: 20.1 # optional: set a global version
The variable asdf_user
sets the user for whom the role is installed:
asdf_user: "deploy"
By default, the role installs asdf
and its plugins in the ~/.asdf
directory for the specified user. You can change this by setting asdf_dir
, which is helpful when multiple users need to access the installed plugins and tools (like a deploy user, an app user, and developers).
asdf_dir: "/opt/asdf-vm"
The variable asdf_legacy_version_file
indicates if plugins that support this feature should read version files used by other version managers (like .ruby-version
for Ruby's rbenv).
asdf_legacy_version_file: "yes"
The variable asdf_plugin_dependencies
lists the packages required for the plugins (see defaults/main.yml
):
asdf_plugin_dependencies: []
The variable asdf_version
sets the git tag for asdf:
asdf_version: v0.9.0
Dependencies
There are no dependencies.
Example Playbook
Here’s a simple example of a playbook:
- hosts: web
roles:
- role: ansible-role-asdf
asdf_plugins:
- name: "erlang"
versions: ["18.3", "20.1"]
global: "20.1"
- name: "elixir"
versions: "1.3.1"
For a more complex example using CentOS:
- name: install asdf
hosts: '*'
become: true
vars:
asdf_version: v0.6.2
asdf_user: ci
asdf_plugins:
- name: erlang
- name: elixir
- name: nodejs
versions: ["8.11.3"]
global: "8.11.3"
roles:
- asdf
To install asdf in a shared directory that the developers
group can access:
- name: install asdf
hosts: '*'
become: true
vars:
asdf_user: deploy
asdf_group: developers
asdf_dir: /opt/asdf-vm
asdf_plugins:
- name: erlang
- name: elixir
- name: nodejs
versions: ["8.11.3"]
global: "8.11.3"
roles:
- asdf
License
This project is licensed under the MIT License.
Install asdf (https://github.com/asdf-vm/asdf.git) and plugins
ansible-galaxy install cimon-io.asdf