Line in file

17 views
Skip to first unread message

Jibsan Joel Rosa Toirac

unread,
Jul 11, 2019, 10:32:19 AM7/11/19
to Ansible Project
Hello to everyone. I have a big problem. I need to add a line text to environment file on Ubuntu. Here is the file content:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

and I want to insert the following lines at the end but in the same line

/usr/lib/jvm/java-8-openjdk-amd64/jre/bin

/usr/lib/jvm/java-8-openjdk-amd64/bin

So it should look like this

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:/usr/lib/jvm/java-8-openjdk-amd64/bin"

Please any help with this will be awesome hehehehe.

Kunalsing Thakur

unread,
Jul 11, 2019, 10:38:20 AM7/11/19
to Ansible Project
name: adding extra path
shell: PATH=$PATH:{{item}}
with_items:
- /usr/lib/jvm/java-8-openjdk-amd64/jre/bin
- /usr/lib/jvm/java-8-openjdk-amd64/bin

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/40b82b91-ae76-4eea-b62f-e077f4c61814%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Kunalsing Thakur

unread,
Jul 11, 2019, 10:38:57 AM7/11/19
to Ansible Project
missed export
name: adding extra path
shell: PATH=$PATH:{{item}} && export PATH

with_items:
- /usr/lib/jvm/java-8-openjdk-amd64/jre/bin
- /usr/lib/jvm/java-8-openjdk-amd64/bin

Jibsan Joel Rosa Toirac

unread,
Jul 11, 2019, 11:22:53 AM7/11/19
to Ansible Project
I already played it but it doesn't do anything.

Here is the out from the prompt

TASK [ansible-integro-vistualizacion : adding extra path] ************************************************************************************
changed: [192.168.14.96] => (item=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin)
changed: [192.168.14.96] => (item=/usr/lib/jvm/java-8-openjdk-amd64/bin)
Reply all
Reply to author
Forward
0 new messages