summaryrefslogtreecommitdiff
path: root/pkg/windows
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2018-05-02 19:39:08 +0200
committerKali Kaneko <kali@leap.se>2018-05-02 19:39:08 +0200
commit819870642d1a783208d78156e802c1ad15b73321 (patch)
treed0790b0d1de1d4ee1a6ff5dbd80bacdad581dd2c /pkg/windows
parent1a3751c2406db693dd08954157376ab329331c3a (diff)
[pkg] add ansible scripts for bootstrapping windows env
Diffstat (limited to 'pkg/windows')
-rw-r--r--pkg/windows/ansible/01_bitmask_deps.yml58
-rw-r--r--pkg/windows/ansible/02_bitmask_virtualenv.yml37
-rw-r--r--pkg/windows/ansible/Makefile9
-rw-r--r--pkg/windows/ansible/README23
-rw-r--r--pkg/windows/ansible/hosts.sample11
-rw-r--r--pkg/windows/ansible/reboot.yml9
-rw-r--r--pkg/windows/ansible/rmvirtualenv.yml9
7 files changed, 156 insertions, 0 deletions
diff --git a/pkg/windows/ansible/01_bitmask_deps.yml b/pkg/windows/ansible/01_bitmask_deps.yml
new file mode 100644
index 00000000..d69aa9ab
--- /dev/null
+++ b/pkg/windows/ansible/01_bitmask_deps.yml
@@ -0,0 +1,58 @@
+########################################################################
+# Playbook to bootstrap a bitmask development environment in
+# a windows base image (install system dependencies).
+#
+# Make sure to follow the instructions in
+# https://docs.ansible.com/ansible/devel/user_guide/windows_setup.html
+# before running this playbook.
+# You also need to install win_git plugin:
+# https://github.com/tivrobo/ansible-win_git
+########################################################################
+
+- hosts: all
+ gather_facts: false
+ tasks:
+ - name: create leap directory
+ win_file:
+ path: C:\leap
+ state: directory
+
+ - name: create ssh folder
+ win_file:
+ path: C:\Users\admin\.ssh\
+ state: directory
+
+ - name: touch ssh hosts file
+ win_file:
+ path: C:\Users\admin\.ssh\known_hosts
+ state: file
+
+ - name: install dev requirements
+ win_chocolatey:
+ name: '{{ item }}'
+ state: present
+ with_items:
+ - git
+ - poshgit
+ - wget
+ - curl
+ - 7zip
+ - python2
+ - nssm
+ - nsis
+ - mingw
+ - nim
+ - golang
+
+ - name: install developer tools
+ win_chocolatey:
+ name: '{{ item }}'
+ state: present
+ with_items:
+ - vim
+ - openssh
+
+ - name: upgrade all the packages
+ win_chocolatey:
+ name: all
+ state: latest
diff --git a/pkg/windows/ansible/02_bitmask_virtualenv.yml b/pkg/windows/ansible/02_bitmask_virtualenv.yml
new file mode 100644
index 00000000..fed36a0c
--- /dev/null
+++ b/pkg/windows/ansible/02_bitmask_virtualenv.yml
@@ -0,0 +1,37 @@
+########################################################################
+# Playbook to bootstrap a bitmask development environment in
+# a windows base image (install virtualenv)
+#
+# Make sure to follow the instructions in
+# https://docs.ansible.com/ansible/devel/user_guide/windows_setup.html
+# before running this playbook.
+# You also need to install win_git plugin:
+# https://github.com/tivrobo/ansible-win_git
+########################################################################
+
+- hosts: all
+ gather_facts: false
+ tasks:
+
+ # XXX this will fail the first time! need to reboot windows so thatthe PATH variable gets updated
+ # https://github.com/ansible/ansible/issues/24333
+
+ - name: git clone bitmask
+ win_git:
+ repo: "https://github.com/leapcode/bitmask-dev.git"
+ dest: "c:\\leap\\bitmask-dev"
+ branch: master
+ update: yes
+ replace_dest: no
+ accept_hostkey: yes
+
+ - name: install virtualenv
+ win_command: pip install -U virtualenvwrapper-win
+
+ - name: create bitmask virtualenv (with vpn deps)
+ win_command: mkvirtualenv.bat bitmask -r c:\leap\bitmask-dev\pkg\requirements-vpn.pip
+ ignore_errors: yes
+
+ - name: install bitmask in devmode
+ win_command: pip install -e c:\leap\bitmask-dev
+ ignore_errors: yes
diff --git a/pkg/windows/ansible/Makefile b/pkg/windows/ansible/Makefile
new file mode 100644
index 00000000..87400f9f
--- /dev/null
+++ b/pkg/windows/ansible/Makefile
@@ -0,0 +1,9 @@
+deps:
+ ansible-playbook 01_bitmask_deps.yml
+bootstrap:
+ ansible-playbook 02_bitmask_virtualenv.yml
+reboot:
+ ansible-playbook reboot.yml
+rmvirtualenv:
+ ansible-playbook rmvirtualenv.yml
+
diff --git a/pkg/windows/ansible/README b/pkg/windows/ansible/README
new file mode 100644
index 00000000..afefa0d4
--- /dev/null
+++ b/pkg/windows/ansible/README
@@ -0,0 +1,23 @@
+Bootstrapping a windows environment for Bitmask development
+===========================================================
+
+Create a windows virtual machine. Give it a minimum of 25GB.
+
+Install ansible:
+
+ https://docs.ansible.com/ansible/devel/user_guide/windows_setup.html
+
+TODO: add instructions for configuring inventory in a file in this folder - see hosts.sample
+ the other option is to configure it in /etc/ansible/hosts
+
+Install bitmask deps and some tools for development:
+
+ make deps
+
+Reboot the windows machine so that some installed tools get in the PATH for the new session:
+
+ make reboot
+
+Bootstrap a bitmask virtualenv:
+
+ make bootstrap
diff --git a/pkg/windows/ansible/hosts.sample b/pkg/windows/ansible/hosts.sample
new file mode 100644
index 00000000..e42bb16e
--- /dev/null
+++ b/pkg/windows/ansible/hosts.sample
@@ -0,0 +1,11 @@
+[windows]
+192.168.122.196
+
+[windows:vars]
+ ansible_user=admin
+ ansible_password=secretpass
+ ansible_connection=winrm
+ ansible_port=5985
+ ansible_winrs_scheme=http
+ ansible_winrm_transport=basic
+ ansible_winrm_server_cert_validation=ignore
diff --git a/pkg/windows/ansible/reboot.yml b/pkg/windows/ansible/reboot.yml
new file mode 100644
index 00000000..005c83a9
--- /dev/null
+++ b/pkg/windows/ansible/reboot.yml
@@ -0,0 +1,9 @@
+########################################################################
+# Reboot a a windows host.
+########################################################################
+
+- hosts: all
+ gather_facts: false
+ tasks:
+ - name: reboot host unconditionally
+ win_reboot:
diff --git a/pkg/windows/ansible/rmvirtualenv.yml b/pkg/windows/ansible/rmvirtualenv.yml
new file mode 100644
index 00000000..0de422a4
--- /dev/null
+++ b/pkg/windows/ansible/rmvirtualenv.yml
@@ -0,0 +1,9 @@
+########################################################################
+# Remove the bitmask virtualenv.
+########################################################################
+
+- hosts: all
+ gather_facts: false
+ tasks:
+ - name: remove bitmask virtualenv
+ win_command: rmvirtualenv bitmask