- name: Create directories
  file:
    name: "{{ item }}"
    state: directory
    mode: 0755
    owner: root
    group: wheel
  loop:
    - /chroot
    - /chroot/readonly
    - /chroot/readwrite

- name: Create directories
  file:
    name: "{{ item }}"
    state: directory
    mode: 0755
    owner: nochainstounlock
    group: nochainstounlock
  loop:
    - /chroot/readonly/downloads
    - /chroot/readonly/incomplete
    - /chroot/readwrite/downloads
    - /chroot/readwrite/incomplete

- name: Create directories
  file:
    name: "{{ item }}"
    state: directory
    mode: 0755
    owner: 11235
    group: nochainstounlock
  loop:
    - /chroot/readonly/library
    - /chroot/readwrite/library

# - name: Install scripts
#   copy:
#     src: "files/{{ item.src }}"
#     dest: "{{ item.dest }}"
#     mode: 0755
#     owner: root
#     group: wheel
#   loop:
#     - src: foo.bash
#       dest: /usr/local/bin/foo

- name: Install Configuration
  copy:
    src: "files/{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: 0644
    owner: root
    group: wheel
  loop:
    - src: sshd_config
      dest: /etc/ssh/sshd_config

# - name: Clone Source
#   git:
#     repo: "https://foo.bar/baz.git"
#     dest: /foo/bar
#     version: "v1.0.2"
#     force: true
#   diff: false

- import_tasks: tasks/freebsd.yaml
  when: 'os_flavor == "freebsd"'

- import_tasks: tasks/linux.yaml
  when: 'os_flavor == "linux"'
