Spyke

Posts

Ansible, become: yes, and granting access to specific sudo commands without a password

Is there a good way to use the "become: yes" for the needed escalation to sudo for a handful of commands which need it while limiting the user's access to passwordless root? I've added this line to /etc/sudoers.d/$USER

(username) ALL=(ALL:ALL) NOPASSWD: /usr/sbin/omv-upgrade, /usr/sbin/reboot

Which should allow my user to use the omv-upgrade script (which does some apt stuff) without a password prompt for sudo. This allows it to perform the needed apt commands for an upgrade without actually giving full apt access to install whatever. Likewise with reboot, though I'm not sure which command ansible will actually try with these:

    - name: Check if a reboot is required.
      ansible.builtin.stat:
        path: /var/run/reboot-required
        get_md5: no
      register: reboot_required_file

    - name: Reboot the server (if required).
      ansible.builtin.reboot:
      when: reboot_required_file.stat.exists == true

I presume it's that reboot, but maybe it'll try the systemctl one instead. Is there a better method to give the user the needed passwordless sudo actions without the security risk of opening everything up to that user (which I don't want to do at all)

View original on beehaw.org
6
support·Beehaw SupportbyNitrousoxide

Lemmy Follow Bookmarklet

I made a bookmarklet (with some ChatGPT help to troubleshoot) which will redirect you to your own instance’s URL for a foreign Lemmy community to easily subscribe to it.

This will not correctly redirect you if you are in a topic already. It will only work if you are on the base community page. If someone wants to tweak it (or redo it entirely) to work in a bigger variety of instances please feel free. My skills with JavaScript are… minimal.

Lemmy Follow Bookmarklethttps://gist.github.com/Nitrousoxide/0ad922d431749d6e4f7c9a35d40da4dcOpen linkView original on beehaw.org
6
lemmyworld·Lemmy.World AnnouncementsbyNitrousoxide

Lemmy Follow Bookmarklet

I made (with some ChatGPT help to troubleshoot) a bookmarklet which will redirect you to your own instance's URL for a foreign Lemmy community to easily subscribe to it.

This will not correctly redirect you if you are in a topic already. It will only work if you are on the base community page. If someone wants to tweak it (or redo it entirely) to work in a bigger variety of instances please feel free. My skills with JavaScript are... minimal.

https://gist.github.com/Nitrousoxide/0ad922d431749d6e4f7c9a35d40da4dcOpen linkView original on beehaw.org
21

You reached the end