Created
December 29, 2016 16:56
-
-
Save ppmathis/dead01276606a45982f88088982b3125 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| location-mappings: | |
| octopus.ssx.li: zrh1 | |
| location-overrides@zrh1: | |
| ssx-resolvconf: | |
| servers: [4.3.2.1] | |
| [email protected]: | |
| ssx-resolvconf: | |
| servers: [1.3.3.7, 4.4.8.8] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| base: | |
| '*': | |
| - common | |
| - overrides |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% import_yaml tpldir + '/variables.yml' as vars %} | |
| {% set data = vars.get('defaults', {}) %} | |
| {% set _location = salt['pillar.get']('location-mappings:' + grains['fqdn'], None) %} | |
| {% do data.update(salt['pillar.get'](sls, {})) %} | |
| {% if _location is not none %}{% do data.update(salt['pillar.get']('location-overrides@' + _location + ':' + sls, {})) %}{% endif %} | |
| {% do data.update(salt['pillar.get']('host-overrides@' + grains['fqdn'] + ':' + sls, {})) %} | |
| {% do data.update({ 'maps': { | |
| 'os_family': salt['grains.filter_by'](vars.os_family, base='default', grain='os_family', merge=salt['pillar.get'](sls + ':lookup', {})) | |
| }}) %} | |
| {% if data.maps.os_family is none %}{{ salt.test.exception('No suitable os_family mapping found for: ' + grains['os_family']) }}{% endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% from 'map.jinja' import data with context %} | |
| ssx-resolvconf: | |
| cmd.run: | |
| - name: echo {{ data.servers }} {{ data.maps.os_family.config }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defaults: | |
| domains: ssx.li | |
| servers: | |
| - 8.8.8.8 | |
| - 8.8.4.4 | |
| os_family: | |
| Debian: | |
| config: /etc/resolv.conf | |
| CentOS: | |
| config: /etc/resolv.lolcat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment