diff options
Diffstat (limited to 'parcels/roles/services/galaxy-qgw-service/tasks/load_qgw.yml')
| -rw-r--r-- | parcels/roles/services/galaxy-qgw-service/tasks/load_qgw.yml | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/parcels/roles/services/galaxy-qgw-service/tasks/load_qgw.yml b/parcels/roles/services/galaxy-qgw-service/tasks/load_qgw.yml new file mode 100644 index 0000000..3a1c44d --- /dev/null +++ b/parcels/roles/services/galaxy-qgw-service/tasks/load_qgw.yml @@ -0,0 +1,114 @@ +- name: get zookeeper_servers to ansible variable + set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181" + when: '(groups.zookeeper|length) == 3' + +- name: get zookeeper_servers to ansible variable + set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181,{{groups.zookeeper[3]}}:2181,{{groups.zookeeper[4]}}:2181" + when: '(groups.zookeeper|length) >= 5' + +- name: stop and remove {{ qgw_image_container_name }} container + docker_container: + name: '{{ qgw_image_container_name }}' + state: absent + +- name: remove old {{ qgw_image_name }} image + docker_image: + name: '{{ qgw_image_name }}' + tag: '{{ qgw_image_tag_name }}' + state: absent + +- name: create {{ qgw_volume_path }} + file: + state: directory + path: '{{ install_path }}/{{ qgw_volume_path }}' + +- name: create {{ qgw_volume_path }}/config + file: + state: directory + path: '{{ install_path }}/{{ qgw_volume_path }}/config' + +- name: create {{ install_path }}/{{ qgw_soft_home_path }} + file: + state: directory + path: '{{ install_path }}/{{ qgw_soft_home_path }}' + +- name: copy {{ qgw_image_tar_name }} + copy: + src: '{{ package_path }}/{{ qgw_image_tar_name }}' + dest: '{{ install_path }}/{{ qgw_soft_home_path }}/{{ qgw_image_tar_name }}' + force: true + backup: yes + +- name: load new {{ qgw_image_name }} image from {{ qgw_image_tar_name }} + docker_image: + name: '{{ qgw_image_name }}' + tag: '{{ qgw_image_tag_name }}' + load_path: '{{ install_path }}/{{ qgw_soft_home_path }}/{{ qgw_image_tar_name }}' + source: load + force_tag: yes + force_source: yes + +- name: change the image tag + shell: docker tag galaxy-qgw-service:{{ qgw_image_tag_name }} {{ qgw_image_name }}:{{ qgw_image_tag_name }} + +- name: copy {{ qgw_image_name }} docker-compose.yml + template: + src: docker-compose.yml.j2 + dest: '{{ install_path }}/{{ qgw_soft_home_path }}/docker-compose.yml' + backup: yes + +- name: copy {{ qgw_image_name }} docker-compose.yml + template: + src: application.yml.j2 + dest: '{{ install_path }}/{{ qgw_volume_path }}/config/application.yml' + backup: yes + +- name: copy {{ qgw_image_name }} docker-compose.yml + template: + src: log4j2.xml.j2 + dest: '{{ install_path }}/{{ qgw_volume_path }}/config/log4j2.xml' + backup: yes + +- name: copy dat to {{ install_path }}/{{ qgw_volume_path }}/ + copy: src=files/dat dest={{ install_path }}/{{ qgw_volume_path }}/ force=true + +- name: copy config to {{ install_path }}/{{ qgw_soft_home_path }}/ + copy: src=files/config dest={{ install_path }}/{{ qgw_soft_home_path }}/ force=true + +- name: copy {{ qgw_image_name }} docker-compose.yml + template: + src: memorySchema.json.j2 + dest: '{{ install_path }}/{{ qgw_volume_path }}/config/memorySchema.json' + backup: yes + +- name: copy galaxy-qgw-service.j2 to {{ install_path }}/{{ qgw_soft_home_path }}/ + template: + src: galaxy-qgw-service.yml.j2 + dest: '{{ install_path }}/{{ qgw_soft_home_path }}/config/galaxy-qgw-service.yml' + backup: yes + +#- name: push config +# shell: 'curl --data-urlencode content="`cat {{ install_path }}/{{ qgw_soft_home_path }}/galaxy-qgw-service`" --request POST "http://{{ gateway_keepalive_host }}:8848/nacos/v1/cs/configs?username=nacos&password={{ nacos_pin }}&tenant={{ services_config_namespace }}&group=Galaxy&dataId=galaxy-qgw-service.yml&appName=galaxy-qgw-service&type=yaml"' +# register: change_out + +#- debug: +# msg: '{{ change_out.stdout }}' + +#- fail: +# msg: "galaxy-qgw-admin 配置提交失败" +# when: change_out.stdout != 'true' + +- name: copy push_config.sh.j2 to {{ install_path }}/{{ qgw_soft_home_path }}/ + template: + src: push_config.sh.j2 + dest: '{{ install_path }}/{{ qgw_soft_home_path }}/push_config.sh' + mode: 0755 + force: yes + +- name: push config + shell: 'cd {{ install_path }}/{{ qgw_soft_home_path }} && chmod +x push_config.sh && sh push_config.sh' + +- name: start {{ qgw_image_container_name }} container + docker_compose: + project_src: '{{ install_path }}/{{ qgw_soft_home_path }}' + |
