---
- hosts: 127.0.0.1
  connection: local

  tasks:
    - name: Copy ECR login shell script
      become: yes
      copy: src=files/ecr-login.sh dest=/usr/local/bin/ecr-login.sh mode=0755

    - name: Run the ECR login now for good measure
      become: yes
      become_user: buildkite-agent
      command: /usr/local/bin/ecr-login.sh

    - name: Add it to the crontab
      become: yes
      become_user: buildkite-agent
      cron:
        name: "ECR login"
        job: "/usr/local/bin/ecr-login.sh 2>&1 /dev/null"
        state: present
        minute: "*/10"

    - name: Pull supporting Docker images
      become: yes
      become_user: buildkite-agent
      command: docker pull "{{ item }}"
      with_items:
        - "984601232468.dkr.ecr.us-west-2.amazonaws.com/caremonkey/cm-builder:3"
        - "postgres:9.4"
        - "memcached:1.4-alpine"
        - "redis:2.8.19"

---
- hosts: 127.0.0.1
  connection: local

  tasks:
    - name: Copy ECR login shell script
      become: yes
      copy: src=files/ecr-login.sh dest=/usr/local/bin/ecr-login.sh mode=0755

    - name: Run the ECR login now for good measure
      become: yes
      become_user: buildkite-agent
      command: /usr/local/bin/ecr-login.sh

    - name: Add it to the crontab
      become: yes
      become_user: buildkite-agent
      cron:
        name: "ECR login"
        job: "/usr/local/bin/ecr-login.sh 2>&1 /dev/null"
        state: present
        minute: "*/10"

    - name: Pull supporting Docker images
      become: yes
      become_user: buildkite-agent
      command: docker pull "{{ item }}"
      with_items:
        - "984601232468.dkr.ecr.us-west-2.amazonaws.com/caremonkey/cm-builder:20"
        - "postgres:9.4"
        - "memcached:1.4-alpine"
        - "redis:2.8.19"

Refresh the default pulled builder image version
Refresh the default pulled builder image version
