GithubHelp home page GithubHelp logo

ansible-role-asdf's People

Contributors

aairey avatar dsander avatar katglin avatar lackac avatar merifri avatar reachfh avatar taiansu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-asdf's Issues

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

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...

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

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.

'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.

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

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.