ansible-role-nodejs icon indicating copy to clipboard operation
ansible-role-nodejs copied to clipboard

RFE: Support custom URLs for mirrors

Open b00ga opened this issue 3 years ago • 0 comments

We mirror a lot of repos inside our organization to save bandwidth. It would be nice to have an option with this role to override the default nodesource repos.

I've looked at the code and started implementing something, so far just on the RPM side. The way to do the platform specific variables is significantly more brain twisting than I was expecting, so feedback on my approach so far is greatly appreciated. I'm working in this branch of a fork of this repo: https://github.com/b00ga/ansible-role-nodejs/tree/mirrorsupport

The following vagrant config can be used to create an AlmaLinux 8 mirror server with EL/Fedora/Debian/Ubuntu nodesource 16.x packages: https://github.com/b00ga/vagrant-mirror

Starting out by just testing against the vagrant box itself, before creating a more complex vagrant multimachine config to test different distros/versions. Currently testing by cloning fork/branch into a roles dir, symlinking it as geerlinguy.nodejs and then using a playbook like:

---
- hosts: all
  become: yes

  tasks:
  - name: install nodejs
    import_role:
      name: geerlinguy.nodejs
    vars:
      - nodejs_version: '16.x'
        nodejs_nodesource_custom_baseurl: http://localhost/reposync/nodesource-16-el8-x86_64/

Hopefully that makes sense. Feedback about this enhancement and current approach greatly appreciated.

b00ga avatar Aug 26 '22 03:08 b00ga