Skip to content

Instantly share code, notes, and snippets.

@gmambro
Created March 29, 2018 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmambro/d2e2a8f15b55d1a615d4522218ea4ee5 to your computer and use it in GitHub Desktop.
Save gmambro/d2e2a8f15b55d1a615d4522218ea4ee5 to your computer and use it in GitHub Desktop.
Ansible Get facts from Websphere MQ
---
- 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