blob: 1804bb06f6e9e0a2431c905f1f6cdb5e82452c20 [file] [log] [blame]
Dennis Dmitrievdecdd872017-08-18 23:42:27 +03001Render the template
2-------------------
3
4Use reclass_tools from [1] to render the template.
5
6<env_name> : any name for newly created environment model
7<path_to_template> : path to the directory with the cookiecutter template, for example 'tcp-qa/tcp_tests/environment/environment_template'
8<destination_path> : path to directory where will be created the new environment model
9<inventory_fileN> : path to the YAML with the inventory data. Can be specified multiple times to use different parts of the inventory. VCP inventory must be specified for current workflow (when all linux.network.interface are deleted)
10
11
12```
13reclass-tools render -e <env_name> -t <path_to_template> -o <destination_path> -c <inventory_file1> -c <inventory_file2> [...] -c <inventory_fileN>
14```
15
16To attach the environment model to any cluster, use the instructions from [1]
17
18[1] https://github.com/dis-xcom/reclass_tools
19
20
21Template architecture
22---------------------
23
24```
25└── environment_template
26    ├── {{ cookiecutter._env_name }}
27    │   ├── init.yml
28    │   ├── linux_network_interface.yml
29    │   ├── linux_system_codename_trusty.yml
30    │   ├── linux_system_codename_xenial.yml
31    │   ├── {# interfaces #} -> ../{# interfaces #}
32    │   └── {# roles #} -> ../{# roles #}
33    ├── {# interfaces #}
34    │   └── ...
35    └── {# roles #}
36       └── ...
37```
38
39* {{ cookiecutter._env_name }} : folder that will be used to generate the new Environment model, contains:
40
41 - init.yml : file that will be filled with reclass:storage:node pillars generated using inventory files. This is the main file that must be
42 included to cfg01.* node before generating the reclass inventory with the salt state 'reclass.storage'.
43
44 - linux_network_interface.yml : it is a workaround to make possible to pass the linux:network:interface configuration separatelly for each node.
45 This is because reclass.storage state works only with parameters:_param:* pillars and cannot be used
46 to add any other pillar data to parameters:* (for example, parameters:linux:network:interface).
47 So, linux network interface configuration is stored in the intermediate variable parameters:_param:linux_network_interfaces
48 for each node, and then included to the parameters:linux:network:interface using this file as a class attached
49 to each node by default.
50 - linux_system_codename_*.yml : A class with a single variable. Allows to specify the specific linux version using only node role.
51
52 - {# interfaces #} : symlink to the {# interfaces #} folder outside of the cookiecutter template directory, to not pass it's content to the
53 resulting model during the model rendering.
54
55 - {# roles #} : symlink to the {# roles #} folder outside of the cookiecutter template directory, to not pass it's content to the
56 resulting model during the model rendering.
57
58* {# interfaces #} : Interface role means the name of the file that will be included and rendered.
59 Contains *text* patterns of YAML file that are included to the init.yml under linux_network_interface: parameters
60 using Jinja.
61 Each pattern provides the mapping of the physical interfaces which have the same role on some logical networking objects
62 (OVS, bonds, bridges, ...). These networking objects provide the Underlay interfaces used for upcoming cluster architecture.
63
64* {# roles #} : Node roles mean the name of the files that will be included and rendered under the 'classes:' object.
65 Contains *text* patterns of YAML file that are included to the init.yml and must provide only the
66 list of the classes for the specific node.
67
68In the init.yml is defined a dict variable 'params' that is accessible from files in {# interfaces #} and {# roles #}.
69'params' may be used by Jinja expressions in these folders to generate some additional dynamic 'parameters:_param' pillars that cannot be specified
70as a fixed value in a class.
71
72If you need to specify a fixed values, please do the following:
73- add a new class file *.yml file next to the init.yml with the necessary *FIXED* parameters (example: linux_system_codename_xenial.yml)
74- add a node role to the {# roles #} directory that will include your environment.{{ cookiecutter._env_name }}.<class file from first step>
75- use the created node role in the inventory for required nodes
76
77
78Inventory examples
79------------------
80
81Inventory must include all the nodes, physical or virtual.
82'reclass_storage_name' is used for back compatibility until some parameters
83are still inherited from the cluster/system level of the reclass:storage pillars.
84
85Physical node example:
86```
87nodes:
88 kvm01.mcp11-ovs-dpdk.local:
89 reclass_storage_name: infra_kvm_node01
90 roles:
91 - infra_kvm
92 - linux_system_codename_xenial
93 interfaces:
94 enp3s0f0:
95 role: management_single
96 enp3s0f1:
97 role: control_bond0
98```
99
100Virtual Control Plane node example:
101```
102nodes:
103 ctl01.mcp11-ovs-dpdk.local:
104 reclass_storage_name: openstack_control_node01
105 roles:
106 - openstack_control_leader
107 - linux_system_codename_xenial
108 interfaces:
109 ens3:
110 role: control_vcp_single
111```