- hosts: all vars: - ansible_python_interpreter: /usr/bin/python3 - artifacts: ./artifacts tags: - classic - container - atomic tasks: - name: create artifacts file: path: "{{ artifacts }}" state: directory delegate_to: localhost - name: do it all block: - name: calculate Silvester number command: | gawk -M 'BEGIN { s = 2 for (i = 1; i <= 7; i++) s = s * (s - 1) + 1 print s }' register: silvester - name: verify Silvester number fail: when: silvester.stdout != '113423713055421844361000443' always: - name: write log copy: content: | stderr: {{ silvester.stderr }} stdout: {{ silvester.stdout }} dest: "{{ artifacts }}/test.log" delegate_to: localhost # fetch: # dest: "{{ artifacts }}/" # src: "/tmp/test.log" # flat: yes