Giter VIP home page Giter VIP logo

Comments (6)

conorsch avatar conorsch commented on July 17, 2024

An interesting request. I tend to prefer judicious use of become: at the task-level, but it seems to go against the grain of most of the Ansible community. Can you explain your use case in more depth, @coreoas?

from stouts.openvpn.

sean-abbott avatar sean-abbott commented on July 17, 2024

Well, as of right now, I have to run the whole role as root, because within the role, things like the package installs aren't run with "become".

I agree with you; I'd rather just the tasks that need privileges use "become", but, when calling the role (if I want to not edit the role, which I don't), I had to use become at the play level because:

TASK [Stouts.openvpn : Install requirements (Debian)] **************************
failed: [54.210.29.69] (item=[u'openvpn', u'udev', u'openssl', u'zip']) => {"cmd": "apt-get update", "failed": true, "item": ["openvpn", "udev", "openssl", "zip"], "msg": "W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)\nE: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\nE: Unable to lock directory /var/lib/apt/lists/\nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)\nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)\nE: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)\nE: Unable to lock the administration directory (/var/lib/dpkg/), are you root?", "rc": 100, "stderr": "W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)\nE: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\nE: Unable to lock directory /var/lib/apt/lists/\nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)\nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)\nE: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)\nE: Unable to lock the administration directory (/var/lib/dpkg/), are you root?\n", "stdout": "", "stdout_lines": []}

from stouts.openvpn.

nkakouros avatar nkakouros commented on July 17, 2024

Is there any benefit in doing this? Is it just a matter of not wanting to add become: yes to the play level?

from stouts.openvpn.

sean-abbott avatar sean-abbott commented on July 17, 2024

My personal experience has been that having a per-task become is better than doing one for the entire play because I have found it is A) more explicit (pythonically, explicit > implicit), and because there are a number of times when it is preferable to not run everything as root. So I don't like the habit of just using "become" at the play level when calling a role.

It is, however, personal preference and I'm sure there are effective arguments on the other side, so .

from stouts.openvpn.

nkakouros avatar nkakouros commented on July 17, 2024

Ok, I 'll see if I can pinpoint the tasks that need become: yes.

from stouts.openvpn.

nkakouros avatar nkakouros commented on July 17, 2024

Actually, looking at the tasks the role runs, 90% of the tasks need to be run as root. If I am wrong, please correct me. I don't think it is worth making the code more verbose and the work hours to implement this.

from stouts.openvpn.

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.