diff --git a/detectors/detector-desktop/controller/assets/vm/Vagrantfile.template b/detectors/detector-desktop/controller/assets/vm/Vagrantfile.template index 499a705f..8e85ab01 100644 --- a/detectors/detector-desktop/controller/assets/vm/Vagrantfile.template +++ b/detectors/detector-desktop/controller/assets/vm/Vagrantfile.template @@ -109,10 +109,18 @@ Vagrant.configure("2") do |config| config.vm.provision "ansible_local" do |ansible| ansible.playbook = "ansible/base/provision.yml" end + + # Installs 2Keys from source! + # TODO: Remove this once PyPi package published and before closing #72 + config.vm.provision "ansible_local" do |ansible| + ansible.playbook = "ansible/base/twokeys-oss.yml" + end + ## PROVISIONING SCRIPT TO SETUP CLIENT ## config.vm.provision "ansible_local" do |ansible| ansible.playbook = "ansible/client/provision.yml" end + # 2KEYS BEGIN CUSTOM ANSIBLE PROVISING SCRIPTS ## PROVISING SCRIPTS TO SETUPP PROJECTS, KEYBOARDS ETC {{{ twokeys_insert_ansible_provising }}} diff --git a/detectors/detector-desktop/controller/assets/vm/ansible/base/provision.yml b/detectors/detector-desktop/controller/assets/vm/ansible/base/provision.yml index 58712d93..814e7221 100644 --- a/detectors/detector-desktop/controller/assets/vm/ansible/base/provision.yml +++ b/detectors/detector-desktop/controller/assets/vm/ansible/base/provision.yml @@ -64,7 +64,8 @@ apk: name: linux-headers,build-base,python3-dev state: present - - name: Install 2Keys - become: true - pip: - name: 2Keys \ No newline at end of file + # TODO: Reenable once PyPi package published and don't want to build from source anymore + #- name: Install 2Keys + # become: true + # pip: + # name: 2Keys \ No newline at end of file diff --git a/detectors/detector-desktop/controller/assets/vm/ansible/base/twokeys-oss.yml b/detectors/detector-desktop/controller/assets/vm/ansible/base/twokeys-oss.yml new file mode 100644 index 00000000..cc533864 --- /dev/null +++ b/detectors/detector-desktop/controller/assets/vm/ansible/base/twokeys-oss.yml @@ -0,0 +1,54 @@ +# Ansible provisioning for alpine +# used to install 2Keys from the Open Source repo (useful for testing new feratures without publishing to PyPi) +# MUST RUN IN TANDEM WITH PROVISION.YML +--- +- hosts: all + vars: + oss_branch: "v1.0.0-detector-improvements-1" # TODO: Change this variable when switching branch (and before merging #148) + oss_root: /support + oss_dirname: "{{ oss_root }}/twokeys" + oss_python_location: "{{ oss_dirname }}/detectors/detector-pi/detector" + oss_python_common_location: "{{ oss_dirname }}/detectors/common/python" + tasks: + - name: Update package index + become: true + apk: + update_cache: yes + - name: Install Git + become: true + apk: + name: git + state: present + - name: Install Pipenv + become: true + pip: + name: pipenv + - name: Create source directory + become: true + file: + path: "{{ oss_root }}" # We install all support sofwtare code here + state: directory + - name: Clone 2Keys + become: true + git: + repo: "https://github.com/Gum-Joe/2Keys" + dest: "{{ oss_dirname }}" + version: "{{ oss_branch }}" + + - name: Install Dependencies for 2Keys Common + become: true + command: "chdir={{ oss_python_common_location }} pipenv install --system --dev" + - name: Install 2Keys Common + become: true + command: "chdir={{ oss_python_common_location }} pip install ." + + - name: Install 2Keys dependencies + become: true + command: "chdir={{ oss_python_location }} pipenv install --system --dev" + - name: Install 2Keys + become: true + command: "chdir={{ oss_python_location }} pip install ." + + - name: Validate + become: true + command: 2Keys --help