ソースを参照

Make salt.minion.grains idempotent (poor man solution)

idempotency
Filip Pytloun 8年前
コミット
cf85b322cc
1個のファイルの変更13行の追加3行の削除
  1. +13
    -3
      salt/minion/grains.sls

+ 13
- 3
salt/minion/grains.sls ファイルの表示

@@ -14,24 +14,34 @@ salt_minion_grains_dir:
- {{ minion.install_state }}

salt_minion_grains_placeholder:
file.touch:
file.managed:
- name: /etc/salt/grains.d/placeholder
- replace: false
- require:
- file: salt_minion_grains_dir

{#
TODO: we need to be idempotent but reload salt-minion when grains are
changed. So for now, adding new grains requires removal of /etc/salt/grains
file and execution of salt state again
This can be possibly solved by custom module for grains management or native
support for grains.d in salt
#}
salt_minion_grains_file:
cmd.run:
- name: cat /etc/salt/grains.d/* > /etc/salt/grains
- creates: /etc/salt/grains
- require:
- file: salt_minion_grains_placeholder
- watch_in:
- service: salt_minion_service

salt_minion_grains_publish:
module.run:
module.wait:
- name: mine.send
- name: grains.items
- require:
- watch:
- service: salt_minion_service
- cmd: salt_minion_grains_file

{%- endif %}

読み込み中…
キャンセル
保存