ansible-role-asdf's People
Forkers
cogini uberbrodt idabmat jackjoe markosamuli krlsdu micero chauncey-garrett the-container-store lostapathy nomasprime rendhalver dsander flaviohrocha 100starlings floatingman gkuga aairey saulrh mbrannigan waewoo kmptkp stephangarland eliberty lambdaclass sbezugliy amozoss plainice maful wihrt pythoninthegrass charlesaracil vkhamsaoansible-role-asdf's Issues
Install from local `.tool-versions` file
Hi,
Anyone else who would like to be able to install any dependencies already declared in a .tool-versions
file outside ansible code? ππ»
Imagine I want to keep my .tool-versions
dependencies up-to-date (for example using Renovate), but let Ansible install them βΒ what would you suggest as the solution?
'set group permissions' task recursively crashes for crystal lang
Within tasks//plugins.yml there is the following set group permissions task:
- name: "set group permissions"
become: yes
file:
path: "{{ asdf_dir }}"
owner: "{{ asdf_user }}"
group: "{{ asdf_group }}"
state: directory
recurse: yes
I am using this to deploy crystal lang via asdf ("https://github.com/asdf-community/asdf-crystal.git") but this task is causing issues once crystal has been installed. This is because within the crystal binary there is a sym link to the parent directory, so when the group permissions task recursively goes through the files it becomes stuck in an infinite loop and crashes.
[server crystal]# pwd
<dir>/.asdf/installs/crystal/1.8.1/lib/crystal
[server crystal]# ll
total 376
lrwxrwxrwx. 1 user group 9 Apr 20 14:12 bin -> ../../bin
lrwxrwxrwx. 1 user group 2 Apr 20 14:12 lib -> ..
-rw-r-----. 1 user group 382312 Apr 20 14:12 libgc.a
fatal: [server]: FAILED! => {"changed": false, "msg": "failed to retrieve selinux context", "path": "<dir>/.asdf/installs/crystal/1.8.1/lib/crystal/../crystal/../crystal/../crystal/../crystal/../crystal/../crystal/../crystal/../" etc etc etc etc
This Ansible file task does have a "follow" option, which by default is "yes", but if set to "No" it does not follow symlinks and the task executes successfully.
- name: "set group permissions"
become: yes
file:
path: "{{ asdf_dir }}"
owner: "{{ asdf_user }}"
group: "{{ asdf_group }}"
state: directory
recurse: yes
follow: no
Would this have any negative effect any other use cases or would this be able to be added as a failsafe? Or perhaps var could be added to toggle this.
Basic example throws error at TASK [ansible-role-asdf : erlang - Install plugin]
I'm trying out this role on an Ubuntu 2022 arm64 and have a very simple playbook:
- hosts: all
name: configure-vm
roles:
- role: ansible-role-asdf
asdf_plugins:
- name: "erlang"
versions: [ "18.3", "20.1" ]
global: "20.1"
- name: "elixir"
versions: "1.3.1"
throws:
...
β TASK [ansible-role-asdf : Create configuration script]
β *************************
β changed: [__]
β
β TASK [ansible-role-asdf : include_tasks]
β ***************************************
β included:
β /Users/driescruyskens/.ansible/roles/ansible-role-asdf/tasks/plugin.yml for
β __ => (item={'name': 'erlang', 'versions': ['18.3', '20.1'],
β 'global': '20.1'})
β included:
β /Users/driescruyskens/.ansible/roles/ansible-role-asdf/tasks/plugin.yml for
β __ => (item={'name': 'elixir', 'versions': '1.3.1'})
β
β TASK [ansible-role-asdf : erlang - Install plugin]
β *****************************
β fatal: [__]: FAILED! => {"changed": true, "cmd": ["/bin/bash",
β "-lc", "asdf plugin-add erlang "], "delta": "0:00:00.017269", "end":
β "2023-05-03 16:07:58.123151", "msg": "non-zero return code", "rc": 127,
β "start": "2023-05-03 16:07:58.105882", "stderr": "/bin/bash: line 1: asdf:
β command not found", "stderr_lines": ["/bin/bash: line 1: asdf: command not
β found"], "stdout": "", "stdout_lines": []}
When I ssh into the server and run asdf plugin-add erlang
manually it installs without problems...
Latest asdf 0.8.0, incomplete installation -- missing .bashrc
Hi,
Unless mistaken, it seems that, with asdf v0.8.0
, the role install is not complete.
Namely, when I ssh (Ubuntu 20.04) and su
to the relevant user, asdf
is not available.
Amending .bashrc
as per https://asdf-vm.com/#/core-manage-asdf?id=add-to-your-shell fixes this.
I could submit a patch if it helps -- let me know ;)
failed: set global app version
While installing erlang and elixir, the role never gets past the step TASK [asdf : set global app versions]
The error is:
failed: [lxd] (item={'name': 'erlang', 'versions': ['25.1']}) => {"ansible_loop_var": "item", "changed": true, "cmd": ["bash", "-lc", "source /etc/profile.d/asdf.sh && asdf global erlang 25.1"], "delta": "0:00:00.182398", "end": "2022-12-07 19:43:49.179097", "item": {"name": "erlang", "versions": ["25.1"]}, "msg": "non-zero return code", "rc": 1, "start": "2022-12-07 19:43:48.996699", "stderr": "/home/foo/.asdf/lib/functions/versions.bash: line 67: /home/foo//home/foo/.tool-versions: No such file or directory", "stderr_lines": ["/home/foo/.asdf/lib/functions/versions.bash: line 67: /home/foo//home/foo/.tool-versions: No such file or directory"], "stdout": "", "stdout_lines": []}
failed: [lxd] (item={'name': 'elixir', 'versions': ['1.14']}) => {"ansible_loop_var": "item", "changed": true, "cmd": ["bash", "-lc", "source /etc/profile.d/asdf.sh && asdf global elixir 1.14"], "delta": "0:00:00.151380", "end": "2022-12-07 19:43:49.384590", "item": {"name": "elixir", "versions": ["1.14"]}, "msg": "non-zero return code", "rc": 1, "start": "2022-12-07 19:43:49.233210", "stderr": "/home/foo/.asdf/lib/functions/versions.bash: line 67: /home/foo//home/foo/.tool-versions: No such file or directory", "stderr_lines": ["/home/foo/.asdf/lib/functions/versions.bash: line 67: /home/foo//home/foo/.tool-versions: No such file or directory"], "stdout": "", "stdout_lines": []}
Notice the doubling of the path in /home/foo//home/foo/.tool-versions
. This may (or may not!) be related to the fact that export ASDF_DEFAULT_TOOL_VERSIONS_FILENAME="/home/foo/.tool-versions"
gets written to /etc/profile.d/asdf.sh
(whereas the var name suggests that it should be ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=".tool-versions"
, thereby triggering the path-doubling). Changing that manually doesn't help as it gets overwritten on every ansible run.
The relevant part of my vars section:
asdf_user: foo
asdf_group: foo
asdf_version: "v0.10.2"
asdf_plugins:
- name: erlang
versions: ["25.1"]
global: "25.1"
- name: elixir
versions: ["1.14"]
global: "1.14"
Note that it uses asdf v0.10.2 versus v0.8.1 in defaults/main.yml
.
Finally the role is just called with the role name (and works fine until the task setting globals), nothing special to show.
NodeJS plugin installation fails
Fails with error:
TASK [cimon-io.asdf : import Node.js keys to keyring] *************************************************************************
fatal: [toolbox]: FAILED! => changed=true
cmd:
- bash
- -lc
- /home/user/.asdf/plugins/nodejs/bin/import-release-team-keyring
delta: '0:00:00.048110'
end: '2022-07-12 00:33:52.139414'
msg: non-zero return code
rc: 127
start: '2022-07-12 00:33:52.091304'
stderr: 'bash: line 1: /home/user/.asdf/plugins/nodejs/bin/import-release-team-keyring: No such file or directory'
stderr_lines: <omitted>
stdout: ''
stdout_lines: <omitted>
That script does indeed no longer come installed with asdf
.
I believe these tasks are no longer needed:
https://github.com/cimon-io/ansible-role-asdf/blob/master/tasks/plugins/nodejs.yml#L22-L50
removed them and it now works.
This was changed in asdf
in Nov 2021.
asdf-vm/asdf-nodejs@ee8daa2
Execution error: Task not started yet. Exiting...
I've a bit of an odd configuration, I realise. Here's the trace.
- asdf-pkg-mgr:
user: dayz
plugins:
- name: "neko" # a plugin name
repository: "https://github.com/asdf-community/asdf-neko.git" # a plugin repository, optional
versions:
- 2.3.0 # a list of versions to install
global: 2.3.0
ββΌ starting run
β β running frecklet: /mnt/dat/i/prj/haxe/published/stx_workspace/asdf.frecklet (on: localhost)SYSTEM MSG: [WARNING]: Skipping plugin (/mnt/dat/i/prj/haxe/published/stx_workspace/.local/ stx/o/freckles/envs/virtualenv/freckles/lib/python3.10/site- packages/ansible/plugins/filter/core.py) as it seems to be invalid: cannot import name 'environmentfilter' from 'jinja2.filters' (/mnt/dat/i/prj/haxe/publ ished/stx_workspace/.local/stx/o/freckles/envs/virtualenv/freckles/lib/python3. 10/site-packages/jinja2/filters.py) [WARNING]: Skipping plugin (/mnt/dat/i/prj/haxe/published/stx_workspace/.local/ stx/o/freckles/envs/virtualenv/freckles/lib/python3.10/site- packages/ansible/plugins/filter/mathstuff.py) as it seems to be invalid: cannot import name 'environmentfilter' from 'jinja2.filters' (/mnt/dat/i/prj/haxe/publ ished/stx_workspace/.local/stx/o/freckles/envs/virtualenv/freckles/lib/python3. 10/site-packages/jinja2/filters.py)
β ββΌ running frecklet: /mnt/dat/i/prj/haxe/published/stx_workspace/asdf.frecklet (on: localhost)
β β ββΌ starting Ansible run
β β β ββΌ install plugins
β β β β ββΌ neko
β β β β β β msg: non-zero return code
β β β β β β error: stderr: Plugin named neko already added
β β β β β β°βΌ failed (ignored)
β β β β β msg: All items completed
β β β β β°βΌ failed (ignored)
β β β β°βΌ ok
β β β error: Execution error: Task not started yet. Exiting...
β β β°βΌ failed
β β°βΌ failed
β°βΌ failed
Outdated version v1.0.1 in Ansible galaxy
Hi,
Would you be able to import the latest changes to galaxy https://galaxy.ansible.com/cimon-io/asdf, the current version fails at "/home/$USER/.asdf/plugins/nodejs/bin/import-release-team-keyring" step which has been fixed by the latest commit 51a42a8.
Thanks
New release
Hi.
First off thank you for publishing your role, it's definitely the best asdf role on ansible galaxy.
I have been having trouble getting version 1.0.0 of your role from ansible galaxy to work.
I am using ansible 4.8.0 with ansible-core 2.11.6 running under python 3.10.0
$ ansible --version
ansible [core 2.11.6]
config file = /home/pete/Dev/ansible-desktop/ansible.cfg
configured module search path = ['/home/pete/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/pete/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/ansible
ansible collection location = /home/pete/.ansible/collections:/usr/share/ansible/collections
executable location = /home/pete/.asdf/installs/python/3.10.0/bin/ansible
python version = 3.10.0 (default, Nov 9 2021, 17:57:00) [GCC 10.3.0]
jinja version = 3.0.2
libyaml = True
I have a playbook with just your role and I only have the following vars set.
asdf_version: "v0.8.1"
asdf_user: "pete"
Everything runs file till it starts installing plugins:
It fails trying to setup nodejs keyring because I don't have the plugin installed.
nodejs is not set in asdf_plugins
but it's still trying to run the nodejs tasks.
TASK [cimon-io.asdf : install plugins] ******************************************************************************************************
TASK [cimon-io.asdf : set vars] *************************************************************************************************************
ok: [localhost] => changed=false
ansible_facts:
has_nodejs_plugin: ("nodejs" in "[]")
TASK [cimon-io.asdf : import nodejs keys] ***************************************************************************************************
included: /home/pete/.ansible/roles/cimon-io.asdf/tasks/import-nodejs-keyring.yml for localhost
TASK [cimon-io.asdf : set vars] *************************************************************************************************************
ok: [localhost] => changed=false
ansible_facts:
asdf_nodejs_keyring: /home/pete/.asdf/keyrings/nodejs
TASK [cimon-io.asdf : create keyring for Node.js keys] **************************************************************************************
ok: [localhost] => changed=false
gid: 1000
group: pete
mode: '0700'
owner: pete
path: /home/pete/.asdf/keyrings/nodejs
size: 4096
state: directory
uid: 1000
TASK [cimon-io.asdf : import Node.js keys to keyring] ***************************************************************************************
fatal: [localhost]: FAILED! => changed=true
cmd:
- bash
- -lc
- /home/pete/.asdf/plugins/nodejs/bin/import-release-team-keyring
delta: '0:00:00.027400'
end: '2021-11-11 19:06:35.188451'
msg: non-zero return code
rc: 127
start: '2021-11-11 19:06:35.161051'
stderr: 'bash: line 1: /home/pete/.asdf/plugins/nodejs/bin/import-release-team-keyring: No such file or directory'
stderr_lines: <omitted>
stdout: |-
/home/pete/bin already in PATH
/home/pete/.local/bin already in PATH
stdout_lines: <omitted>
PLAY RECAP **********************************************************************************************************************************
localhost : ok=11 changed=0 unreachable=0 failed=1 skipped=2 rescued=0 ignored=0
If I use the latest version from your repo it all work great so could you please publish a new release?
Thanks in advance.
Pete.
Support for other shells (zsh, ...)
Quick question: is there a reason for:
[ -n "$BASH_VERSION" ] || return 0
in the init file? This prevents loading of asdf when zsh is used. According to: https://github.com/asdf-vm/asdf/blob/master/README.md#setup zsh at least would also work when sourcing the asdf.sh
file.
Might be neat to also support fish, seeing as asdf supports that too...
Should only be minor changes, but happy to send a pull request if you want.
Add the capability to delete versions
The capability to delete versions would be useful. i.e.,
- name: nodejs
repository: "https://github.com/asdf-vm/asdf-nodejs"
versions:
- 10.17.0
- 12.13.1
delete_versions:
- 8.16.2 # v8 EOL 2019-12-31
Error: One or more supplied key could not be found in the database.
Hey,
Thank you for open source this role.
I'm trying to install elixir and erlang on a docker container (Ubuntu)
But I'm getting this error: One or more supplied key could not be found in the database.
- hosts: docker_container
become: true
gather_facts: false
roles:
- role: ansible-role-asdf
asdf_plugins:
- name: "erlang"
- name: "elixir"
pre_tasks:
- name: Installing Python3
raw: apt-get update && apt-get -y install python3-minimal
# action: setup will gather facts
- name: Gathering Facts
action: setup
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.