Merge "Bring idempotency to swapon"
This commit is contained in:
commit
2013dbd9ef
@ -13,7 +13,12 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Create swap file
|
- block:
|
||||||
|
- name: Check if swap is already enabled
|
||||||
|
command: grep /openstack/swap.img /proc/swaps
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
- name: Create swap file
|
||||||
command: "fallocate -l {{ bootstrap_host_swap_size }}G /openstack/swap.img"
|
command: "fallocate -l {{ bootstrap_host_swap_size }}G /openstack/swap.img"
|
||||||
args:
|
args:
|
||||||
creates: /openstack/swap.img
|
creates: /openstack/swap.img
|
||||||
@ -21,20 +26,20 @@
|
|||||||
tags:
|
tags:
|
||||||
- swap-file-create
|
- swap-file-create
|
||||||
|
|
||||||
- name: Set swap file permissions to 0600
|
- name: Set swap file permissions to 0600
|
||||||
file:
|
file:
|
||||||
path: /openstack/swap.img
|
path: /openstack/swap.img
|
||||||
mode: 0600
|
mode: 0600
|
||||||
tags:
|
tags:
|
||||||
- swap-permissions
|
- swap-permissions
|
||||||
|
|
||||||
- name: Format the swap file
|
- name: Format the swap file
|
||||||
command: mkswap /openstack/swap.img
|
command: mkswap /openstack/swap.img
|
||||||
when: swap_create | changed
|
when: swap_create | changed
|
||||||
tags:
|
tags:
|
||||||
- swap-format
|
- swap-format
|
||||||
|
|
||||||
- name: Ensure that the swap file entry is in /etc/fstab
|
- name: Ensure that the swap file entry is in /etc/fstab
|
||||||
mount:
|
mount:
|
||||||
name: none
|
name: none
|
||||||
src: /openstack/swap.img
|
src: /openstack/swap.img
|
||||||
@ -46,9 +51,8 @@
|
|||||||
tags:
|
tags:
|
||||||
- swap-fstab
|
- swap-fstab
|
||||||
|
|
||||||
- name: Bring swap file online
|
- name: Bring swap file online
|
||||||
command: swapon /openstack/swap.img
|
command: swapon /openstack/swap.img
|
||||||
changed_when: false
|
|
||||||
tags:
|
tags:
|
||||||
- swap-online
|
- swap-online
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user