Skip to content

Instantly share code, notes, and snippets.

@mdzidic
Last active October 11, 2017 12:15
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 mdzidic/41297c3aeae388f7cd5f97ab3405553a to your computer and use it in GitHub Desktop.
Save mdzidic/41297c3aeae388f7cd5f97ab3405553a to your computer and use it in GitHub Desktop.
Salt Mine
mine_functions:
external_ip:
- mine_function: network.interface_ip
- eth0
internal_ip:
- mine_function: network.ip_addrs
internal_ip_cidr:
- mine_function: network.ip_addrs
- cidr: 192.168.0.0/16
@mdzidic
Copy link
Author

mdzidic commented Oct 11, 2017

$ salt-call mine.get '*' external_ip

local:
    ----------
    minion1234:
        123.123.123.123

$ salt-call mine.get '*' internal_ip

local:
    ----------
    minion1234:
        - 172.17.0.1
        - 172.104.128.209
        - 192.168.153.63

$ salt-call mine.get '*' internal_ip_cidr

local:
    ----------

@mdzidic
Copy link
Author

mdzidic commented Oct 11, 2017

Working solution!

mine_functions:
  10_network_addrs:
    mine_function: network.ip_addrs
    cidr: '10.0.0.0/8'
  192_168_network_addrs:
    mine_function: network.ip_addrs
    cidr: '192.168.0.0/16'
  private_network_addrs:
    mine_function: network.ip_addrs
    type: 'private'
  public_network_addrs:
    mine_function: network.ip_addrs
    type: 'public'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment