Last active
May 31, 2020 19:33
-
-
Save plavjanik/04d399d1c8441f714e0cf1bb17838240 to your computer and use it in GitHub Desktop.
Update server port and recycle
This file contains hidden or 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: Update server port and recycle | |
| hosts: sys1 | |
| gather_facts: no | |
| tasks: | |
| - name: Update PARMLIB member | |
| shell: zowe zos-files upload file-to-data-set config.env "MY.PARMLIB(MYSERV)" --zosmf-profile {{ zowe_profile }} | |
| delegate_to: localhost | |
| - name: List STCs | |
| shell: zowe jobs list jobs --prefix MYSERV --zosmf-profile {{ zowe_profile }} | grep ACTIVE || true | |
| delegate_to: localhost | |
| register: "active_stcs" | |
| - name: Stop STC if active | |
| when: active_stcs.stdout_lines|length == 1 | |
| shell: zowe console issue command "P MYSERV" --zosmf-profile {{ zowe_profile }} | |
| delegate_to: localhost | |
| - name: Start STC | |
| shell: zowe console issue command "S MYSERV" --zosmf-profile {{ zowe_profile }} | |
| delegate_to: localhost | |
| - set_fact: | |
| server_port: "{{ lookup('ini', 'SERVER_PORT type=properties file=config.env') }}" | |
| - name: Wait until a URL is reachable from this host (port {{ server_port }}) | |
| uri: | |
| url: "https://{{ ansible_ssh_host }}:{{ server_port }}/" | |
| validate_certs: no | |
| delegate_to: localhost | |
| register: _result | |
| until: _result.status == 200 | |
| delay: 5 | |
| retries: 12 # one minute | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment