Code Monkey home page Code Monkey logo

Comments (3)

bradmsmith avatar bradmsmith commented on June 19, 2024 3

How I solved this problem:

roles:
  - role: nodesource.node
    become: yes

from ansible-nodejs-role.

conorgil avatar conorgil commented on June 19, 2024

With some additional trial/error, I realized by looking in the role.yml file used for testing that it calls the role and specifies sudo: yes when calling the role instead of having each task within the role define sudo: yes.

I updated my meta/main.yml file to look like this:

dependencies:
  - {
      role: "nodesource.node",
      sudo: yes
    }

and the script worked as expected without error.

I would just close this issue as solved, but it begs the question in my mind: when will we ever not call this role with sudo: yes? If it is required, then would it be easier to just update the tasks/main.yml to put that on each task and then folks do not need to worry about setting it when calling the role?

Thoughts appreciated.

from ansible-nodejs-role.

fubarhouse avatar fubarhouse commented on June 19, 2024

@conorgil I also highly recommend to use this in addition to your recommendation:
sudo_user: "{{ ansible_ssh_user}}".

Running purely as sudo will run commands as root and leave applications unavailable to the default user.

Just because the script passes, it doesn't mean the user is able to access all of these cool tools (without sudo - best practice!).

I would also recommend changing sudo to become and sudo_user to become_user purely because the sudo and sudo_user modules have been deprecated in later releases.

from ansible-nodejs-role.

Related Issues (20)

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.