Add testing inventory and group variables

Added fully test-ready inventory and groups using vagrant and able to
run repeatedly as necessary.
This commit is contained in:
Marty Oehme 2021-07-29 14:53:03 +02:00
parent 9f188c2674
commit 6de8f0fb50
Signed by: Marty
GPG key ID: B7538B8F50A1C800
7 changed files with 46 additions and 1 deletions

16
README.md Normal file
View file

@ -0,0 +1,16 @@
# Cloudserve infrastructure
## Testing
This repository comes with a test-ready setup to try out the complete site setup locally.
It uses vagrant to accomplish this and create a pretend target host.
So, install [vagrant](https://www.vagrantup.com/) on your system and to make tests repeatable also install the vagrant plugins `vagrant-hosts` and `vagrant-hostsupdater`.
```bash
vagrant plugin install vagrant-hosts vagrant-hostsupdater
```
Then you are ready to run the complete infrastructure setup locally,
simply by executing `ansible-playbook site.yml`.
You can of course pick and choose what should be executed with host limits, tags, group variables, and so on,
but this should provide an easy way to see if a) the playbook is working as intended and b) what it does is useful.

View file

@ -1,3 +1,3 @@
[defaults]
inventory = ./inv-staging.yml
inventory = ./staging.yml

View file

@ -1,3 +1,8 @@
---
docker_swarm_advertise_addr: eth1
caddy_use_debug: yes
caddy_use_https: no
caddy_tls_use_staging: yes
caddy_create_test_file_server: yes

5
host_vars/tau.yml Normal file
View file

@ -0,0 +1,5 @@
---
ansible_host: 192.168.27.2
ansible_ssh_user: vagrant
ansible_ssh_private_key_file: "{{ playbook_dir }}/.vagrant/machines/tau/virtualbox/private_key"

View file

@ -7,6 +7,8 @@
state: directory
mode: '0755'
become: true
tags:
- fs
- name: Ensure Caddyfile exists
ansible.builtin.template:
@ -14,6 +16,8 @@
dest: "{{ caddy_caddyfile_dir }}/Caddyfile"
validate: "docker run --rm -v %s:/Caddyfile caddy caddy validate --config /Caddyfile"
become: true
tags:
- fs
- name: Deploy caddy to swarm
community.general.docker_stack:
@ -25,3 +29,5 @@
with_items: "{{ caddy_stack }}"
when: caddy_stack is defined
become: yes
tags:
- docker-swarm

View file

@ -30,3 +30,5 @@
state: directory
mode: '0755'
become: true
tags:
- fs

11
staging.yml Normal file
View file

@ -0,0 +1,11 @@
stable:
hosts:
tau:
docker_swarm_manager_node:
hosts:
tau:
testing:
hosts:
tau: