evolution / wordpress

Rapidly create, develop, & deploy WordPress across multiple environments.
MIT License
200 stars 18 forks source link

Ensure a round number for swap size #142

Closed EvanK closed 7 years ago

EvanK commented 8 years ago

Encountered a calculated swap size, as a float. As it happens, fallocate does not handle decimal points well:

TASK: [common | Calculate ideal swapfile size] ******************************** 
ok: [production.example.com]

TASK: [common | Fetch swapfile size] ****************************************** 
changed: [production.example.com]

TASK: [common | debug var=swapfile_size_mb.stdout] **************************** 
ok: [production.example.com] => {
    "swapfile_size_mb.stdout": "15077.5"
}

TASK: [common | fail msg="Could not determine swapfile size with available diskspace"] *** 
skipping: [production.example.com]

TASK: [common | Write swapfile] *********************************************** 
failed: [production.example.com] => {"changed": true, "cmd": ["fallocate", "-l", "15077.5M", "/swapfile"], "delta": "0:00:00.002901", "end": "2016-09-01 21:53:45.534465", "rc": 1, "start": "2016-09-01 21:53:45.531564"}
stderr: fallocate: invalid length value specified

FATAL: all hosts have already failed -- aborting

This rounds and casts to an int (in this example, 15078)