Disable cinder-backup by default
[apex-tripleo-heat-templates.git] / extraconfig / all_nodes / swap.yaml
1 heat_template_version: 2014-10-16
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   controller_servers:
11     type: json
12   compute_servers:
13     type: json
14   blockstorage_servers:
15     type: json
16   objectstorage_servers:
17     type: json
18   cephstorage_servers:
19     type: json
20   swap_size_megabytes:
21     type: string
22     description: Amount of swap space to allocate in megabytes
23     default: '4096'
24   swap_path:
25     type: string
26     description: Full path to location of swap file
27     default: '/swap'
28
29
30 resources:
31
32   SwapConfig:
33     type: OS::Heat::SoftwareConfig
34     properties:
35       group: script
36       config: |
37         #!/bin/bash
38         set -eux
39         if [ ! -f $swap_path ]; then
40           dd if=/dev/zero of=$swap_path count=$swap_size_megabytes bs=1M
41           chmod 0600 $swap_path
42           mkswap $swap_path
43           swapon $swap_path
44         else
45           echo "$swap_path already exists"
46         fi
47         echo "$swap_path swap swap defaults 0 0" >> /etc/fstab
48       inputs:
49         - name: swap_size_megabytes
50           description: Amount of swap space to allocate in megabytes
51           default: '4096'
52         - name: swap_path
53           description: Full path to location of swap file
54           default: '/swap'
55
56   ControllerSwapDeployment:
57     type: OS::Heat::SoftwareDeploymentGroup
58     properties:
59       config: {get_resource: SwapConfig}
60       servers: {get_param: controller_servers}
61       input_values:
62         swap_size_megabytes: {get_param: swap_size_megabytes}
63         swap_path: {get_param: swap_path}
64       actions: ["CREATE"]
65
66   ComputeSwapDeployment:
67     type: OS::Heat::SoftwareDeploymentGroup
68     properties:
69       config: {get_resource: SwapConfig}
70       servers: {get_param: compute_servers}
71       input_values:
72         swap_size_megabytes: {get_param: swap_size_megabytes}
73         swap_path: {get_param: swap_path}
74       actions: ["CREATE"]
75
76   BlockStorageSwapDeployment:
77     type: OS::Heat::SoftwareDeploymentGroup
78     properties:
79       config: {get_resource: SwapConfig}
80       servers: {get_param: blockstorage_servers}
81       input_values:
82         swap_size_megabytes: {get_param: swap_size_megabytes}
83         swap_path: {get_param: swap_path}
84       actions: ["CREATE"]
85
86   ObjectStorageSwapDeployment:
87     type: OS::Heat::SoftwareDeploymentGroup
88     properties:
89       config: {get_resource: SwapConfig}
90       servers: {get_param: objectstorage_servers}
91       input_values:
92         swap_size_megabytes: {get_param: swap_size_megabytes}
93         swap_path: {get_param: swap_path}
94       actions: ["CREATE"]
95
96   CephStorageSwapDeployment:
97     type: OS::Heat::SoftwareDeploymentGroup
98     properties:
99       config: {get_resource: SwapConfig}
100       servers: {get_param: cephstorage_servers}
101       input_values:
102         swap_size_megabytes: {get_param: swap_size_megabytes}
103         swap_path: {get_param: swap_path}
104       actions: ["CREATE"]