From 0ba8cc7b61347133f5fa982665740aba78e55abc Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 21 Jan 2019 19:36:57 +0000 Subject: [PATCH] tests: clean up / deduplicate Ansible inventory. --- tests/ansible/hosts/connection-delegation | 12 ----- ...mmon-hosts => connection_delegation.hosts} | 44 +++++++++---------- tests/ansible/hosts/default.hosts | 8 ++++ tests/ansible/hosts/{k3 => k3.hosts} | 3 ++ tests/ansible/hosts/localhost | 8 ---- tests/ansible/hosts/localhost.hosts | 10 +++++ tests/ansible/hosts/nessy | 10 ----- tests/ansible/hosts/z | 25 ----------- 8 files changed, 41 insertions(+), 79 deletions(-) delete mode 100644 tests/ansible/hosts/connection-delegation rename tests/ansible/hosts/{common-hosts => connection_delegation.hosts} (71%) create mode 100644 tests/ansible/hosts/default.hosts rename tests/ansible/hosts/{k3 => k3.hosts} (79%) delete mode 100644 tests/ansible/hosts/localhost create mode 100644 tests/ansible/hosts/localhost.hosts delete mode 100644 tests/ansible/hosts/nessy delete mode 100644 tests/ansible/hosts/z diff --git a/tests/ansible/hosts/connection-delegation b/tests/ansible/hosts/connection-delegation deleted file mode 100644 index 2fb87455..00000000 --- a/tests/ansible/hosts/connection-delegation +++ /dev/null @@ -1,12 +0,0 @@ -[connection-delegation-test] -cd-bastion -cd-rack11 mitogen_via=ssh-user@cd-bastion -cd-rack11a mitogen_via=root@cd-rack11 -cd-rack11a-docker mitogen_via=docker-admin@cd-rack11a ansible_connection=docker - -[connection-delegation-cycle] -# Create cycle with Docker container. -cdc-bastion mitogen_via=cdc-rack11a-docker -cdc-rack11 mitogen_via=ssh-user@cdc-bastion -cdc-rack11a mitogen_via=root@cdc-rack11 -cdc-rack11a-docker mitogen_via=docker-admin@cdc-rack11a ansible_connection=docker diff --git a/tests/ansible/hosts/common-hosts b/tests/ansible/hosts/connection_delegation.hosts similarity index 71% rename from tests/ansible/hosts/common-hosts rename to tests/ansible/hosts/connection_delegation.hosts index cf84d2d1..a22bd5df 100644 --- a/tests/ansible/hosts/common-hosts +++ b/tests/ansible/hosts/connection_delegation.hosts @@ -1,38 +1,18 @@ # vim: syntax=dosini +# Connection delegation scenarios. It's impossible to connect to them, but their would-be +# config can be inspected using "mitogen_get_stack" action. -# This must be defined explicitly, otherwise _create_implicit_localhost() -# generates its own copy, which includes an ansible_python_interpreter that -# varies according to host machine. -localhost -[connection-delegation-test] -cd-bastion -cd-rack11 mitogen_via=ssh-user@cd-bastion -cd-rack11a mitogen_via=root@cd-rack11 -cd-rack11a-docker mitogen_via=docker-admin@cd-rack11a ansible_connection=docker - -[connection-delegation-cycle] -# Create cycle with Docker container. -cdc-bastion mitogen_via=cdc-rack11a-docker -cdc-rack11 mitogen_via=ssh-user@cdc-bastion -cdc-rack11a mitogen_via=root@cdc-rack11 -cdc-rack11a-docker mitogen_via=docker-admin@cdc-rack11a ansible_connection=docker - -[conn-delegation] -cd-user1 ansible_user=mitogen__user1 ansible_connection=mitogen_sudo mitogen_via=target - - -# Connection delegation scenarios. It's impossible to connection to them, but -# you can inspect the would-be config via "mitogen_get_stack" action. -[cd-no-connect] # Normal inventory host, no aliasing. cd-normal ansible_connection=mitogen_doas ansible_user=normal-user + # Inventory host that is really a different host. cd-alias ansible_connection=ssh ansible_user=alias-user ansible_host=alias-host # Via one normal host. cd-normal-normal mitogen_via=cd-normal + # Via one aliased host. cd-normal-alias mitogen_via=cd-alias @@ -41,3 +21,19 @@ cd-newuser-normal-normal mitogen_via=cd-normal ansible_user=newuser-normal-norma # doas:newuser via host. cd-newuser-doas-normal mitogen_via=cd-normal ansible_connection=mitogen_doas ansible_user=newuser-doas-normal-user + + +[connection-delegation-test] +cd-bastion +cd-rack11 mitogen_via=ssh-user@cd-bastion +cd-rack11a mitogen_via=root@cd-rack11 +cd-rack11a-docker mitogen_via=docker-admin@cd-rack11a ansible_connection=docker + + +[connection-delegation-cycle] +# Create cycle with Docker container. +cdc-bastion mitogen_via=cdc-rack11a-docker +cdc-rack11 mitogen_via=ssh-user@cdc-bastion +cdc-rack11a mitogen_via=root@cdc-rack11 +cdc-rack11a-docker mitogen_via=docker-admin@cdc-rack11a ansible_connection=docker + diff --git a/tests/ansible/hosts/default.hosts b/tests/ansible/hosts/default.hosts new file mode 100644 index 00000000..02f3c614 --- /dev/null +++ b/tests/ansible/hosts/default.hosts @@ -0,0 +1,8 @@ +# vim: syntax=dosini + +# When running the tests outside CI, make a single 'target' host which is the +# local machine. +target ansible_host=localhost + +[test-targets] +target diff --git a/tests/ansible/hosts/k3 b/tests/ansible/hosts/k3.hosts similarity index 79% rename from tests/ansible/hosts/k3 rename to tests/ansible/hosts/k3.hosts index 1a7190d8..34e1ff95 100644 --- a/tests/ansible/hosts/k3 +++ b/tests/ansible/hosts/k3.hosts @@ -1,3 +1,6 @@ +# vim: syntax=dosini + +# Used for manual testing. k3 [k3-x10] diff --git a/tests/ansible/hosts/localhost b/tests/ansible/hosts/localhost deleted file mode 100644 index f4dab2ab..00000000 --- a/tests/ansible/hosts/localhost +++ /dev/null @@ -1,8 +0,0 @@ -localhost -target ansible_host=localhost - -[test-targets] -target - -[localhost-x10] -localhost-[01:10] diff --git a/tests/ansible/hosts/localhost.hosts b/tests/ansible/hosts/localhost.hosts new file mode 100644 index 00000000..ca8716a6 --- /dev/null +++ b/tests/ansible/hosts/localhost.hosts @@ -0,0 +1,10 @@ +# vim: syntax=dosini + +# This must be defined explicitly, otherwise _create_implicit_localhost() +# generates its own copy, which includes an ansible_python_interpreter that +# varies according to host machine. +localhost + +# This is only used for manual testing. +[localhost-x10] +localhost-[01:10] diff --git a/tests/ansible/hosts/nessy b/tests/ansible/hosts/nessy deleted file mode 100644 index 5cdef123..00000000 --- a/tests/ansible/hosts/nessy +++ /dev/null @@ -1,10 +0,0 @@ -nessy - -[nessy-x10] -nessy-[00:10] - -[nessy-x20] -nessy-[00:20] - -[nessy-x50] -nessy-[00:50] diff --git a/tests/ansible/hosts/z b/tests/ansible/hosts/z deleted file mode 100644 index 61d27940..00000000 --- a/tests/ansible/hosts/z +++ /dev/null @@ -1,25 +0,0 @@ -z - -[z-x10] -z-[01:10] - -[z-x20] -z-[01:20] - -[z-x50] -z-[01:50] - -[z-x100] -z-[001:100] - -[z-x200] -z-[001:200] - -[z-x300] -z-[001:300] - -[z-x400] -z-[001:400] - -[z-x500] -z-[001:500]