add test setup

This commit is contained in:
agatha 2025-04-26 13:51:27 -04:00
parent ef276f9a25
commit aa9d6fde55
5 changed files with 51 additions and 5 deletions

6
.gitignore vendored
View File

@ -3,9 +3,5 @@
# Ignore generated passwords file
generated_passwords.txt
# Ignore Vagrant testing files
# Ignore Vagrant directory
.vagrant/
test_ansible.cfg
Vagrantfile
inventory/test_inventory

23
README.md Normal file
View File

@ -0,0 +1,23 @@
# Ansible Rollout Playbooks
## Plays
- playbooks/setup_base_system.yml - Sets up the base system
- Can generate passwords with the `generate_user_password` variable
- Passwords will be placed in a file called `generated_passwords.txt`
- playbooks/update_systems.yml - Updates the systems
- playbooks/install_tor.yml - Installs Tor for all hosts in the `tor_systems` group
### Testing Plays
If you would like to test out the plays before using them on your live systems, this
repository includes a Vagrantfile, Ansible test configuration, and a test inventory.
To test the plays, run the following commands:
```bash
vagrant up
ANSIBLE_CONFIG=test_ansible.cfg ansible-playbook playbooks/setup_base_system.yml -e "generate_user_password=yes"
ANSIBLE_CONFIG=test_ansible.cfg ansible-playbook playbooks/update_systems.yml
ANSIBLE_CONFIG=test_ansible.cfg ansible-playbook playbooks/install_tor.yml
```
## Contributors
- [agatha](https://git.juggalol.com/agatha)

13
Vagrantfile vendored Normal file
View File

@ -0,0 +1,13 @@
Vagrant.configure("2") do |config|
config.vm.box = "debian/bullseye64"
config.vm.define "testserver1" do |testserver1|
testserver1.vm.hostname = "testserver1"
testserver1.vm.network "private_network", ip: "192.168.56.11"
end
config.vm.define "testserver2" do |testserver2|
testserver2.vm.hostname = "testserver2"
testserver2.vm.network "private_network", ip: "192.168.56.12"
end
end

9
inventory/test_inventory Normal file
View File

@ -0,0 +1,9 @@
[all:vars]
ansible_user=vagrant
[testservers]
testserver1 ansible_host=192.168.56.11 ansible_ssh_private_key_file=.vagrant/machines/testserver1/virtualbox/private_key
testserver2 ansible_host=192.168.56.12 ansible_ssh_private_key_file=.vagrant/machines/testserver2/virtualbox/private_key
[tor_systems]
testserver1

5
test_ansible.cfg Normal file
View File

@ -0,0 +1,5 @@
[defaults]
inventory = ./inventory/test_inventory
roles_path = ./roles
remote_user = vagrant
host_key_checking = False