Skip to content

Instantly share code, notes, and snippets.

@maxamillion
Created August 1, 2019 20:40
Show Gist options
  • Save maxamillion/da61f47dc23c3a7f81fff0d84e02e97f to your computer and use it in GitHub Desktop.
Save maxamillion/da61f47dc23c3a7f81fff0d84e02e97f to your computer and use it in GitHub Desktop.
httpapi can't determine network_os with multiple plays in a playbook
INVENTORY.TXT
[snort]
40.121.40.224
168.62.170.199
[qradar]
#ec2-34-217-52-111.us-west-2.compute.amazonaws.com
13.90.249.151
[qradar:vars]
ansible_network_os=ansible_security.community.qradar
ansible_user=admin
ansible_httpapi_pass=NOPENOPENOPE
ansible_httpapi_use_ssl=yes
ansible_httpapi_validate_certs=False
ansible_connection=httpapi
QRADAR_COLLECTIONS_ONE_PLAY_PLAYBOOK.yml (works just fine)
---
- name: Testing URI manipulation of QRadar
hosts: qradar
gather_facts: false
tasks:
- name: collection namespace block
block:
- name: create log source
qradar_log_source_management:
name: "Testing Collections PB"
type_name: "Linux OS"
state: absent
description: "Testing Collection PB Description"
identifier: "Testing Identifier PB"
register: reg_qradar_log_sources
- debug: var=reg_qradar_log_sources
collections:
- ansible_security.community
QRADAR_COLLECTIONS_MULTI_PLAY_PLAYBOOK.yml (DOES NOT WORK)
---
- name: test ids
hosts: snort
tasks:
- debug: msg="testing"
- name: Do QRadar stuff
hosts: qradar
gather_facts: false
tasks:
- name: Add snort remote logging to QRadar
block:
- name: create log source
qradar_log_source_management:
name: "Testing Collections PB - {{ hostvars[item]['ansible_eth0']['ipv4']['address'] }}"
type_name: "Linux OS"
state: absent
description: "Testing Collection PB Description"
identifier: "{{ hostvars[item]['ansible_eth0']['ipv4']['address'] }}"
loop: "{{groups['snort']}}"
collections:
- ansible_security.community
QRADAR_COLLECTIONS_MULTI_PLAY_PLAYBOOK.yml OUTPUT
$ ansible-playbook /tmp/qradar_multi_play_playbook.yml -i inventory.txt
PLAY [test ids] **************************************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************************
ok: [168.62.170.199]
ok: [40.121.40.224]
TASK [debug] *****************************************************************************************************************************************
ok: [40.121.40.224] => {
"msg": "testing"
}
ok: [168.62.170.199] => {
"msg": "testing"
}
PLAY [Do QRadar stuff] *******************************************************************************************************************************
TASK [create log source] *****************************************************************************************************************************
ok: [13.90.249.151] => (item=40.121.40.224)
fatal: [13.90.249.151]: FAILED! => {"msg": "Unable to automatically determine host network os. Please manually configure ansible_network_os value for this host"}
PLAY RECAP *******************************************************************************************************************************************
13.90.249.151 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
168.62.170.199 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
40.121.40.224 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment