Saltstack Official Linux Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

38 行
889B

  1. {%- from "linux/map.jinja" import network with context %}
  2. {%- if network.enabled %}
  3. {%- for name, host in network.host.iteritems() %}
  4. {%- if host.names is defined %}
  5. linux_host_{{ name }}:
  6. host.present:
  7. - ip: {{ host.address }}
  8. - names: {{ host.names }}
  9. {%- if host.address in grains.ipv4 and host.names|length > 1 %}
  10. {%- if host.names.1 in host.names.0 %}
  11. {%- set before = host.names.1 + " " + host.names.0 %}
  12. {%- set after = host.names.0 + " " + host.names.1 %}
  13. {%- elif host.names.0 in host.names.1 %}
  14. {%- set before = host.names.0 + " " + host.names.1 %}
  15. {%- set after = host.names.1 + " " + host.names.0 %}
  16. {%- endif %}
  17. linux_host_{{ name }}_order_fix:
  18. module.run:
  19. - name: file.replace
  20. - path: /etc/hosts
  21. - pattern: {{ before }}
  22. - repl: {{ after }}
  23. - watch:
  24. - host: linux_host_{{ name }}
  25. {%- endif %}
  26. {%- endif %}
  27. {%- endfor %}
  28. {%- endif %}