ansible-role-systemd_mount/tests/test.yml

76 lines
2.0 KiB
YAML

---
# Copyright 2018, Rackspace US, Inc.
# Copyright 2018, Logan Vig <logan2211@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- import_playbook: test-create-swap-dev.yml
- import_playbook: test-create-nfs-dev.yml
- import_playbook: test-create-btrfs-dev.yml
- name: Playbook for role testing
hosts: localhost
connection: local
user: root
become: true
roles:
- role: "systemd_mount"
post_tasks:
- name: Ensure mount are mounted
command: grep -w '{{ item }}' /proc/mounts
with_items:
- /var/lib/sparse-file
- /var/lib/test
tags:
- skip_ansible_lint
- name: Ensure swap is enabled
shell: swapon | grep -w '/var/lib/test-swap.img'
tags:
- skip_ansible_lint
vars:
systemd_mounts:
- what: '/var/lib/sparse-file.img'
where: '/var/lib/sparse-file'
type: 'btrfs'
options: 'loop'
state: 'started'
enabled: true
config_overrides:
Unit:
ConditionPathExists: '/var/lib/sparse-file.img'
- what: "/var/lib/test-swap.img"
priority: "0"
options: "%%"
type: "swap"
state: 'started'
enabled: true
- what: "127.0.0.1:/srv/nfs/test"
where: "/var/lib/test"
type: "nfs"
options: "_netdev,auto"
state: 'started'
enabled: true
config_overrides:
Unit:
After:
? network.target
? network-online.target
Wants: network-online.target