feat: add zone to subnet facts
- add common and dmz zone fact information
This commit is contained in:
parent
26b908e5e7
commit
8f58c2e4b2
@ -5,23 +5,23 @@ require 'ipaddr'
|
|||||||
# a class that creates facts based on the subnet
|
# a class that creates facts based on the subnet
|
||||||
class SubnetAttributes
|
class SubnetAttributes
|
||||||
SUBNET_TO_ATTRIBUTES = {
|
SUBNET_TO_ATTRIBUTES = {
|
||||||
'198.18.13.0/24' => { environment: 'prod', region: 'syd1', country: 'au' },
|
'198.18.13.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' },
|
||||||
'198.18.14.0/24' => { environment: 'prod', region: 'syd1', country: 'au' },
|
'198.18.14.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' },
|
||||||
'198.18.15.0/24' => { environment: 'prod', region: 'syd1', country: 'au' },
|
'198.18.15.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' },
|
||||||
'198.18.16.0/24' => { environment: 'test', region: 'syd1', country: 'au' },
|
'198.18.16.0/24' => { environment: 'test', region: 'syd1', country: 'au', zone: 'common' },
|
||||||
'198.18.17.0/24' => { environment: 'prod', region: 'drw1', country: 'au' },
|
'198.18.17.0/24' => { environment: 'prod', region: 'drw1', country: 'au', zone: 'common' },
|
||||||
'198.18.18.0/24' => { environment: 'test', region: 'drw1', country: 'au' },
|
'198.18.18.0/24' => { environment: 'test', region: 'drw1', country: 'au', zone: 'common' },
|
||||||
'198.18.19.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # loopbacks
|
'198.18.19.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # loopbacks
|
||||||
'198.18.20.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # MPLS CORE BLOCKS
|
'198.18.20.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # MPLS CORE BLOCKS
|
||||||
'198.18.21.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # physical network 2.5gbe
|
'198.18.21.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # physical network 2.5gbe
|
||||||
'198.18.22.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # ceph cluster
|
'198.18.22.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # ceph cluster
|
||||||
'198.18.23.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # ceph public
|
'198.18.23.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # ceph public
|
||||||
'198.18.24.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # dmz 1
|
'198.18.24.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'dmz' }, # dmz 1
|
||||||
'198.18.25.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # common node0009
|
'198.18.25.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0009
|
||||||
'198.18.26.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # common node0010
|
'198.18.26.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0010
|
||||||
'198.18.27.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # common node0011
|
'198.18.27.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0011
|
||||||
'198.18.28.0/24' => { environment: 'prod', region: 'syd1', country: 'au' }, # common node0012
|
'198.18.28.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0012
|
||||||
'198.18.29.0/24' => { environment: 'prod', region: 'syd1', country: 'au' } # common node0013
|
'198.18.29.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' } # common node0013
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# Default attributes if no subnet matches, also defined as a constant
|
# Default attributes if no subnet matches, also defined as a constant
|
||||||
@ -47,3 +47,4 @@ subnet_attributes = SubnetAttributes.attributes(ip)
|
|||||||
Facter.add('environment') { setcode { subnet_attributes[:environment] } }
|
Facter.add('environment') { setcode { subnet_attributes[:environment] } }
|
||||||
Facter.add('region') { setcode { subnet_attributes[:region] } }
|
Facter.add('region') { setcode { subnet_attributes[:region] } }
|
||||||
Facter.add('country') { setcode { subnet_attributes[:country] } }
|
Facter.add('country') { setcode { subnet_attributes[:country] } }
|
||||||
|
Facter.add('zone') { setcode { subnet_attributes[:zone] } }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user