-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest.yml
49 lines (37 loc) · 1.13 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
- hosts: all
become: yes
vars_files:
- vars/test.yml
roles:
- .
post_tasks:
- name: test - umount swap if present
command: swapoff -a
when: ansible_swaptotal_mb != 0
register: common_test_swapoff
become: yes
- name: test - remove swap if present
lineinfile:
dest: /etc/fstab
line: "/dev/mapper/packer--virtualbox-swap_1 none swap sw 0 0"
state: absent
become: yes
- name: test - regather facts after swap off
action: setup
- include: tasks/main.yml
- name: test - write a test file to mount point
copy:
dest: /mnt/test/testing.txt
content: "testing"
- name: test - read contents of test file
command: cat /mnt/test/testing.txt
register: common_filesystem_test_file
- name: test - assert that test file contents are ok
assert:
that:
- "'testing' in common_filesystem_test_file.stdout"
- name: test - regather facts after swap on
action: setup
- name: test - run swap again for indempotency check
include: tasks/swap.yml