From c1162be7f1746761e686fca53082dc72c4e8151d Mon Sep 17 00:00:00 2001 From: tobias-richter Date: Wed, 8 Aug 2018 18:37:59 +0200 Subject: [PATCH] Add travis and ansible-lint (#4) * Add travis and ansible-lint * Fix ansible-lint issues * Fix missing pip packages --- .ansible-lint | 2 ++ .travis.yml | 33 +++++++++++++++++++++++++++++++++ tasks/main.yml | 4 +++- tests/inventory | 3 +++ tests/test.yml | 4 ++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .ansible-lint create mode 100644 .travis.yml create mode 100644 tests/inventory create mode 100644 tests/test.yml diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..6236b62 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,2 @@ +exclude_paths: + - ./tests/requirements \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ac011e3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +--- +language: python +cache: pip +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install pip +addons: + apt: + packages: + - python-pip + +install: + # Install ansible and dependencies + - pip install ansible ansible-lint + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=./tests/requirements/:../' >ansible.cfg + +script: + # Run ansible-lint + - ansible-lint . + + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 44488fe..b82f7a1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -35,7 +35,9 @@ shell: "{{ _mvn_cmdline }}" args: chdir: "{{ conga_basedir }}" - tags: conga-maven-compile + tags: + - conga-maven-compile + - skip_ansible_lint - name: Set fact that CONGA configuration was generated set_fact: conga_configuration_generated=true \ No newline at end of file diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..e03e58f --- /dev/null +++ b/tests/inventory @@ -0,0 +1,3 @@ +[test] +localhost + diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..d3dcd0f --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,4 @@ +- name: test role syntax + hosts: test + roles: + - ansible-conga-maven \ No newline at end of file