---
  - name: Is the OS version on the build system supported?
    assert:
      that:
        - "'{{ansible_distribution | lower}}_{{ansible_distribution_major_version}}' in supported_builder_os"

  - name: Is the requested live OS version supported?
    assert:
      that:
        - "'{{live_os}}' in supported_live_os"

  - name: Install packages on builder node (Red Hat)
    yum: >
      pkg={{item}}
      state=present
    with_items:
      - "{{builder_required_packages[ansible_os_family]}}"
    when: ansible_os_family == "RedHat"

  - name: Install packages on builder node (Debian)
    apt: >
      pkg={{item}}
      state=present
    with_items:
      - "{{builder_required_packages[ansible_os_family]}}"
    when: ansible_os_family == "Debian"

  # NOTE(major): Docker on Fedora/CentOS 7 uses socket activation with systemd,
  # so this check should always show Docker as being up as long as the docker
  # package is installed.
  - name: Ensure docker daemon is accessible
    command: docker version
    register: cmd_result
    failed_when: "'Cannot connect to the Docker daemon' in cmd_result.stderr"

---
  - name: Is the OS version on the build system supported?
    assert:
      that:
        - "'{{ansible_distribution | lower}}_{{ansible_distribution_major_version}}' in supported_builder_os"

  - name: Is the requested live OS version supported?
    assert:
      that:
        - "'{{live_os}}' in supported_live_os"

  # NOTE(major): Using "jessie/sid" causes problems later since / is used for
  # directory paths. Sigh.
  - name: Rename debian_jessie/sid to debian_jessie
    set_fact: live_os=debian_jessie
    when: live_os == 'debian_jessie/sid'

  - name: Install packages on builder node (Red Hat)
    yum: >
      pkg={{item}}
      state=present
    with_items:
      - "{{builder_required_packages[ansible_os_family]}}"
    when: ansible_os_family == "RedHat"

  - name: Install packages on builder node (Debian)
    apt: >
      pkg={{item}}
      state=present
    with_items:
      - "{{builder_required_packages[ansible_os_family]}}"
    when: ansible_os_family == "Debian"

  # NOTE(major): Docker on Fedora/CentOS 7 uses socket activation with systemd,
  # so this check should always show Docker as being up as long as the docker
  # package is installed.
  - name: Ensure docker daemon is accessible
    command: docker version
    register: cmd_result
    failed_when: "'Cannot connect to the Docker daemon' in cmd_result.stderr"

Rename debian_jessie/sid to something more manageable
Rename debian_jessie/sid to something more manageable
