Created
April 21, 2020 16:17
-
-
Save pretty25/4eab2766e2962da5a9232fe35e7fbb94 to your computer and use it in GitHub Desktop.
ms-app-deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: "remove old PortalAPI folder" | |
win_file: | |
path: '{{ deploy_staging_dir }}\PortalAPI' | |
state: absent | |
- name: create download dir on controlhost | |
file: | |
path="/tmp/{{ PROJECT }}" | |
state=directory | |
delegate_to: localhost | |
tags: zipcopy | |
- name: download to controlhost | |
maven_artifact: | |
group_id: "{{ PortalAPI.group_id }}" | |
artifact_id: "{{ PortalAPI.artifact_id}}" | |
version: "{{ PortalAPI.version }}" | |
extension: "{{ PortalAPI.extension }}" | |
repository_url: "{{ PortalAPI.nexus_url }}" | |
dest: "/tmp/{{ PROJECT }}/{{ PortalAPI.artifact_id }}.{{ PortalAPI.extension }}" | |
delegate_to: localhost | |
tags: zipcopy | |
- name: Copy artifact to target(s) | |
win_copy: | |
src: "/tmp/{{ PROJECT }}/{{ PortalAPI.artifact_id }}.{{ PortalAPI.extension }}" | |
dest: '{{ win_PortalAPI_metadata_archive }}' | |
tags: zipcopy | |
- name: Unzip MSI file | |
win_unzip: | |
src: '{{ win_PortalAPI_metadata_archive }}' | |
dest: '{{ deploy_staging_dir }}\{{ PortalAPI_folder }}' | |
rm: true | |
tags: zipcopy | |
- name: stop iis service | |
win_service: | |
name: W3SVC | |
state: stopped | |
tags: iis_stop | |
- name: find deploy dir/s files | |
win_stat: | |
path: "{{ DEPLOY_DIR }}" | |
register: deploy_dir | |
- name: debug | |
debug: | |
var: deploy_dir | |
- name: backup deploy dir/s files | |
win_copy: | |
src: "{{ DEPLOY_DIR }}" | |
dest: "{{ DEPLOY_backup_DIR }}" | |
remote_src: yes | |
when: not ansible_check_mode and deploy_dir.stat.exists | |
- name: Delete AppDeploy Directory | |
win_file: | |
path: "{{ DEPLOY_DIR }}" | |
state: absent | |
when: not ansible_check_mode and deploy_dir.stat.exists | |
- name: Check if staging dir PortalAPI_zip exists | |
win_find: | |
paths: "{{ deploy_staging_dir }}\\PortalAPI\\BuildOutput\\" | |
patterns: ['*.zip'] | |
register: PortalAPI_zip | |
when: not ansible_check_mode | |
tags: apprename | |
- name: debug1 | |
debug: | |
var: PortalAPI_zip | |
tags: apprename | |
- name: rename app dir | |
win_copy: | |
src: "{{ PortalAPI_zip.files.0.path }}" | |
dest: "{{ deploy_staging_dir }}\\PortalAPI\\BuildOutput\\PortalAPI.zip" | |
remote_src: yes | |
when: not ansible_check_mode and PortalAPI_zip.examined > 0 | |
tags: apprename | |
- name: "Unzipping app website code" | |
win_unzip: | |
src: '{{ deploy_staging_dir }}\PortalAPI\BuildOutput\PortalAPI.zip' | |
dest: '{{ deploy_staging_dir }}\PortalAPI\\PortalAPI' | |
when: not ansible_check_mode | |
- name: Check if staging PortalAPI dir exists | |
win_stat: | |
path: '{{ deploy_staging_dir }}\PortalAPI\PortalAPI' | |
register: stage_PortalAPIdir | |
tags: web | |
- name: copy deploy folder to deploy dir | |
win_copy: | |
src: '{{ deploy_staging_dir }}\PortalAPI\PortalAPI' | |
dest: "{{ InstallDir }}" | |
remote_src: yes | |
when: not ansible_check_mode and stage_PortalAPIdir.stat.exists | |
- name: remove web_config file exists | |
win_file: | |
path: "{{ webconfig_dir }}" | |
state: absent | |
tags: webconfig | |
- name: check web-env file exists | |
win_find: | |
paths: '{{ DEPLOY_DIR }}' | |
patterns: #['Web-ENV*.config'] | |
- "Web-{{ ENV }}.config" | |
- "Web-{{ ENV }}-{{ REGION | default('') }}.config" | |
register: webconfig_env | |
tags: webconfig | |
- name: webconfig_env check debug3 | |
debug: | |
var: webconfig_env | |
tags: webconfig | |
- name: rename web.config file based on ENV type | |
win_copy: | |
#src: "{{ DEPLOY_DIR }}\\Web-{{ ENV }}.config" | |
src: "{{ webconfig_env.files.0.path }}" | |
dest: "{{ DEPLOY_DIR }}\\Web.config" | |
remote_src: yes | |
when: not ansible_check_mode and webconfig_env.matched > 0 | |
tags: webconfig | |
- name: Check if web_config file exists | |
win_stat: | |
path: "{{ webconfig_dir }}" | |
#patterns: ['web.config'] | |
register: web_config | |
tags: webconfig | |
- name: remove non-relevant web.config files from Deploy DIR | |
win_find: | |
paths: "{{ DEPLOY_DIR }}" | |
patterns: ['Web-*.config'] | |
register: webconfig_env | |
when: not ansible_check_mode and web_config.stat.exists | |
tags: webconfig | |
- name: remove non-relevant web.config files from Deploy DIR | |
win_file: | |
path: "{{ item.path }}" | |
state: absent | |
with_items: "{{ webconfig_env.files }}" | |
when: not ansible_check_mode and web_config.stat.exists | |
tags: webconfig | |
- name: start iis service | |
win_service: | |
name: W3SVC | |
state: started |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment