增加根据远程主机的IPMB信息分组

This commit is contained in:
fumingwei
2020-01-20 16:25:02 +08:00
parent a7598c85a6
commit 1c789375bd
2 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
---
- name: 'copy groups-by-IPMB-addr.fact to host'
copy:
src: "{{ role_path }}/files/groups_by_IPMB_addr.fact"
dest: "/etc/ansible/facts.d/groups_by_IPMB_addr.fact"
mode: "0755"
- name: 'Gathers facts from remote hosts'
setup:
filter: 'ansible_local'
fact_path: /etc/ansible/facts.d
- name: "debug"
debug: var=ansible_local
- name: 'group by gathers facts'
group_by:
key: '{{item.key}}'
when: ansible_local.groups_by_IPMB_addr == item.value
with_items:
- { key: 'blade-00', value: 'IPMB_num_blade_00' }
- { key: 'blade-01', value: 'IPMB_num_blade_01' }
- { key: 'blade-02', value: 'IPMB_num_blade_02' }
- { key: 'blade-03', value: 'IPMB_num_blade_03' }