blob: aab937825188935dd9ddd489b5d66ecee0c5afe4 [file] [log] [blame]
Filip Pytloun49768a42015-10-06 16:28:32 +02001
Aleš Komárek586daae2017-02-06 19:47:06 +01002===============
Ales Komareka4f836f2017-05-17 13:12:51 +02003Reclass Formula
Aleš Komárek586daae2017-02-06 19:47:06 +01004===============
Filip Pytloun49768a42015-10-06 16:28:32 +02005
Petr Ruzickab4f74632017-11-16 15:47:07 +01006reclass is an "external node classifier" (ENC) as can be used with automation
Ales Komarek51e459c2017-02-19 08:47:46 +01007tools, such as Puppet, Salt, and Ansible. It is also a stand-alone tool for
8merging data sources recursively.
9
Filip Pytloun49768a42015-10-06 16:28:32 +020010
Ales Komareka4f836f2017-05-17 13:12:51 +020011Sample Metadata
12===============
Filip Pytloun49768a42015-10-06 16:28:32 +020013
Petr Ruzickab4f74632017-11-16 15:47:07 +010014Install sources from [repository, git, pip]
15
16
17.. code-block:: yaml
18
19 salt:
20 source:
21 engine: pkg
22 ...
23 source:
24 engine: git
25 repo: git+https://github.com/salt-formulas/reclass
26 branch: master
27 ...
28 source:
29 engine: pip
30 ...
31
32If reclass is pre-installed, set the engine to None to avoid updates.
33
34.. code-block:: yaml
35
36 salt:
37 source:
38 engine: None
39
40
Filip Pytloun49768a42015-10-06 16:28:32 +020041Reclass storage with data fetched from git
42
Ales Komarek51e459c2017-02-19 08:47:46 +010043.. literalinclude:: tests/pillar/storage_git.sls
44 :language: yaml
Filip Pytloun49768a42015-10-06 16:28:32 +020045
46Reclass storage with local data source
47
Ales Komarek51e459c2017-02-19 08:47:46 +010048.. literalinclude:: tests/pillar/storage_local.sls
49 :language: yaml
Filip Pytloun49768a42015-10-06 16:28:32 +020050
Ales Komarekf0942d72017-05-23 10:10:37 +020051Reclass storage with archive data source
52
53.. literalinclude:: tests/pillar/storage_archive.sls
54 :language: yaml
55
56Reclass storage with archive data source with content hash check
57
58.. literalinclude:: tests/pillar/storage_archive_public.sls
59 :language: yaml
60
Ales Komareka4a9f572016-12-03 20:15:50 +010061Reclass model with single node definition
62
Ales Komarek51e459c2017-02-19 08:47:46 +010063.. literalinclude:: tests/pillar/generate_single.sls
64 :language: yaml
Ales Komareka4a9f572016-12-03 20:15:50 +010065
66Reclass model with multiple node defined
67
Ales Komarek51e459c2017-02-19 08:47:46 +010068.. literalinclude:: tests/pillar/generate_multi.sls
69 :language: yaml
Ales Komareka4a9f572016-12-03 20:15:50 +010070
Ales Komarek968ebba2017-08-24 15:46:29 +020071Reclass model with multiple node defined and interpolation enabled
72
73.. literalinclude:: tests/pillar/generate_multi_interpolate.sls
74 :language: yaml
75
Ales Komareka4f836f2017-05-17 13:12:51 +020076Reclass storage with simple class mappings
Filip Pytloun49768a42015-10-06 16:28:32 +020077
Ales Komarek51e459c2017-02-19 08:47:46 +010078.. literalinclude:: tests/pillar/class_mapping.sls
79 :language: yaml
Filip Pytloun49768a42015-10-06 16:28:32 +020080
Ales Komareka4f836f2017-05-17 13:12:51 +020081Reclass models with dynamic node classification
Filip Pytloun49768a42015-10-06 16:28:32 +020082
Ales Komareka4f836f2017-05-17 13:12:51 +020083.. literalinclude:: tests/pillar/node_classify.sls
84 :language: yaml
85
Ales Komarek052aea12017-08-21 14:17:32 +020086Classify node after creation and unclassify on node deletion
87
88.. code-block:: yaml
89
90 salt:
91 master:
92 reactor:
93 reclass/minion/classify:
94 - salt://reclass/reactor/node_register.sls
95 reclass/minion/declassify:
96 - salt://reclass/reactor/node_unregister.sls
97
98Event to trigger the node classification
99
100.. code-block:: bash
101
102 salt-call event.send 'reclass/minion/classify' "{'node_master_ip': '$config_host', 'node_ip': '${node_ip}', 'node_domain': '$node_domain', 'node_cluster': '$node_cluster', 'node_hostname': '$node_hostname', 'node_os': '$node_os'}"
103
104.. note::
105
106 You can send any parameters in the event payload, all will be checked
107 against dynamic node classification conditions.
108
109 Both actions will use the minion ID as the node_name to be updated.
110
111Event to trigger the node declassification
112
113.. code-block:: bash
114
115 salt-call event.send 'reclass/minion/declassify'
116
Ales Komareka4f836f2017-05-17 13:12:51 +0200117
118More Information
119================
Filip Pytloun49768a42015-10-06 16:28:32 +0200120
121* http://reclass.pantsfullofunix.net/index.html
122* http://reclass.pantsfullofunix.net/operations.html
Ales Komarek51e459c2017-02-19 08:47:46 +0100123
Filip Pytloun2ea4e6a2017-02-02 13:02:03 +0100124
125Documentation and Bugs
126======================
127
128To learn how to install and update salt-formulas, consult the documentation
129available online at:
130
131 http://salt-formulas.readthedocs.io/
132
133In the unfortunate event that bugs are discovered, they should be reported to
134the appropriate issue tracker. Use Github issue tracker for specific salt
135formula:
136
137 https://github.com/salt-formulas/salt-formula-reclass/issues
138
139For feature requests, bug reports or blueprints affecting entire ecosystem,
140use Launchpad salt-formulas project:
141
142 https://launchpad.net/salt-formulas
143
144You can also join salt-formulas-users team and subscribe to mailing list:
145
146 https://launchpad.net/~salt-formulas-users
147
148Developers wishing to work on the salt-formulas projects should always base
149their work on master branch and submit pull request against specific formula.
150
151 https://github.com/salt-formulas/salt-formula-reclass
152
153Any questions or feedback is always welcome so feel free to join our IRC
154channel:
155
156 #salt-formulas @ irc.freenode.net