| 1 | #!/usr/bin/env bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | set -e |
| 5 | set -o pipefail |
| 6 | |
| 7 | profile="xccdf_moc.elpmaxe.www_profile_standard" |
| 8 | |
| 9 | name=$(basename $0 .sh) |
| 10 | stderr=$(mktemp -t ${name}.err.XXXXXX) |
| 11 | playbook=$(mktemp -t ${name}.yml.XXXXXX) |
| 12 | playbook_without_header=$(mktemp -t ${name}.yml.XXXXXX) |
| 13 | |
| 14 | # Generate an Ansible playbook from a profile in SDS file |
| 15 | $OSCAP xccdf generate fix --profile $profile --fix-type ansible "$srcdir/$name.xccdf.xml" >$playbook 2>$stderr |
| 16 | sed '/^#/d' $playbook > $playbook_without_header |
| 17 | diff -u $playbook_without_header $srcdir/$name.playbook.yml |
| 18 | [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr |
| 19 | |
| 20 | rm $playbook |
| 21 | rm $playbook_without_header |