Hello team,
i have added creates argument for the command modules as below for idempotent test, this ansible role is working good when tested in vagrant environment.
- name: Cloning a repository
git:
repo: “{{ ci_repo }}”
dest: “{{ ci_path }}”
clone: true
version: “{{ ci_branch }}”
register: cloning
when: foldercreate.changed
tags:- ci
- skip_ansible_lint
- name: Compile with maven
command: “{{ maven_create_command }}”
args:
chdir: “{{ ci_path }}”
creates: “{{ ci_path }}”
warn: false
when: cloning.changed
tags:- ci
- skip_ansible_lint
- name: Testing with maven
command: “{{ maven_test_command }}”
args:
chdir: “{{ ci_path }}”
creates: “{{ ci_path }}”
warn: false
when: cloning.changed
tags:- ci
- skip_ansible_lint
- name: Packing with maven
command: “{{ maven_artifacts_command }}”
args:
chdir: “{{ ci_path }}”
creates: “{{ ci_path }}”
warn: false
when: cloning.changed
tags:- ci
- skip_ansible_lint’
when tested in travis ci using molecule for ansible lint.
→ Scenario: ‘default’
→ Action: ‘idempotence’
ERROR: Idempotence test failed because of the following tasks:
- [instance] => hemanth22.ci : Creating a test directory
- [instance] => hemanth22.ci : Cloning a repository
- [instance] => hemanth22.ci : Compile program with maven
- [instance] => hemanth22.ci : Testing program with maven
- [instance] => hemanth22.ci : Packing program with maven
- [instance] => hemanth22.ci : Destroying test directory
An error occurred during the test sequence action: ‘idempotence’. Cleaning up.
Can you please advice.
Thanks,
Hemanth.