---
- name: Add Docker dependencies for Ansible
  pip: name="{{ item }}" state=present
  with_items:
    - "docker==3.5.*"
    - "docker-compose==1.22.*"

- name: Allow vagrant to run Docker
  user: name=vagrant groups=docker append=yes

- name: Fetch Node Docker Image
  docker_image: name=node tag=8 state=present

- name: Install NPM Dependencies
  docker_container:
    name: beekeepers-node
    image: node:8
    volumes:
      - "{{ beekeepers_home }}:/usr/src/app"
    working_dir: /usr/src/app
    command: yarn
    detach: no
    cleanup: yes

- name: Generate Beekeepers Bundle
  docker_container:
    name: beekeepers-node
    image: node:8
    volumes:
      - "{{ beekeepers_home }}:/usr/src/app"
    working_dir: /usr/src/app
    command: yarn build
    detach: no
    cleanup: yes

- name: Link Static Directory
  file: path="{{ beekeepers_static_root }}"
        src="{{ beekeepers_home }}/dist"
        state=link

- name: Change AWS credentials access to the icp user
  file: path="/var/lib/icp/.aws"
        group="icp"
        owner="icp"
  when: "['development', 'test'] | some_are_in(group_names)"

- name: Uninstall Docker
  apt: pkg="{{ docker_package_name }}={{ docker_version }}" state=absent
  when: "['packer'] | some_are_in(group_names)"

---
- name: Add Docker dependencies for Ansible
  pip: name="{{ item }}" state=present
  with_items:
    - "docker==3.5.*"
    - "docker-compose==1.22.*"

- name: Allow vagrant to run Docker
  user: name=vagrant groups=docker append=yes

- name: Fetch Node Docker Image
  docker_image: name=node tag=8 state=present

- name: Install NPM Dependencies
  docker_container:
    name: beekeepers-node
    image: node:8
    volumes:
      - "{{ beekeepers_home }}:/usr/src/app"
    working_dir: /usr/src/app
    command: yarn
    detach: no
    cleanup: yes

- name: Generate Beekeepers Bundle
  docker_container:
    name: beekeepers-node
    image: node:8
    volumes:
      - "{{ beekeepers_home }}:/usr/src/app"
    working_dir: /usr/src/app
    command: yarn build
    detach: no
    cleanup: yes

- name: Link Static Directory
  file: path="{{ beekeepers_static_root }}"
        src="{{ beekeepers_home }}/dist"
        state=link

- name: Change AWS credentials access to the icp user
  file: path="/var/lib/icp/.aws"
        group="icp"
        owner="icp"
  when: "['development', 'test'] | some_are_in(group_names)"

Remove Docker deinstall from beekeepers provisioning
Remove Docker deinstall from beekeepers provisioning

While we would like to be able to remove Docker from the app AMI
entirely as described in e104379a91abdb438bad70662aeefde936314d0e,
the Docker Ansible role raises an error at the end of the AMI build
if Docker is not installed. Undo the Docker deinstall step to get
AMI builds passing again.
