diff --git a/PeekabooAV-install.sh b/PeekabooAV-install.sh index 9e6a355..45bf390 100755 --- a/PeekabooAV-install.sh +++ b/PeekabooAV-install.sh @@ -211,7 +211,13 @@ if [ ! -r "$ANSIBLE_PLAYBOOK" ]; then echo "ERROR: ansible playbook "$ANSIBLE_PLAYBOOK" not found" >&2 exit 1 fi -ansible-playbook -i "$ANSIBLE_INVENTORY" "$ANSIBLE_PLAYBOOK" + +if [ -z ${NOANSIBLE+x} ] +then + ansible-playbook -i "$ANSIBLE_INVENTORY" "$ANSIBLE_PLAYBOOK" +else + echo "WARNING: ansible not run, override by NOANSIBLE env setting" >&2 +fi if [ $? != 0 ];then echo "ERROR: 'ansible-playbook' failed. Please fix manually" >&2 diff --git a/PeekabooAV-install.yml b/PeekabooAV-install.yml index 09e3226..4819e52 100755 --- a/PeekabooAV-install.yml +++ b/PeekabooAV-install.yml @@ -304,7 +304,6 @@ - name: This key will have to be allowed on the host to authenticate the vm user become_user: peekaboo - become_method: su command: ssh-keygen -t ed25519 -f /var/lib/peekaboo/.ssh/id_ed25519 -P '' args: chdir: /var/lib/peekaboo @@ -316,7 +315,6 @@ gather_facts: no become: true become_user: peekaboo - become_method: su tasks: - name: Initial run of Cuckoo to create directory structure in peekaboo $HOME command: /opt/cuckoo/bin/cuckoo diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..3a010f0 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,38 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.synced_folder '.', '/vagrant' + + config.vm.define "peekaboo" do |peekaboo| + peekaboo.vm.box = "generic/ubuntu1804" + peekaboo.vm.hostname = "peekabooav.int" + config.ssh.username = 'vagrant' + config.ssh.password = 'vagrant' + config.ssh.insert_key = 'true' + + peekaboo.vm.network "private_network", ip: "192.168.56.5" + #peekaboo.vm.network "public_network", type: "dhcp" + peekaboo.vm.network "forwarded_port", guest: 8000, host: 8000, host_ip: "127.0.0.1" + + peekaboo.vm.provider "virtualbox" do |vb| + vb.name = "PeekabooAV" + vb.memory = 2048 + vb.cpus = 2 + end + end + + config.vm.provision "shell" do |install| + # change directory first (args + env not suitable) + install.inline = "cd /vagrant && NOANSIBLE=yes ./PeekabooAV-install.sh --quiet" + end + + config.vm.provision "ansible_local" do |ansible| + ansible.become = true + ansible.playbook = "PeekabooAV-install.yml" + ansible.inventory_path = "ansible-inventory" + ansible.limit = "all" + end + + config.vm.provision 'shell', inline: 'passwd --delete vagrant' +end