Initial project commit
This commit is contained in:
32
ip-alias-test.yml
Normal file
32
ip-alias-test.yml
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
- name: IP Address Alias Testing
|
||||
hosts: ipalias
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Display IP aliases for host
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
IP alias detected for interface '{{ item }}' for {{ inventory_hostname }}
|
||||
loop: "{{ ansible_interfaces }}"
|
||||
when:
|
||||
- "'lo' not in item"
|
||||
- hostvars[inventory_hostname]['ansible_' + item]['ipv4_secondaries'] is defined
|
||||
|
||||
- name: Log IP alias check to syslogger
|
||||
community.general.syslogger:
|
||||
# msg: "{{ inventory_hostname }} has IP aliases defined for {{ item }}."
|
||||
msg: "{{ lookup('template', 'syslog.j2') | replace('\n', ' ') }}"
|
||||
ident: ansbl_ipu_precheck
|
||||
vars:
|
||||
actor: "check_ip_aliases"
|
||||
title: "Use of IP aliases detected"
|
||||
summary: "IP alias in use for interface: {{ ipv4_item }}"
|
||||
severity: "high"
|
||||
flags: ["inhibitor"]
|
||||
loop: "{{ ansible_interfaces }}"
|
||||
loop_control:
|
||||
loop_var: ipv4_item
|
||||
when:
|
||||
- "'lo' not in ipv4_item"
|
||||
- hostvars[inventory_hostname]['ansible_' + ipv4_item]['ipv4_secondaries'] is defined
|
Reference in New Issue
Block a user