diff --git a/aws/playbooks/update-service.yml b/aws/playbooks/update-service.yml new file mode 100644 index 0000000..4326a5f --- /dev/null +++ b/aws/playbooks/update-service.yml @@ -0,0 +1,49 @@ +# This playbooks basically takes a build/ directory similar to what the Gitlab +# pipelines generate and uploads those files to the desired directory +--- +- hosts: mainhost + remote_user: admin + vars: + app_dir: /opt/app + tasks: + - name: Build skeleton root directory + file: + path: '{{app_dir}}' + state: directory + + - name: Build skeleton css directory + file: + path: '{{app_dir}}/css' + state: directory + + - name: Build skeleton js directory + file: + path: '{{app_dir}}/js' + state: directory + + - name: Build skeleton templates directory + file: + path: '{{app_dir}}/templates' + state: directory + + - name: Update Binary installation + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + with_items: + - { src: ../../build/static/css/style.css, dest: '{{app_dir}}/'} + - { src: ../../build/static/js/index.js, dest: '{{app_dir}}/js/'} + - { src: ../../build/static/js/category.js, dest: '{{app_dir}}/js/'} + - { src: ../../build/static/cantfindshit.jpg, dest: '{{app_dir}}/'} + - { src: ../../build/static/favicon.png, dest: '{{app_dir}}/'} + - { src: ../../build/templates/list.html.tera, dest: '{{app_dir}}/templates/list.html.tera'} + - { src: ../../build/templates/video.html.tera, dest: '{{app_dir}}/templates/video.html.tera'} + - { src: ../../build/Rocket.toml, dest: '{{app_dir}}/'} + - { src: ../../build/server, dest: '{{app_dir}}/'} + + - name: Restart web service + become: yes + become_method: sudo + service: + name: app + state: restarted \ No newline at end of file