This won't work for you?

$ sudo bash -c 'source /etc/lsb-release; echo $DISTRIB_CODENAME'
focal



On 27.09.21 19:14, 'Neil Young' via Ansible Project wrote:
Exactly. which source gives nothing.

If I run the command at non-elevated level I get useful results and the environment is filled

source /etc/lsb-release

echo $DISTRIB_CODENAME

bionic


sudo source /etc/lsb-release

[sudo] password for ubuntu:

sudo: source: command not found


So it is a matter of elevated access level, but I just don't know how to run that at lower level...



Sandip Bhattacharya schrieb am Montag, 27. September 2021 um 19:11:33 UTC+2:

    source is a bash built-in command. There is no executable. You can
    try "bash -c 'source /etc/lsb-release' "


    HTH,
       Sandip


    On 27.09.21 19:04, 'Neil Young' via Ansible Project wrote:
    Hi,

    I'm banging my head trying to make this simple statement work:

    - name: Get Ubuntu version definitions
      ansible.builtin.shell: source /etc/lsb-release

    But whatever I do I get this:

    TASK [Get Ubuntu version definitions]
    
****************************************************************************************************************

    fatal: [server1]: FAILED! => {"changed": true, "cmd": "source
    /etc/lsb-release", "delta": "0:00:00.002579", "end": "2021-09-27
    17:02:32.565396", "msg": "non-zero return code", "rc": 127,
    "start": "2021-09-27 17:02:32.562817", "stderr": "/bin/sh: 1:
    source: not found", "stderr_lines": ["/bin/sh: 1: source: not
    found"], "stdout": "", "stdout_lines": []}


    This is most likely because I run at elevated permissions.

    What can I do in order to make this work?

    TIA

-- You received this message because you are subscribed to the Google
    Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected].
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/ansible-project/fe78c00b-ac97-4960-a70b-449b0e1fcf41n%40googlegroups.com
    
<https://groups.google.com/d/msgid/ansible-project/fe78c00b-ac97-4960-a70b-449b0e1fcf41n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- https://blog.sandipb.net <https://blog.sandipb.net>
    https://twitter.com/sandipb  <https://twitter.com/sandipb>

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ac9b0dba-6437-4332-9901-2f4089e1063fn%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/ac9b0dba-6437-4332-9901-2f4089e1063fn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
https://blog.sandipb.net
https://twitter.com/sandipb

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2cd55231-de3e-9829-97a4-50ff17802345%40showmethesource.org.

Reply via email to