Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caching works incorrectly if with_items specified #229

Open
ihanick opened this issue May 25, 2020 · 1 comment
Open

caching works incorrectly if with_items specified #229

ihanick opened this issue May 25, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@ihanick
Copy link

ihanick commented May 25, 2020

The first run works correctly.
The second run returns:

ansible-bender --version
0.8.2.dev19+ga13178d

ansible-bender build playbook.yaml
TASK [Run a sample command] *******************************************************************************************************************************************************************
loaded from cache: '6ad04db0b455e5d908d45ef18c2213302e1ee18a08cd359e2c6dbb46152bc07e'
skipping: [bug-copy-cache-20200525-112800188925-cont] => (item=a)
skipping: [bug-copy-cache-20200525-112800188925-cont] => (item=b)
skipping: [bug-copy-cache-20200525-112800188925-cont] => (item=c)

TASK [Creates a file with contents] ***********************************************************************************************************************************************************
fatal: [bug-copy-cache-20200525-112800188925-cont]: FAILED! => {"changed": false, "checksum": "e23b0534d0708167023aba6f65ef83afe38d52df", "msg": "Destination directory /opt/b does not exist"}
loaded from cache: 'df1437da1fe6061c3551eeb1b2a93d4dc0a05ec8a6f880f399c0a077365d6d21'

playbook.yaml:

---
- name: Demonstration of ansible-bender functionality
  hosts: all
  vars:
    ansible_bender:
      base_image: python:3-alpine

      working_container:
        volumes:
          - '{{ playbook_dir }}:/src'

      target_image:
        name: bug-copy-cache
        working_dir: /src
  tasks:
  - name: Run a sample command
    shell:
      cmd: 'mkdir /opt/{{item}};touch /opt/{{item}}/.empty'
      creates: /opt/{{item}}/.empty
    with_items:
      - a
      - b
      - c
  - name: Creates a file with contents
    copy:
      content: |
        First line
        Second line
      dest: /opt/b/file1
@TomasTomecek
Copy link
Collaborator

Hm, this is interesting. Seems like there is something special about loops.

@TomasTomecek TomasTomecek added the bug Something isn't working label Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants