Merge "Bring idempotency to swapon"

This commit is contained in:
Jenkins 2017-02-09 16:24:54 +00:00 committed by Gerrit Code Review
commit 2013dbd9ef

View File

@ -13,7 +13,12 @@
# See the License for the specific language governing permissions and
# 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"
args:
creates: /openstack/swap.img
@ -21,20 +26,20 @@
tags:
- swap-file-create
- name: Set swap file permissions to 0600
- name: Set swap file permissions to 0600
file:
path: /openstack/swap.img
mode: 0600
tags:
- swap-permissions
- name: Format the swap file
- name: Format the swap file
command: mkswap /openstack/swap.img
when: swap_create | changed
tags:
- 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:
name: none
src: /openstack/swap.img
@ -46,9 +51,8 @@
tags:
- swap-fstab
- name: Bring swap file online
- name: Bring swap file online
command: swapon /openstack/swap.img
changed_when: false
tags:
- swap-online