This is my setup. I have created a scm type git project and have my code there. My playbook is on that repository as well and it contains docker build and run command. In order to build my docker I should execute my build command where my docker file is located (in this case where ansible project clones /var/lib/awx/project). I want to get that path to my ansible playbook.
My playbook looks like this:
---
- hosts: all
sudo: yes
remote_user: ubuntu
gather_facts: no
tasks:
- name : build docker
become: yes
become_user: root
command : docker build -t "test-api" .
- name: run docker
become: yes
become_user: root
command : docker run -it -p 80:9001 --name api test-api
How can i achieve this?