Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
Want be able to source ~/.profile
30 views
Skip to first unread message
pranay varankar
unread,
Oct 12, 2018, 3:27:47 AM
10/12/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi,
I have added some export task in ~/.profile file & its added but not able to source ~/.profile in remote host.
FYI
- name: Set .profile
lineinfile:
path: /root/.profile
line: export PROMPT_COMMAND='history -a >(logger -t "cmdlog[$USER:$PWD] $SSH_CLIENT")'
tags:
- PROMPT_CMD
- name: source .profile
shell: source /root/.profile
args:
executable: /bin/bash
tags:
- PROMPT_CMD
pranay varankar
unread,
Oct 12, 2018, 9:49:16 AM
10/12/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi,
Any update on this?
eric.b....@nasa.gov
unread,
Oct 12, 2018, 10:47:06 AM
10/12/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Each task inside your play is run though a completely separate SSH connection. Sourcing your .profile in one task will have no effect on other tasks.
You can verify this with the -vvv flag.
--EbH
Dick Visser
unread,
Oct 12, 2018, 10:50:09 AM
10/12/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Looks like you're trying to set some environment variable in one task,
and trying to use that in another task.
That won't work. You should define such variables in each task:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_environment.html
Dick
On Fri, 12 Oct 2018 at 15:49, pranay varankar <
varanka...@gmail.com
> wrote:
>
> Hi,
>
> Any update on this?
>
> --
> 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/0e39bb3a-e769-45ba-b4a6-a407d1a67c70%40googlegroups.com
.
> For more options, visit
https://groups.google.com/d/optout
.
aakanks...@webdunia.net
unread,
Oct 18, 2018, 4:45:40 AM
10/18/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
I think this code is useful for you ,try it.
- name: "create java.sh file with permissions."
file:
path: "/etc/profile.d/java.sh"
state: touch
mode: 0755
- name: "create java.sh file with content"
copy:
dest: "/etc/profile.d/java.sh"
content: |
export JRE_HOME={{ destination_folder }}java/jre
export PATH=$PATH:$JRE_HOME/bin
export JAVA_HOME={{ destination_folder }}java
export JAVA_PATH=$JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin
export JBOSS_HOME={{ destination_folder }}adobe/adobe_experience_manager_Forms/jboss
export PATH=$PATH:$JBOSS_HOME/bin/init.d
ignore_error: true
- shell: "source /etc/profile.d/java.sh"
name: "Configure Java by java.sh"
Reply all
Reply to author
Forward
0 new messages