Skip to content

Commit

Permalink
Fix autorun
Browse files Browse the repository at this point in the history
  • Loading branch information
myurasov-nv committed May 26, 2024
1 parent 2ee08a2 commit 9b48d4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 33 deletions.
18 changes: 14 additions & 4 deletions src/ansible/roles/isaac/tasks/autorun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@
# limitations under the License.
# endregion

- name: Make sure uploads directory exists
file:
path: "{{ uploads_dir }}"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: 0755
tags:
- __autorun

- name: Upload autorun script
copy:
src: /app/uploads/autorun.sh
dest: /home/{{ ansible_user }}/uploads/autorun.sh
src: "/app/uploads/autorun.sh"
dest: "{{ uploads_dir }}/autorun.sh"
mode: 0755
become_user: "{{ ansible_user }}"
ignore_errors: true
Expand All @@ -26,9 +36,9 @@

- name: Start Application
shell: |
if [ -f /home/{{ ansible_user }}/uploads/autorun.sh ]; then
if [ -f {{ uploads_dir }}/autorun.sh ]; then
# if autorun script is present, run it
CMD="/home/{{ ansible_user }}/uploads/autorun.sh"
CMD="{{ uploads_dir }}/autorun.sh"
else
# otherwise, run Isaac Sim with default options
CMD="/home/{{ ansible_user }}/Desktop/isaacsim.sh"
Expand Down
29 changes: 0 additions & 29 deletions src/ansible/roles/isaac/tasks/isaac_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,32 +71,3 @@
tags:
- never
- cleanup

- name: Start Application
shell: |
if [ -f /home/{{ ansible_user }}/uploads/autorun.sh ]; then
# if autorun script is present, run it
CMD="/home/{{ ansible_user }}/uploads/autorun.sh"
else
# otherwise, run Isaac Sim with default options
CMD="/home/{{ ansible_user }}/Desktop/isaacsim.sh"
fi
chmod +x "$CMD"
export DISPLAY=:0
# wait for display to become available
while ! xset q > /dev/null 2>&1 ; do
echo "Waiting for the display to become available..."
sleep 1
done
# run in a terminal on desktop
gnome-terminal -- bash -c "$CMD; exec bash"
args:
chdir: /home/{{ ansible_user }}/Desktop
become_user: "{{ ansible_user }}"
when: ngc_api_key != "none"
tags:
- skip_in_image
- on_stop_start
- autorun

0 comments on commit 9b48d4a

Please sign in to comment.