Skip to content

Commit ddbe605

Browse files
committed
Revamp vagrant example
* document libvirt as provider * remove explicit usage of VirtualBox * disable unnecessary syncing of folder (via NFS) * update used distribution to Debian 12 (Bookworm) * use role from ansible-community
1 parent 5ed64bc commit ddbe605

File tree

5 files changed

+20
-36
lines changed

5 files changed

+20
-36
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This Ansible role performs a basic [Vault](https://vaultproject.io/)
77
installation, including filesystem structure and example configuration.
88

99
It can also bootstrap a minimal development or evaluation server or HA
10-
Consul-backed cluster in a Vagrant and VirtualBox based environment. See
10+
Consul-backed cluster in a Vagrant based environment. See
1111
[README_VAGRANT.md](https://github.com/ansible-community/ansible-vault/blob/master/examples/README_VAGRANT.md) and the associated [Vagrantfile](https://github.com/ansible-community/ansible-vault/blob/master/examples/Vagrantfile) for more details about the developer mode setup.
1212

1313
## Installation
@@ -1211,12 +1211,12 @@ ansible-playbook -i hosts site.yml --extra-vars "vault_backend_file=backend_file
12111211
You need to make sure that the template file `backend_file.j2` is in the
12121212
role directory for this to work.
12131213

1214-
### Vagrant and VirtualBox
1214+
### Vagrant
12151215

12161216
See `examples/README_VAGRANT.md` for details on quick Vagrant deployments
1217-
under VirtualBox for testing, etc.
1217+
for testing, etc.
12181218

1219-
## example virtualBox playbook
1219+
## example playbook
12201220
example playbook for a file based vault instance.
12211221

12221222
```

examples/README_VAGRANT.md

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This project provides documentation and a collection of scripts to help you automate deployment of [HashiCorp Vault](https://www.vaultproject.io/) using [Ansible](http://www.ansibleworks.com/)
44

5-
These are the instructions for deploying a development or evaluation cluster on Vagrant and VirtualBox.
5+
These are the instructions for deploying a development or evaluation cluster on Vagrant.
66

77
The documentation and scripts are merely a starting point designed to both help familiarize you with the processes and quickly bootstrap an environment for development or evaluation. You may wish to expand on them and customize them with additional features specific to your needs later.
88

@@ -11,7 +11,7 @@ The documentation and scripts are merely a starting point designed to both help
1111
In some situations deploying a small cluster on your local development machine can be handy. This document describes such a scenario using the following technologies:
1212

1313
* [Vault](https://vault.io)
14-
* [VirtualBox](https://www.virtualbox.org/)
14+
* [VirtualBox](https://www.virtualbox.org/) or [Vagrant-libvirt](https://vagrant-libvirt.github.io/vagrant-libvirt)
1515
* [Vagrant](http://www.vagrantup.com/) with Ansible provisioner and
1616
supporting plugin
1717
* [Ansible](http://www.ansibleworks.com/)
@@ -31,34 +31,23 @@ This role is designed to be installed via the `ansible-galaxy` command instead o
3131
You should install it like this:
3232

3333
```
34-
$ ansible-galaxy install brianshumate.vault
34+
$ ansible-galaxy role install -r roles/requirements.yml -p roles
3535
```
3636

37-
You'll want to make sure you have write access to `/etc/ansible/roles/` since
38-
that is where the role will be installed by default, or define your own
39-
Ansible role path by creating a `$HOME/.ansible.cfg` file with these contents:
40-
41-
```
42-
[defaults]
43-
roles_path = PATH_TO_ROLES
44-
```
45-
46-
Change `PATH_TO_ROLES` to a directory that you have write access to.
47-
4837
## Quick Start
4938

5039
Begin from the top level directory of this project and use the following
5140
steps to get up and running:
5241

5342
1. Install the following prerequisites:
54-
- [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
43+
- [VirtualBox](https://www.virtualbox.org/wiki/Downloads) or [Vagrant-libvirt](https://vagrant-libvirt.github.io/vagrant-libvirt/#installation)
5544
- [Vagrant](http://downloads.vagrantup.com/)
5645
- [vagrant-hosts plugin](https://docs.ansible.com/ansible/latest/installation_guide/index.html).
5746
2. Edit `/etc/hosts` or use the included `bin/preinstall` script to add
5847
the following entries to your development system's `/etc/hosts` file:
5948
- `10.1.42.240 vault1.local vault1`
60-
3. `cd $PATH_TO_ROLES/brianshumate.conusul/examples`
61-
4. `vagrant up`
49+
4. `export VAGRANT_DEFAULT_PROVIDER=libvirt` to use libvirt instead of VirtualBox
50+
5. `vagrant up`
6251
6. You can use Vault directly from the host system with the `VAULT_ADDR` environment as shown in this example:
6352
```
6453
VAULT_ADDR=http://10.1.42.240:8200 vault operator init
@@ -69,7 +58,7 @@ You can also `vagrant ssh` into the VM and export `VAULT_ADDR=http://localhost:8
6958
> NOTE: By default, this project will install a Debian based Vault server. If you prefer, it can also install a server based on a different Vagrant box by changing the command in step 4 to include the `BOX_NAME` environment variable specifying a different Vagrant box name as the value such as in the following example:
7059
7160
```
72-
BOX_NAME="centos/8" vagrant up
61+
BOX_NAME="debian/bullseye64" vagrant up
7362
```
7463
7564
## Vault Enterprise
@@ -80,18 +69,7 @@ Place the Vault Enterprise zip archive into `{{ role_path }}/files` and set `vau
8069
8170
## Notes
8271
83-
1. This project functions with the following software versions:
84-
* Vault version 1.4.0
85-
* Ansible: 2.8.4
86-
* VirtualBox version 6.0.10
87-
* Vagrant version 2.2.5
88-
* Vagrant Hosts version 2.8.3
89-
2. This project uses Debian 10 (buster) by default, but you can choose another
90-
OS distribution with the **BOX_NAME** environment variable
91-
3. The `bin/preinstall` shell script performs the following actions for you:
92-
- Adds each server's host information to the host machine's `/etc/hosts`
93-
- Optionally installs the Vagrant hosts plugin
94-
4. If you notice an error like *vm: The '' provisioner could not be found.* make sure that you have the vagrant-hosts plugin installed
72+
If you notice an error like *vm: The '' provisioner could not be found.* make sure that you have the vagrant-hosts plugin installed
9573
9674
## Resources
9775
@@ -104,3 +82,4 @@ Place the Vault Enterprise zip archive into `{{ role_path }}/files` and set `vau
10482
7. http://www.vagrantup.com/
10583
8. https://www.virtualbox.org/
10684
9. https://github.com/adrienthebo/vagrant-hosts
85+
10. https://vagrant-libvirt.github.io/vagrant-libvirt

examples/Vagrantfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
ANSIBLE_PLAYBOOK = ENV['ANSIBLE_PLAYBOOK'] || "site.yml"
88
BOX_MEM = ENV['BOX_MEM'] || "2048"
9-
BOX_NAME = ENV['BOX_NAME'] || "debian/buster64"
9+
BOX_NAME = ENV['BOX_NAME'] || "debian/bookworm64"
1010
VAULT_HOSTS = ENV['VAULT_HOSTS'] || "vagrant_hosts"
1111
LOGLEVEL = ENV['VAULT_LOGLEVEL'] || "info"
1212
VAGRANTFILE_API_VERSION = "2"
@@ -29,6 +29,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
2929
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
3030
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
3131
end
32+
vault_config.vm.synced_folder '.', '/vagrant', disabled: true
3233
vault_config.vm.provision :ansible do |ansible|
3334
ansible.inventory_path = VAULT_HOSTS
3435
# Extra Ansible variables can be defined here

examples/roles/requirements.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- src: https://github.com/ansible-community/ansible-vault.git
2+
name: ansible-community.ansible-vault
3+
scm: git
4+
version: master

examples/site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
become: true
88
become_user: root
99
roles:
10-
- {role: brianshumate.vault, vault_backend: file}
10+
- {role: ansible-community.ansible-vault, vault_backend: file}

0 commit comments

Comments
 (0)