- name: setup mojo repo hosts: prod tasks: - name: print hostname command: hostname register: hostname - debug: msg="{{ hostname.stdout }}" - name: try to update directory shell: cd /home/josiah/mojojojo-bot && git pull register: result ignore_errors: True - name: if the folder doesn't exist, clone from remote shell: cd /home/josiah/ && git clone http://git.awful.club/hosted/mojojojo-bot.git when: result is failed - name: Deploy mojo webclient hosts: prod vars_files: - vault-vars-mojo.yml tasks: - name: Build from the latest version shell: cd /home/josiah/mojojojo-bot/mojo-web && docker build -t mojo-web -f dockerfile . - name: Check if there are any existing mojo-web containers running and kill them # this has to be a shell because command: isn't interactive shell: docker ps | grep 'mojo-web' | awk '{print $1}' | xargs docker kill ignore_errors: True - name: Run the newly built docker container command: docker container run -e "SLACK_BOT_TOKEN={{ VAULT_SLACK_BOT_TOKEN }}" --restart "always" -d --mount type="bind",source="/mnt/volume_sfo2_znc",target=/shared/ mojo-web - name: Deploy mojo rtmclient hosts: prod vars_files: - vault-vars-mojo.yml tasks: - name: Build from the latest version shell: cd /home/josiah/mojojojo-bot/mojo-rtm && docker build -t mojo-rtm -f dockerfile . - name: Check if there are any existing mojo-rtm containers running and kill them # this has to be a shell because command: isn't interactive shell: docker ps | grep 'mojo-rtm' | awk '{print $1}' | xargs docker kill ignore_errors: True - name: Run the newly built docker container command: docker container run -e "SLACK_BOT_TOKEN={{ VAULT_SLACK_BOT_TOKEN }}" --restart "always" -d --mount type="bind",source="/mnt/volume_sfo2_znc",target=/shared/ mojo-rtm