summaryrefslogtreecommitdiff
path: root/parcels/roles/services/galaxy-hos-nginx/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'parcels/roles/services/galaxy-hos-nginx/tasks/main.yml')
-rw-r--r--parcels/roles/services/galaxy-hos-nginx/tasks/main.yml115
1 files changed, 115 insertions, 0 deletions
diff --git a/parcels/roles/services/galaxy-hos-nginx/tasks/main.yml b/parcels/roles/services/galaxy-hos-nginx/tasks/main.yml
new file mode 100644
index 0000000..26fe1d8
--- /dev/null
+++ b/parcels/roles/services/galaxy-hos-nginx/tasks/main.yml
@@ -0,0 +1,115 @@
+- name: stop and remove {{ hos_nginx_image_container_name }} container
+ docker_container:
+ name: '{{ hos_nginx_image_container_name }}'
+ state: absent
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: remove old {{ hos_nginx_hos_service_image_name }} image
+ docker_image:
+ name: '{{ hos_nginx_hos_service_image_name }}'
+ tag: '{{ hos_nginx_hos_service_image_tag_name }}'
+ state: absent
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: create {{ hos_nginx_volume_path }}
+ file:
+ state: directory
+ path: '{{ install_path }}/{{ hos_nginx_volume_path }}'
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: create {{ install_path }}/{{ hos_nginx_soft_home_path }}
+ file:
+ state: directory
+ path: '{{ install_path }}/{{ hos_nginx_soft_home_path }}'
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: copy {{ hos_nginx_hos_service_image_tar_name }}
+ copy:
+ src: '{{ package_path }}/{{ hos_nginx_hos_service_image_tar_name }}'
+ dest: '{{ install_path }}/{{ hos_nginx_soft_home_path }}/'
+ force: true
+ backup: yes
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: load new {{ hos_nginx_hos_service_image_name }} image from {{ hos_nginx_hos_service_image_tar_name }}
+ docker_image:
+ name: '{{ hos_nginx_hos_service_image_name }}'
+ tag: '{{ hos_nginx_hos_service_image_tag_name }}'
+ load_path: '{{ install_path }}/{{ hos_nginx_soft_home_path }}/{{ hos_nginx_hos_service_image_tar_name }}'
+ source: load
+ force_tag: yes
+ force_source: yes
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: change the image tag
+ shell: docker tag nginx-metrics:{{ hos_nginx_hos_service_image_tag_name }} {{ hos_nginx_hos_service_image_name }}:{{ hos_nginx_hos_service_image_tag_name }}
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: copy {{ hos_nginx_hos_service_image_name }} docker-compose.yml
+ template:
+ src: docker-compose.yml.j2
+ dest: '{{ install_path }}/{{ hos_nginx_soft_home_path }}/docker-compose.yml'
+ backup: yes
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: copy {{ hos_nginx_hos_service_image_name }} nginx.conf
+ template:
+ src: nginx.conf.j2
+ dest: '{{ install_path }}/{{ hos_nginx_volume_path }}/nginx.conf'
+ backup: yes
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }
+
+- name: start {{ hos_nginx_image_container_name }} container
+ docker_compose:
+ project_src: '{{ install_path }}/{{ hos_nginx_soft_home_path }}'
+ run_once: true
+ delegate_facts: true
+ delegate_to: "{{ item.ip }}"
+ with_items:
+ - { ip: '{{ groups.hosnginx[0] }}' }
+ - { ip: '{{ groups.hosnginx[1] }}' }