Skip to content

Commit

Permalink
Travis CI: Verify that Ansible check mode passes
Browse files Browse the repository at this point in the history
For sake of CI speed, the check mode is verified only against one
container (the latest version of each operating system platform).
Such check is performed before, and after, the Ansible role has been
applied to the managed instance.
  • Loading branch information
gildegoma committed Aug 2, 2020
1 parent 8f6be46 commit bb22033
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ install:

script:
- cd tests
- docker-compose config --services | grep $PLATFORM | xargs docker-compose up -d
- ansible-playbook $PLAYBOOK -l $PLATFORM
- docker-compose config --services | grep "$PLATFORM" | xargs docker-compose up -d
- ansible-playbook $PLAYBOOK -l "$PLATFORM:&latest" --check --diff
- ansible-playbook $PLAYBOOK -l "$PLATFORM" -vv
- ansible-playbook $PLAYBOOK -l "$PLATFORM:&latest" --check --diff

before_cache:
# Put docker images used during this run into travis cache (if not already cached).
Expand Down
5 changes: 5 additions & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ tests_ubuntu14_1 ansible_connection=docker
tests_ubuntu16_1 ansible_connection=docker
tests_ubuntu18_1 ansible_connection=docker
tests_ubuntu20_1 ansible_connection=docker

[latest]
tests_centos8_1
tests_debian10_1
tests_ubuntu20_1
1 change: 1 addition & 0 deletions tests/root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
rvm1_install_path: '/opt/rvm'
tasks:
- import_tasks: assertions.yml
when: not ansible_check_mode
tags: validate
1 change: 1 addition & 0 deletions tests/user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
rvm1_install_path: '/home/user/.rvm'
tasks:
- import_tasks: assertions.yml
when: not ansible_check_mode
tags: validate

0 comments on commit bb22033

Please sign in to comment.