diff --git a/bin/salt-refresh-host-data b/bin/salt-refresh-host-data new file mode 100755 index 0000000..9a7dbad --- /dev/null +++ b/bin/salt-refresh-host-data @@ -0,0 +1,20 @@ +#!/bin/bash + +for hostname in "$@" ; do + echo "Handling host $hostname ... pinging first ... output following:" + if salt "$hostname" test.ping ; then + echo "Clear all other caches on minion $hostname ... output following:" + salt "$hostname" saltutil.clear_cache + echo "Sync modules to minion $hostname ... output following:" + salt "$hostname" saltutil.sync_modules ; + echo "Sync states to minion $hostname ... output following:" + salt "$hostname" saltutil.sync_states ; + echo "Refreshing grains cache on minion $hostname ... output following:" + salt "$hostname" saltutil.refresh_grains + echo "Refreshing pillar cache on minion $hostname ... output following:" + salt "$hostname" saltutil.refresh_pillar + echo "Refreshing mine data on minion $hostname ... output following:" + salt "$hostname" mine.update + fi +done + diff --git a/pillar/top.sls b/pillar/top.sls index 6b1b9c2..89a2d02 100644 --- a/pillar/top.sls +++ b/pillar/top.sls @@ -4,6 +4,7 @@ {% set roles = salt['grains.get']('roles', []) %} {% set salt_cluster = salt['grains.get']('salt_cluster') %} {% set virtual = salt['grains.get']('virtual') %} +{% set virt_cluster = salt['grains.get']('virt_cluster') %} {{ saltenv }}: '*': @@ -28,6 +29,11 @@ - match: grain - salt_cluster.{{ salt_cluster }} - salt_cluster.{{ salt_cluster }}.osfullname.{{ osfullname.replace(' ', '_') }} + {% endif %} + {% if virt_cluster %} + 'virt_cluster:{{ virt_cluster }}': + - match: grain + - virt_cluster.{{ virt_cluster }} + {% endif %} '{{ id }}': - id.{{ id.replace('.', '_') }} - {% endif %} diff --git a/pillar/virt_cluster/atreju.sls b/pillar/virt_cluster/atreju.sls new file mode 100644 index 0000000..0920815 --- /dev/null +++ b/pillar/virt_cluster/atreju.sls @@ -0,0 +1,5 @@ +mine_functions: + network.ip_addrs: [] + private_ip_address: + mine_function: network.ip_addrs + cidr: 192.168.47.0/24 diff --git a/pillar/virt_cluster/bare-metal.sls b/pillar/virt_cluster/bare-metal.sls new file mode 100644 index 0000000..259c035 --- /dev/null +++ b/pillar/virt_cluster/bare-metal.sls @@ -0,0 +1,3 @@ +mine_functions: + network.ip_addrs: [] + diff --git a/pillar/virt_cluster/bryce.sls b/pillar/virt_cluster/bryce.sls new file mode 100644 index 0000000..2a1a602 --- /dev/null +++ b/pillar/virt_cluster/bryce.sls @@ -0,0 +1,5 @@ +mine_functions: + network.ip_addrs: [] + private_ip_address: + mine_function: network.ip_addrs + cidr: 192.168.67.0/24 diff --git a/pillar/virt_cluster/slimhat.sls b/pillar/virt_cluster/slimhat.sls new file mode 100644 index 0000000..259c035 --- /dev/null +++ b/pillar/virt_cluster/slimhat.sls @@ -0,0 +1,3 @@ +mine_functions: + network.ip_addrs: [] +