setup.yml 949 B

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. - name: Ensure dependencies are present.
  3. apt:
  4. name:
  5. - apt-transport-https
  6. - gnupg2
  7. - build-essential
  8. state: present
  9. - name: Add Nodesource apt key.
  10. apt_key:
  11. url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280
  12. id: "68576280"
  13. state: present
  14. - name: Add NodeSource repositories for Node.js.
  15. apt_repository:
  16. repo: "{{ item }}"
  17. state: present
  18. with_items:
  19. - "deb https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
  20. - "deb-src https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
  21. register: node_repo
  22. - name: Update apt cache if repo was added.
  23. apt: update_cache=yes
  24. when: node_repo.changed
  25. tags: ['skip_ansible_lint']
  26. - name: Ensure Node.js and npm are installed.
  27. apt:
  28. name: "nodejs={{ nodejs_version|regex_replace('x', '') }}*"
  29. state: present