Bump template version for all templates to "ocata"
[apex-tripleo-heat-templates.git] / extraconfig / all_nodes / swap-partition.j2.yaml
1 heat_template_version: ocata
2
3 description: >
4   Extra config to add swap space to nodes.
5
6 # Parameters passed from the parent template - note if you maintain
7 # out-of-tree templates they may require additional parameters if the
8 # in-tree templates add a new role.
9 parameters:
10   servers:
11     type: json
12   swap_partition_label:
13     type: string
14     description: Swap partition label
15     default: 'swap1'
16
17
18 resources:
19
20   SwapConfig:
21     type: OS::Heat::SoftwareConfig
22     properties:
23       group: script
24       config: |
25         #!/bin/bash
26         set -eux
27         swap_partition=$(realpath /dev/disk/by-label/$swap_partition_label)
28         swapon $swap_partition
29         echo "$swap_partition swap swap defaults 0 0" >> /etc/fstab
30       inputs:
31         - name: swap_partition_label
32           description: Swap partition label
33           default: 'swap1'
34
35 {% for role in roles %}
36   {{role.name}}SwapDeployment:
37     type: OS::Heat::SoftwareDeploymentGroup
38     properties:
39       config: {get_resource: SwapConfig}
40       servers: {get_param: [servers, {{role.name}}]}
41       input_values:
42         swap_partition_label: {get_param: swap_partition_label}
43       actions: ["CREATE"]
44 {% endfor %}