Install Bitwarden in Vagrant
This commit is contained in:
parent
0e31d97bf8
commit
f2b599e87c
4
Vagrantfile
vendored
4
Vagrantfile
vendored
@ -15,6 +15,10 @@ Vagrant.configure("2") do |config|
|
||||
libvirt.default_prefix = ""
|
||||
end
|
||||
|
||||
config.vm.provider "virtualbox" do |vbox|
|
||||
vbox.memory = 2048
|
||||
end
|
||||
|
||||
# Provision with Ansible
|
||||
config.vm.provision "ansible" do |ansible|
|
||||
ansible.compatibility_mode = "2.0"
|
||||
|
31
roles/bitwarden/tasks/main.yml
Normal file
31
roles/bitwarden/tasks/main.yml
Normal file
@ -0,0 +1,31 @@
|
||||
- name: Install expect
|
||||
apt:
|
||||
name: expect
|
||||
state: present
|
||||
|
||||
- name: Create Bitwarden directory
|
||||
file:
|
||||
path: "/home/{{ docker_user }}/bitwarden/"
|
||||
state: directory
|
||||
owner: "{{ docker_user }}"
|
||||
group: "{{ docker_user }}"
|
||||
|
||||
- name: Download Bitwarden script
|
||||
get_url:
|
||||
url: "https://raw.githubusercontent.com/\
|
||||
bitwarden/server/master/scripts/bitwarden.sh"
|
||||
dest: "/home/{{ docker_user }}/bitwarden/"
|
||||
owner: "{{ docker_user }}"
|
||||
group: "{{ docker_user }}"
|
||||
mode: u+x
|
||||
|
||||
- name: Install Bitwarden script wrapper
|
||||
template:
|
||||
src: bw_wrapper.j2
|
||||
dest: "/home/{{ docker_user }}/bitwarden/bw_wrapper"
|
||||
owner: "{{ docker_user }}"
|
||||
group: "{{ docker_user }}"
|
||||
mode: u+x
|
||||
|
||||
- name: Run Bitwarden script
|
||||
shell: /home/{{ docker_user }}/bitwarden/bw_wrapper
|
30
roles/bitwarden/templates/bw_wrapper.j2
Normal file
30
roles/bitwarden/templates/bw_wrapper.j2
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/expect -d
|
||||
|
||||
set timeout -1
|
||||
|
||||
spawn /home/{{ docker_user }}/bitwarden/bitwarden.sh install
|
||||
|
||||
expect "Enter the domain name for your Bitwarden instance (ex. bitwarden.example.com):"
|
||||
send "{{ bitwarden_domain }}\r"
|
||||
|
||||
expect "Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n):"
|
||||
send "n\r"
|
||||
|
||||
expect "Enter your installation id (get at https://bitwarden.com/host):"
|
||||
send "{{ bitwarden_install_id }}\r"
|
||||
|
||||
expect "Enter your installation key:"
|
||||
send "{{ bitwarden_install_key }}\r"
|
||||
|
||||
expect "Do you have a SSL certificate to use? (y/n):"
|
||||
send "n\r"
|
||||
|
||||
expect "Do you want to generate a self-signed SSL certificate? (y/n):"
|
||||
send "y\r"
|
||||
|
||||
expect "Next steps, run:\r\n`./bitwarden.sh start`"
|
||||
expect eof
|
||||
|
||||
spawn /home/{{ docker_user }}/bitwarden/bitwarden.sh start
|
||||
expect "Bitwarden is up and running!"
|
||||
expect eof
|
@ -45,6 +45,8 @@
|
||||
user:
|
||||
name: "{{ docker_user }}"
|
||||
groups: docker
|
||||
skeleton: /etc/skel
|
||||
shell: /bin/bash
|
||||
append: yes
|
||||
|
||||
- name: Install docker-compose
|
||||
|
Loading…
Reference in New Issue
Block a user