document.write("
---
- name: Verify
hosts: all
tasks:
- name: Gather the package manager facts
package_facts:
manager: auto
- name: Assert that following packages are installed
assert:
that:
- "'docker-ce' in ansible_facts.packages"
- "'kubelet' in ansible_facts.packages"
- "'kubectl' in ansible_facts.packages"
- "'kubeadm' in ansible_facts.packages"
Ansible way - Snippet hosted by \"Cacher\"
import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize('pkg', [
'docker-ce',
'kubelet',
'kubectl',
'kubeadm'
])
def test_pkg(host, pkg):
package = host.package(pkg)
assert package.is_installed
Testinfra way - Snippet hosted by \"Cacher\"
");