diff --git a/.travis.yml b/.travis.yml index 9d95094..6cd148a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,14 +19,26 @@ install: # Check ansible version - ansible --version - # Create ansible.cfg with correct roles_path - - 'printf "[defaults]\nroles_path=../" > ansible.cfg' + # Create ansible.cfg with correct roles_path and log file path + - touch ansible.log && { printf "[defaults]\nroles_path=../\nlog_path=ansible.log" > ansible.cfg; } env: - ANSIBLE_HOST_KEY_CHECKING=False script: - ansible-playbook tests/test.yml -v + - > + ansible-playbook tests/test.yml -v + | grep -q 'changed=0.*failed=0' + && (echo 'Idempotence test: pass' && exit 0) + || (echo 'Idempotence test: fail' && exit 1) + +after_failure: + - sudo tail -n 100 /var/log/syslog + - ls -l /var/log/riak + - ls /var/log/riak/error.log* && cat $(ls -tr /var/log/riak/error.log*) + - ls /var/log/riak/solr.log* && cat $(ls -tr /var/log/riak/solr.log*) + - cat ansible.log notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/tasks/buckets.yml b/tasks/buckets.yml index d2fcef0..d9ff357 100644 --- a/tasks/buckets.yml +++ b/tasks/buckets.yml @@ -1,6 +1,7 @@ --- - name: Fetch existing bucket-types command: '{{ riak_admin }} bucket-type list' + changed_when: False register: types - name: Create bucket types only if not found in list diff --git a/tasks/main.yml b/tasks/main.yml index a8e5f7c..0b46318 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,6 +44,7 @@ - name: Reboot Riak to accept the new config and ensure it is enabled to start at bootup service: name=riak enabled=yes state=restarted when: riak_init_system == 'system' + changed_when: False ## This is a workaround for not disrupting idempotency. The proper idempotency fix would be running the task only when the relevant config files changed. - name: Wait for Riak to start up before continuing wait_for: "delay=5 timeout=30 host={{ riak_pb_bind_ip }} port={{ riak_pb_port }} state=started" diff --git a/tasks/security.yml b/tasks/security.yml index a54856f..3307682 100644 --- a/tasks/security.yml +++ b/tasks/security.yml @@ -7,23 +7,28 @@ command: '{{ riak_admin }} security add-group {{ item }}' with_items: '{{ riak_groups }}' when: riak_groups is defined + changed_when: False ## This is a workaround for not disrupting idempotency. - name: Create users command: '{{ riak_admin }} security add-user {{ item.user }} password={{ item.password }} groups={{ item.groups }}' with_items: "{{ riak_users }}" when: (riak_users is defined) and (riak_groups is defined) + changed_when: False ## This is a workaround for not disrupting idempotency. - name: Create users command: '{{ riak_admin }} security add-user {{ item.user }} password={{ item.password }}' with_items: "{{ riak_users }}" when: (riak_users is defined) and (riak_groups is not defined) + changed_when: False ## This is a workaround for not disrupting idempotency. - name: Create security sources command: '{{ riak_admin }} security add-source {{ item.user }} {{ item.cidr }} {{ item.type }}' with_items: '{{ riak_sources }}' when: riak_sources is defined + changed_when: False ## This is a workaround for not disrupting idempotency. - name: Set security permissions command: '{{ riak_admin }} security grant {{ item.permissions }} on {{ item.scope }} to {{ item.subject }}' with_items: '{{ riak_grants }}' when: riak_grants is defined + changed_when: False ## This is a workaround for not disrupting idempotency.