diff --git a/README.md b/README.md new file mode 100644 index 0000000..61d29c6 --- /dev/null +++ b/README.md @@ -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. diff --git a/ansible.cfg b/ansible.cfg index 26dd0a5..7c37b6a 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,3 +1,3 @@ [defaults] -inventory = ./inv-staging.yml +inventory = ./staging.yml diff --git a/group_vars/testing.yml b/group_vars/testing.yml index a75cf06..458184e 100644 --- a/group_vars/testing.yml +++ b/group_vars/testing.yml @@ -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 diff --git a/host_vars/tau.yml b/host_vars/tau.yml new file mode 100644 index 0000000..c50dd60 --- /dev/null +++ b/host_vars/tau.yml @@ -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" diff --git a/roles/caddy/tasks/main.yml b/roles/caddy/tasks/main.yml index 4484e8a..4dbe265 100644 --- a/roles/caddy/tasks/main.yml +++ b/roles/caddy/tasks/main.yml @@ -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 diff --git a/roles/docker-swarm/tasks/main.yml b/roles/docker-swarm/tasks/main.yml index b21fb6e..01cf75b 100644 --- a/roles/docker-swarm/tasks/main.yml +++ b/roles/docker-swarm/tasks/main.yml @@ -30,3 +30,5 @@ state: directory mode: '0755' become: true + tags: + - fs diff --git a/staging.yml b/staging.yml new file mode 100644 index 0000000..d1762fd --- /dev/null +++ b/staging.yml @@ -0,0 +1,11 @@ +stable: + hosts: + tau: + +docker_swarm_manager_node: + hosts: + tau: + +testing: + hosts: + tau: