Change-Id: I8f2a66c6edafc425794d7cedc8b9217df7ee5951atp-proxy
Configure global environment variables | Configure global environment variables | ||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||||
Linux /etc/environment: | |||||
``/etc/environment`` is for static system wide variable assignment after boot. Variable expansion is frequently not supported. | |||||
Use ``/etc/environment`` for static system wide variable assignment after | |||||
boot. Variable expansion is frequently not supported. | |||||
.. code-block:: yaml | .. code-block:: yaml | ||||
- .local | - .local | ||||
Configure profile.d scripts | Configure profile.d scripts | ||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||||
Linux /etc/profile.d: | |||||
The profile.d scripts are being sourced during .sh execution and support variable expansion in opposite to /etc/environment | |||||
global settings in ``/etc/environment``. | |||||
The profile.d scripts are being sourced during .sh execution and support | |||||
variable expansion in opposite to /etc/environment global settings in | |||||
``/etc/environment``. | |||||
.. code-block:: yaml | .. code-block:: yaml | ||||
export NO_PROXY='.local' | export NO_PROXY='.local' | ||||
Linux with hosts | Linux with hosts | ||||
~~~~~~~~~~~~~~~~ | |||||
Parameter purge_hosts will enforce whole /etc/hosts file, removing entries | Parameter purge_hosts will enforce whole /etc/hosts file, removing entries | ||||
that are not defined in model except defaults for both IPv4 and IPv6 localhost | that are not defined in model except defaults for both IPv4 and IPv6 localhost | ||||
and hostname + fqdn. | and hostname + fqdn. | ||||
It's good to use this option if you want to ensure /etc/hosts is always in a | It's good to use this option if you want to ensure /etc/hosts is always in a | ||||
clean state however it's not enabled by default for safety. | clean state however it's not enabled by default for safety. | ||||
linux: | linux: | ||||
network: | network: | ||||
... | |||||
purge_hosts: true | purge_hosts: true | ||||
host: | host: | ||||
# No need to define this one if purge_hosts is true | # No need to define this one if purge_hosts is true | ||||
- node2.domain.com | - node2.domain.com | ||||
- service2.domain.com | - service2.domain.com | ||||
Linux with hosts collected from mine | |||||
In this case all dns records defined within infrastrucuture will be passed to | |||||
local hosts records or any DNS server. Only hosts with `grain` parameter to | |||||
true will be propagated to the mine. | |||||
.. code-block:: yaml | |||||
linux: | |||||
network: | |||||
purge_hosts: true | |||||
mine_dns_records: true | |||||
host: | |||||
node1: | |||||
address: 192.168.10.200 | |||||
grain: true | |||||
names: | |||||
- node2.domain.com | |||||
- service2.domain.com | |||||
Setup resolv.conf, nameservers, domain and search domains | Setup resolv.conf, nameservers, domain and search domains | ||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||||
.. code-block:: yaml | .. code-block:: yaml | ||||
- timeout: 2 | - timeout: 2 | ||||
- attempts: 2 | - attempts: 2 | ||||
**setting custom TX queue length for tap interfaces** | |||||
setting custom TX queue length for tap interfaces | |||||
.. code-block:: yaml | .. code-block:: yaml | ||||
tap_custom_txqueuelen: 10000 | tap_custom_txqueuelen: 10000 | ||||
DPDK OVS interfaces | DPDK OVS interfaces | ||||
-------------------- | |||||
**DPDK OVS NIC** | **DPDK OVS NIC** | ||||
'ip6-allhosts' | 'ip6-allhosts' | ||||
], | ], | ||||
} -%} | } -%} | ||||
{%- for name, host in network.host.iteritems() -%} | |||||
{%- for name, host in host_dict.iteritems() -%} | |||||
{%- do hosts.update({host.address: host.names}) -%} | {%- do hosts.update({host.address: host.names}) -%} | ||||
{%- endfor %} | {%- endfor %} | ||||
{% for address, entries in hosts|dictsort %} | {% for address, entries in hosts|dictsort %} |
'host': 'none', | 'host': 'none', | ||||
}, | }, | ||||
'host': {}, | 'host': {}, | ||||
'mine_dns_records': False, | |||||
'dhclient_config': '/etc/dhcp/dhclient.conf', | 'dhclient_config': '/etc/dhcp/dhclient.conf', | ||||
}, | }, | ||||
'Debian': { | 'Debian': { | ||||
'host': 'none' | 'host': 'none' | ||||
}, | }, | ||||
'host': {}, | 'host': {}, | ||||
'mine_dns_records': False, | |||||
'dhclient_config': '/etc/dhcp/dhclient.conf', | 'dhclient_config': '/etc/dhcp/dhclient.conf', | ||||
}, | }, | ||||
'RedHat': { | 'RedHat': { | ||||
'host': 'none' | 'host': 'none' | ||||
}, | }, | ||||
'host': {}, | 'host': {}, | ||||
'mine_dns_records': False, | |||||
'dhclient_config': '/etc/dhcp/dhclient.conf', | 'dhclient_config': '/etc/dhcp/dhclient.conf', | ||||
}, | }, | ||||
}, grain='os_family', merge=salt['pillar.get']('linux:network')) %} | }, grain='os_family', merge=salt['pillar.get']('linux:network')) %} |
{%- from "linux/map.jinja" import system with context -%} | |||||
{%- from "linux/map.jinja" import system,network with context -%} | |||||
orchestrate: | orchestrate: | ||||
system: | system: | ||||
priority: 30 | priority: 30 | ||||
{%- endif %} | {%- endif %} | ||||
{%- endfor %} | {%- endfor %} | ||||
{{ service_grains|yaml(False)|indent(4) }} | {{ service_grains|yaml(False)|indent(4) }} | ||||
{%- set dns_records = [] %} | |||||
{%- for host_name, host in network.host.items() %} | |||||
{%- if host.get('grain', False) %} | |||||
{%- do dns_records.append(host.pop('grain')) %} | |||||
{%- endif %} | |||||
{%- endfor %} | |||||
dns_records: | |||||
dns_records: {{ dns_records|yaml }} |
{%- from "linux/map.jinja" import network with context %} | {%- from "linux/map.jinja" import network with context %} | ||||
{%- if network.enabled %} | {%- if network.enabled %} | ||||
{%- set host_dict = network.host %} | |||||
{%- if network.mine_dns_records %} | |||||
{%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %} | |||||
{%- if node_grains.get('dns_records', []) is iterable %} | |||||
{%- for record in node_grains.get('dns_records', []) %} | |||||
{%- set record_key = node_name ~ '-' ~ loop.index %} | |||||
{%- do host_dict.update({ record_key: {'address': record.address, 'names': record.names} }) %} | |||||
{%- endfor %} | |||||
{%- endif %} | |||||
{%- endfor %} | |||||
{%- endif %} | |||||
{%- if network.get('purge_hosts', false) %} | {%- if network.get('purge_hosts', false) %} | ||||
linux_hosts: | linux_hosts: | ||||
- name: /etc/hosts | - name: /etc/hosts | ||||
- source: salt://linux/files/hosts | - source: salt://linux/files/hosts | ||||
- template: jinja | - template: jinja | ||||
- defaults: | |||||
host_dict: {{ host_dict|yaml }} | |||||
{%- else %} | {%- else %} | ||||
{%- for name, host in network.host.iteritems() %} | |||||
{%- for name, host in host_dict.iteritems() %} | |||||
{%- if host.names is defined %} | {%- if host.names is defined %} | ||||