Skip to content

Instantly share code, notes, and snippets.

@pdvyas
Created February 27, 2016 22:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdvyas/e2a4a68a76feb4940390 to your computer and use it in GitHub Desktop.
Save pdvyas/e2a4a68a76feb4940390 to your computer and use it in GitHub Desktop.
VM build server playbook
---
- hosts: all
user: root
become: yes
become_user: root
tasks:
- name: Set hostname
hostname: name={{ hostname }}
- name: install packages
apt: pkg={{ item }} state=present
with_items:
- vim
- git-core
- nginx
- virtualbox
when: ansible_os_family == 'Debian'
- name: Setup users
hosts: all
user: root
tasks:
- name: Add frappe user
user: name=frappe shell=/bin/bash
- name: Add your own key
authorized_key: user=frappe key="{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
- name: Add your own key
authorized_key: user=root key="{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
- name: Setup bench
hosts: all
user: frappe
gather_facts: False
tasks:
- name: Clone bench
git:
accept_hostkey=True
repo=https://github.com/frappe/bench
dest=/home/frappe/bench
- name: Download base.ova
get_url: url=https://github.com/pdvyas/deploy-erpnext/releases/download/0.02/base.ova dest=/home/frappe/bench/vm/base.ova
- name: Download base.ova
get_url: url=https://github.com/pdvyas/deploy-erpnext/releases/download/0.02/base.ova dest=/home/frappe/bench/vm/base.ova
- name: Make public dir
file: path=/home/frappe/ state=directory
- name: Setup nginx
hosts: all
user: root
become: yes
become_user: root
tasks:
- name: Remove default nginx conf
file: path=/etc/nginx/sites-enabled/default.conf state=absent
- name: Copy nginx config
copy: src=vm.nginx.conf dest=/etc/nginx/conf.d/vm.conf
- service: name=nginx enabled=yes state=reloaded
## TODO: Change the path to base.ova and add https (letsencrypt)
@anandpdoshi
Copy link

Why do you need to do get_url base.ova? Isn't the VM build script self sufficient? If not, shouldn't the base.ova be part of the bench/vm folder?

@pdvyas
Copy link
Author

pdvyas commented Mar 3, 2016

yeah, it's 500M can't put that in the repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment