Created
March 29, 2018 11:43
-
-
Save gmambro/d2e2a8f15b55d1a615d4522218ea4ee5 to your computer and use it in GitHub Desktop.
Ansible Get facts from Websphere MQ
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
--- | |
- set_fact: | |
ansible_ibm_mq: {} | |
- name: Run dspmqver | |
shell: "{{ ibm_mq_install_path }}/bin/dspmqver" | |
register: results | |
ignore_errors: true | |
- set_fact: | |
ansible_ibm_mq: "{{ ansible_ibm_mq | combine(new_entries) }}" | |
vars: | |
new_entries: | |
instname: "{{ results.stdout | regex_search('InstName:\\s+(.+)', '\\1') | first}}" | |
version: "{{ results.stdout | regex_search('Version:\\s+(.+)', '\\1') | first }}" | |
level: "{{ results.stdout | regex_search('Level:\\s+(.+)', '\\1') | first }}" | |
primary: "{{ results.stdout | regex_search('Primary:\\s+(.+)' , '\\1') | first}}" | |
datapath: "{{ results.stdout | regex_search('DataPath:\\s+(.+)', '\\1') | first}}" | |
instpath: "{{ results.stdout | regex_search('InstPath:\\s+(.+)', '\\1') | first}}" | |
when: results |succeeded | |
- name: Run dspmq | |
shell: "{{ ibm_mq_install_path }}/bin/dspmq -o status" | |
register: results | |
ignore_errors: true | |
- set_fact: | |
ansible_ibm_mq: "{{ ansible_ibm_mq | combine(new_entries) }}" | |
vars: | |
qm_names: "{{ results.stdout | regex_search('QMNAME\\((\\w+)\\)', '\\1') }}" | |
new_entries: | |
qm_name: "{{ qm_names | ternary( qm_names , [ '' ]) | first }}" | |
when: results |succeeded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment