---
# Bootstrap an OpenBSD machine to be able to run Ansible on it.

- name: Install Python
  raw: "PKG_PATH={{ openbsd_pkg_mirror }}/OpenBSD/$(uname -r)/packages/$(arch -s)/ /usr/sbin/pkg_add py-pip"
  register: openbsd_pkg_add_python
  changed_when: "'python' in openbsd_pkg_add_python.stdout"

- name: Symlink python
  file:
    path: /usr/bin/python
    src: /usr/local/bin/python2.7
    state: link
    force: yes

- name: Gather facts
  setup:

- name: Configure pkg
  lineinfile:
    dest: /etc/pkg.conf
    line: 'installpath = {{ openbsd_pkg_mirror }}/OpenBSD/{{ ansible_distribution_release }}/packages/{{ ansible_architecture }}/'
    regexp: '^installpath ='
    state: present
    create: yes
