diff --git a/.travis.yml b/.travis.yml index 48fe2bb..00b7d3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,9 +37,9 @@ install: before_script: cd tests/ script: - ansible-playbook -i inventory deploy.yml --syntax-check -- ansible-playbook -i inventory -v deploy.yml -- 'ANSIBLE_STDOUT_CALLBACK=debug unbuffer ansible-playbook -vvi inventory - deploy.yml > play.log || (e=$?; cat play.log; exit $e); printf "Idempotence: "; +- ANSIBLE_DISPLAY_SKIPPED_HOSTS=no ansible-playbook -i inventory deploy.yml +- 'ANSIBLE_STDOUT_CALLBACK=debug ANSIBLE_DISPLAY_SKIPPED_HOSTS=no ANSIBLE_DISPLAY_OK_HOSTS=no + unbuffer ansible-playbook -vvi inventory deploy.yml &>play.log; printf "Idempotence: "; grep -A1 "PLAY RECAP" play.log | grep -qP "changed=0 .*failed=0 .*" && (echo "PASS"; exit 0) || (echo "FAIL"; cat play.log; exit 1)' - ANSIBLE_STDOUT_CALLBACK=debug ansible-playbook -i inventory -v test.yml diff --git a/README.md b/README.md index 052f572..311c6e4 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ script: # Validates your deployment playbook's syntax, which should contain your role - ansible-playbook -i inventory deploy.yml --syntax-check # Runs the deployment playbook -- ansible-playbook -i inventory -v deploy.yml +- ansible-playbook -i inventory deploy.yml # Runs the deployment playbook again, saving output to a file called play.log, # then checks that there are no changed/failed tasks and fails if there are. -- 'ANSIBLE_STDOUT_CALLBACK=debug unbuffer ansible-playbook -vv -i inventory - deploy.yml > play.log || (e=$?; cat play.log; exit $e); printf "Idempotence: "; +- 'ANSIBLE_STDOUT_CALLBACK=debug ANSIBLE_DISPLAY_SKIPPED_HOSTS=no ANSIBLE_DISPLAY_OK_HOSTS=no + unbuffer ansible-playbook -vvi inventory deploy.yml &>play.log; printf "Idempotence: "; grep -A1 "PLAY RECAP" play.log | grep -qP "changed=0 .*failed=0 .*" && (echo "PASS"; exit 0) || (echo "FAIL"; cat play.log; exit 1)' # Integration tests and what not @@ -61,7 +61,7 @@ build process, but the following is what typically serves most purposes: test_profiles: - profile: debian-buster - profile: ubuntu-focal - - profile: centos-8 + - profile: centos-7 - profile: alpine-v3.11 # Add any other setup tasks you might need but don't necessarily need in your role @@ -122,7 +122,7 @@ And finally, the inventory: ```ini debian-buster-01 ubuntu-focal-01 -centos-8-01 +centos-7-01 alpine-v3-11-01 ``` @@ -199,12 +199,9 @@ test_profiles: - profile: alpine-v3.11 - profile: alpine-v3.10 - profile: alpine-v3.9 - - profile: centos-8 - profile: centos-7 - profile: debian-buster - profile: debian-stretch - - profile: fedora-32 - - profile: fedora-31 - profile: ubuntu-focal - profile: ubuntu-bionic - profile: ubuntu-xenial @@ -223,8 +220,6 @@ test_profiles: - profile: centos-6 - profile: debian-jessie - profile: debian-wheezy - - profile: fedora-30 - - profile: fedora-29 - profile: fedora-28 - profile: fedora-27 - profile: fedora-26 diff --git a/tests/deploy.yml b/tests/deploy.yml index 9f42274..661903f 100644 --- a/tests/deploy.yml +++ b/tests/deploy.yml @@ -9,16 +9,13 @@ - m4 test_hosts_per_profile: 2 test_profiles: + - profile: alpine-v3.11 + - profile: alpine-v3.10 + - profile: alpine-v3.9 + - profile: centos-7 - profile: debian-buster prefix: debian-buster-test- - profile: debian-stretch - - profile: debian-jessie - - profile: centos-7 - - profile: centos-6 + - profile: ubuntu-focal - profile: ubuntu-bionic - profile: ubuntu-xenial - - profile: fedora-28 - - profile: fedora-27 - - profile: alpine-v3.8 - - profile: alpine-v3.7 - - profile: alpine-v3.6 diff --git a/tests/inventory b/tests/inventory index e32dbd8..680a67e 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,14 +1,9 @@ +alpine-v3-[9:11]-[01:02] +centos-7-[01:02] # following is used when testing that test_profiles.*.prefix works debian-buster-test-[01:02] # the rest are standard fare -debian-jessie-[01:02] debian-stretch-[01:02] -centos-7-[01:02] -centos-6-[01:02] +ubuntu-focal-[01:02] ubuntu-bionic-[01:02] ubuntu-xenial-[01:02] -fedora-28-[01:02] -fedora-27-[01:02] -alpine-v3-8-[01:02] -alpine-v3-7-[01:02] -alpine-v3-6-[01:02] diff --git a/vars/main.yml b/vars/main.yml index e183ded..ec08ed5 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -3,88 +3,101 @@ # Profile names should always be $template-$release in that they can be passed # to lxc-create as-is. Prefixes should only contain [a-z0-9-]. travis_lxc_profiles: - debian-wheezy: - label: "Debian Wheezy (7)" - prefix: debian-wheezy- + alpine-v3.11: + label: "Alpine v3.11" + prefix: alpine-v3-11- packages: - python - ca-certificates - - curl - sudo - - gnupg2 - rootfs: /var/cache/lxc/debian/rootfs-wheezy-amd64 + - openssh + - bash + - shadow + rootfs: /var/cache/lxc/alpine/apk/x86_64 rootfs_exclude: - "/*.pyc" - debian-jessie: - label: "Debian Jessie (8)" - prefix: debian-jessie- + alpine-v3.10: + label: "Alpine v3.10" + prefix: alpine-v3-10- packages: - python - ca-certificates - - curl - sudo - - gnupg2 - rootfs: /var/cache/lxc/debian/rootfs-jessie-amd64 + - openssh + - bash + - shadow + rootfs: /var/cache/lxc/alpine/apk/x86_64 rootfs_exclude: - "/*.pyc" - debian-stretch: - label: "Debian Stretch (9)" - prefix: debian-stretch- + alpine-v3.9: + label: "Alpine v3.9" + prefix: alpine-v3-9- packages: - python - ca-certificates - - curl - sudo - - gnupg2 - rootfs: /var/cache/lxc/debian/rootfs-stretch-amd64 + - openssh + - bash + - shadow + rootfs: /var/cache/lxc/alpine/apk/x86_64 rootfs_exclude: - "/*.pyc" - debian-buster: - label: "Debian Buster (10)" - prefix: debian-buster- + alpine-v3.8: + label: "Alpine v3.8" + prefix: alpine-v3-8- packages: - python - ca-certificates - - curl - sudo - - gnupg2 - rootfs: /var/cache/lxc/debian/rootfs-buster-amd64 + - openssh + - bash + - shadow + rootfs: /var/cache/lxc/alpine/apk/x86_64 rootfs_exclude: - "/*.pyc" - ubuntu-trusty: - label: "Ubuntu Trusty Tahr (14.04)" - prefix: ubuntu-trusty- + alpine-v3.7: + label: "Alpine v3.7" + prefix: alpine-v3-7- packages: - python - ca-certificates - - curl - sudo - rootfs: /var/cache/lxc/trusty/rootfs-amd64 + - openssh + - bash + - shadow + rootfs: /var/cache/lxc/alpine/apk/x86_64 rootfs_exclude: - "/*.pyc" - ubuntu-xenial: - label: "Ubuntu Xenial Xerus (16.04)" - prefix: ubuntu-xenial- + alpine-v3.6: + label: "Alpine v3.6" + prefix: alpine-v3-6- packages: - python - ca-certificates - - curl - sudo - rootfs: /var/cache/lxc/xenial/rootfs-amd64 + - openssh + - bash + - shadow + rootfs: /var/cache/lxc/alpine/apk/x86_64 rootfs_exclude: - "/*.pyc" - ubuntu-bionic: - label: "Ubuntu Bionic Beaver (18.04)" - prefix: ubuntu-bionic- + centos-7: + label: "CentOS 7" + prefix: centos-7- packages: - python - ca-certificates - - curl - sudo - - gnupg2 - rootfs: /var/cache/lxc/bionic/rootfs-amd64 + - redhat-lsb-core + - yum-plugin-ovl + environment: + root_expire_password: no + rootfs: /var/cache/lxc/centos/x86_64/7/rootfs rootfs_exclude: - "/*.pyc" + - /var/cache/yum + - /var/lib/yum/uuid + - "/var/lib/rpm/_db.*" centos-6: label: "CentOS 6" prefix: centos-6- @@ -102,26 +115,76 @@ travis_lxc_profiles: - /var/cache/yum - /var/lib/yum/uuid - "/var/lib/rpm/_db.*" - centos-7: - label: "CentOS 7" - prefix: centos-7- + debian-buster: + label: "Debian Buster (10)" + prefix: debian-buster- packages: - python - ca-certificates + - curl + - sudo + - gnupg2 + rootfs: /var/cache/lxc/debian/rootfs-buster-amd64 + rootfs_exclude: + - "/*.pyc" + debian-stretch: + label: "Debian Stretch (9)" + prefix: debian-stretch- + packages: + - python + - ca-certificates + - curl + - sudo + - gnupg2 + rootfs: /var/cache/lxc/debian/rootfs-stretch-amd64 + rootfs_exclude: + - "/*.pyc" + debian-jessie: + label: "Debian Jessie (8)" + prefix: debian-jessie- + packages: + - python + - ca-certificates + - curl + - sudo + - gnupg2 + rootfs: /var/cache/lxc/debian/rootfs-jessie-amd64 + rootfs_exclude: + - "/*.pyc" + debian-wheezy: + label: "Debian Wheezy (7)" + prefix: debian-wheezy- + packages: + - python + - ca-certificates + - curl + - sudo + - gnupg2 + rootfs: /var/cache/lxc/debian/rootfs-wheezy-amd64 + rootfs_exclude: + - "/*.pyc" + fedora-28: + label: "Fedora 28" + prefix: fedora-28- + packages: + - python2 + - ca-certificates - sudo - - redhat-lsb-core - yum-plugin-ovl environment: root_expire_password: no - rootfs: /var/cache/lxc/centos/x86_64/7/rootfs + rootfs: /var/cache/lxc/fedora/28-x86_64/rootfs rootfs_exclude: - "/*.pyc" - - /var/cache/yum - - /var/lib/yum/uuid + - /var/cache/dnf - "/var/lib/rpm/_db.*" - fedora-25: - label: "Fedora 25" - prefix: fedora-25- + - /var/lib/rpm/.dbenv.lock + - /etc/resolv.conf + - "/var/log/dnf*.log" + - /var/log/hawkey.log + fedora-27: + label: "Fedora 27" + prefix: fedora-27- packages: - python2 - ca-certificates @@ -129,14 +192,13 @@ travis_lxc_profiles: - yum-plugin-ovl environment: root_expire_password: no - rootfs: /var/cache/lxc/fedora/25-x86_64/rootfs + rootfs: /var/cache/lxc/fedora/27-x86_64/rootfs rootfs_exclude: - "/*.pyc" - /var/cache/dnf - "/var/lib/rpm/_db.*" + - /var/lib/rpm/.dbenv.lock - /etc/resolv.conf - - /etc/pki/nssdb/key*.db - - /etc/pki/nssdb/cert*.db - "/var/log/dnf*.log" - /var/log/hawkey.log fedora-26: @@ -159,9 +221,9 @@ travis_lxc_profiles: - /etc/pki/nssdb/cert*.db - "/var/log/dnf*.log" - /var/log/hawkey.log - fedora-27: - label: "Fedora 27" - prefix: fedora-27- + fedora-25: + label: "Fedora 25" + prefix: fedora-25- packages: - python2 - ca-certificates @@ -169,71 +231,60 @@ travis_lxc_profiles: - yum-plugin-ovl environment: root_expire_password: no - rootfs: /var/cache/lxc/fedora/27-x86_64/rootfs + rootfs: /var/cache/lxc/fedora/25-x86_64/rootfs rootfs_exclude: - "/*.pyc" - /var/cache/dnf - "/var/lib/rpm/_db.*" - - /var/lib/rpm/.dbenv.lock - /etc/resolv.conf + - /etc/pki/nssdb/key*.db + - /etc/pki/nssdb/cert*.db - "/var/log/dnf*.log" - /var/log/hawkey.log - fedora-28: - label: "Fedora 28" - prefix: fedora-28- + ubuntu-focal: + label: "Ubuntu Focal Fossa (20.04)" + prefix: ubuntu-focal- packages: - - python2 + - python - ca-certificates + - curl - sudo - - yum-plugin-ovl - environment: - root_expire_password: no - rootfs: /var/cache/lxc/fedora/28-x86_64/rootfs + - gnupg2 + rootfs: /var/cache/lxc/focal/rootfs-amd64 rootfs_exclude: - "/*.pyc" - - /var/cache/dnf - - "/var/lib/rpm/_db.*" - - /var/lib/rpm/.dbenv.lock - - /etc/resolv.conf - - "/var/log/dnf*.log" - - /var/log/hawkey.log - alpine-v3.8: - label: "Alpine v3.8" - prefix: alpine-v3-8- + ubuntu-bionic: + label: "Ubuntu Bionic Beaver (18.04)" + prefix: ubuntu-bionic- packages: - python - ca-certificates + - curl - sudo - - openssh - - bash - - shadow - rootfs: /var/cache/lxc/alpine/apk/x86_64 + - gnupg2 + rootfs: /var/cache/lxc/bionic/rootfs-amd64 rootfs_exclude: - "/*.pyc" - alpine-v3.7: - label: "Alpine v3.7" - prefix: alpine-v3-7- + ubuntu-xenial: + label: "Ubuntu Xenial Xerus (16.04)" + prefix: ubuntu-xenial- packages: - python - ca-certificates + - curl - sudo - - openssh - - bash - - shadow - rootfs: /var/cache/lxc/alpine/apk/x86_64 + rootfs: /var/cache/lxc/xenial/rootfs-amd64 rootfs_exclude: - "/*.pyc" - alpine-v3.6: - label: "Alpine v3.6" - prefix: alpine-v3-6- + ubuntu-trusty: + label: "Ubuntu Trusty Tahr (14.04)" + prefix: ubuntu-trusty- packages: - python - ca-certificates + - curl - sudo - - openssh - - bash - - shadow - rootfs: /var/cache/lxc/alpine/apk/x86_64 + rootfs: /var/cache/lxc/trusty/rootfs-amd64 rootfs_exclude: - "/*.pyc" travis_lxc_packages: