# Update ports tree:
#   portshaker -U
#   portshaker -M
#
# Force build:
#   poudriere bulk -J 4 -C -j current -p default -z testing sysutils/kubectx
#
# Test build with interactive shell
#   poudriere testport -i -J 4 -j current -p default -z testing sysutils/kubectx
#   optional add -w to save the work directory

- name: Install packages
  package:
    name:
      - portshaker
      - git
    state: present

- name: Create directories
  file:
    name: "{{ item }}"
    state: directory
    mode: 0755
    owner: root
    group: wheel
  loop:
    - /usr/local/portshaker/trees

- name: Install Configuration
  copy:
    src: "files/{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: 0644
    owner: root
    group: wheel
  loop:
    - src: portshaker.conf
      dest: /usr/local/etc/portshaker.conf

- name: Install Scripts
  copy:
    src: "files/{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: 0755
    owner: root
    group: wheel
  loop:
    - src: freebsd
      dest: /usr/local/etc/portshaker.d/freebsd
    - src: myrepo
      dest: /usr/local/etc/portshaker.d/myrepo
