mirror of
https://github.com/frappe/bench.git
synced 2025-02-07 13:18:24 +00:00
minor fixes
This commit is contained in:
parent
30b12a6dd4
commit
9e28e4cf5b
@ -48,11 +48,11 @@ def install_nginx(user=None):
|
||||
|
||||
@click.command('virtualbox')
|
||||
def install_virtualbox():
|
||||
run_playbook('roles/virtualbox/tasks/main.yml')
|
||||
run_playbook('vm_build.yml', tag='virtualbox')
|
||||
|
||||
@click.command('packer')
|
||||
def install_packer():
|
||||
run_playbook('roles/packer/tasks/main.yml')
|
||||
run_playbook('vm_build.yml', tag='packer')
|
||||
|
||||
@click.command('fail2ban')
|
||||
@click.option('--maxretry', default=6, help="Number of matches (i.e. value of the counter) which triggers ban action on the IP.")
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
# Install's prerequisites, like fonts, image libraries, vim, screen, python-dev and gcc
|
||||
# Install's prerequisites, like fonts, image libraries, vim, screen, python-dev
|
||||
|
||||
- include_tasks: debian_family.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
@ -1,20 +1,14 @@
|
||||
---
|
||||
- name: Check if packer already exists
|
||||
stat:
|
||||
path: ~/.local/bin/packer
|
||||
path: /opt/packer
|
||||
register: packer
|
||||
|
||||
- name: Check if packer version is 1.2.1
|
||||
command: ~/.local/bin/packer --version
|
||||
command: /opt/packer --version
|
||||
register: packer_version
|
||||
when: packer.stat.exists
|
||||
|
||||
- name: Create the ~/.local/bin, if it doesnt exist already
|
||||
file:
|
||||
path: ~/.local/bin/
|
||||
state: directory
|
||||
when: packer.stat.exists == False
|
||||
|
||||
- include_tasks: debian_family.yml
|
||||
when: ansible_os_family == 'Debian' and packer.stat.exists == False
|
||||
|
||||
@ -24,22 +18,20 @@
|
||||
- name: Delete packer if < 1.2.1
|
||||
file:
|
||||
state: absent
|
||||
path: ~/.local/bin/packer
|
||||
path: /opt/packer
|
||||
when: (packer.stat.exists) and (packer_version | version_compare('1.2.1', '<'))
|
||||
|
||||
- name: Download packer zip file
|
||||
command: wget https://releases.hashicorp.com/packer/1.2.1/packer_1.2.1_linux_amd64.zip
|
||||
chdir: ~/.local/bin/
|
||||
command: chdir=/opt/ wget https://releases.hashicorp.com/packer/1.2.1/packer_1.2.1_linux_amd64.zip
|
||||
when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<'))
|
||||
|
||||
- name: Unzip the packer binary in ~/.local/bin
|
||||
chdir: ~/.local/bin/
|
||||
command: unzip packer_1.2.1_linux_amd64.zip
|
||||
- name: Unzip the packer binary in /opt
|
||||
command: chdir=/opt/ unzip packer_1.2.1_linux_amd64.zip
|
||||
when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<'))
|
||||
|
||||
- name: Remove the downloaded packer zip file
|
||||
file:
|
||||
state: absent
|
||||
path: ~/.local/bin/packer_1.2.1_linux_amd64.zip
|
||||
path: /opt/packer_1.2.1_linux_amd64.zip
|
||||
when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<'))
|
||||
...
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: Install unzip
|
||||
yum: name={{ item }} enablerepo=mariadb state=present
|
||||
yum: name={{ item }} state=present
|
||||
with_items:
|
||||
- unzip
|
||||
...
|
||||
|
3
playbooks/roles/virtualbox/defaults/main.yml
Normal file
3
playbooks/roles/virtualbox/defaults/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
virtualbox_version: 5.2
|
||||
...
|
7
playbooks/roles/virtualbox/files/virtualbox_centos.repo
Normal file
7
playbooks/roles/virtualbox/files/virtualbox_centos.repo
Normal file
@ -0,0 +1,7 @@
|
||||
[virtualbox]
|
||||
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
|
||||
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
repo_gpgcheck=1
|
||||
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
|
@ -1,8 +1,13 @@
|
||||
---
|
||||
- name: Install dependencies
|
||||
apt: pkg={{ item }} state=present
|
||||
with_items:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
|
||||
- name: Add VirtualBox to sources.list
|
||||
apt_repository:
|
||||
repo: deb https://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }}contrib
|
||||
repo: deb https://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }} contrib
|
||||
state: present
|
||||
|
||||
- name: Add apt signing key for VirtualBox for Debian >= 8 and Ubuntu >= 16
|
||||
@ -15,11 +20,10 @@
|
||||
apt_key:
|
||||
url: https://www.virtualbox.org/download/oracle_vbox.asc
|
||||
state: present
|
||||
when: (ansible_distribution == "Debian" and ansible_distribution_major_version >= "8") or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version >= "16")
|
||||
when: (ansible_distribution == "Debian" and ansible_distribution_major_version < "8") or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version < "16")
|
||||
|
||||
- name: Install VirtualBox
|
||||
apt: pkg={{ item }} update_cache=yes state=present
|
||||
with_items:
|
||||
- virtualbox-5.2
|
||||
|
||||
- virtualbox-{{ virtualbox_version }}
|
||||
...
|
||||
|
@ -1,9 +1,7 @@
|
||||
---
|
||||
|
||||
- include_tasks: debian_family.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- include_tasks: redhat_family.yml
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
...
|
@ -1,16 +1,17 @@
|
||||
---
|
||||
- name: Install the 'Development tools' package group
|
||||
yum:
|
||||
name: "@Development tools"
|
||||
state: present
|
||||
|
||||
- name: Add VirtualBox Repository
|
||||
yum_repository:
|
||||
name: Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
|
||||
description: Official VirtualBox Yum Repo
|
||||
baseurl: http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
|
||||
gpgkey: https://www.virtualbox.org/download/oracle_vbox.asc
|
||||
gpgcheck: yes
|
||||
- name: Install dependencies
|
||||
yum: name={{ item }} state=present
|
||||
with_items:
|
||||
- kernel-devel
|
||||
- deltarpm
|
||||
|
||||
- copy: src=virtualbox_centos.repo dest=/etc/yum.repos.d/virtualbox.repo owner=root group=root mode=0644 force=no
|
||||
|
||||
- name: Install VirtualBox
|
||||
yum: name={{ item }} enablerepo=mariadb state=present
|
||||
with_items:
|
||||
- VirtualBox-5.2
|
||||
|
||||
command: yum install -y VirtualBox-{{ virtualbox_version }}
|
||||
...
|
||||
|
9
playbooks/vm_build.yml
Normal file
9
playbooks/vm_build.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Install Packer
|
||||
hosts: localhost
|
||||
become: yes
|
||||
become_user: root
|
||||
roles:
|
||||
- { role: virtualbox, tags: "virtualbox" }
|
||||
- { role: packer, tags: "packer" }
|
||||
...
|
@ -26,7 +26,7 @@ def install_packer():
|
||||
check_output(['bench', 'install', 'packer'])
|
||||
|
||||
def build_vm():
|
||||
check_output("./packer build vm.json", shell=True)
|
||||
check_output("/opt/packer build vm.json", shell=True)
|
||||
|
||||
def move_to_public():
|
||||
src = get_filepath()
|
||||
|
Loading…
x
Reference in New Issue
Block a user