[pkg] add ansible scripts for bootstrapping windows env

parent 1a3751c2
Pipeline #14763 passed with stages
in 49 minutes and 48 seconds
########################################################################
# 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
########################################################################
# 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
deps:
ansible-playbook 01_bitmask_deps.yml
bootstrap:
ansible-playbook 02_bitmask_virtualenv.yml
reboot:
ansible-playbook reboot.yml
rmvirtualenv:
ansible-playbook rmvirtualenv.yml
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
[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
########################################################################
# Reboot a a windows host.
########################################################################
- hosts: all
gather_facts: false
tasks:
- name: reboot host unconditionally
win_reboot:
########################################################################
# Remove the bitmask virtualenv.
########################################################################
- hosts: all
gather_facts: false
tasks:
- name: remove bitmask virtualenv
win_command: rmvirtualenv bitmask
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment