summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2014-10-03 13:53:22 +0200
committerPavel Raiskup <praiskup@redhat.com>2014-10-03 14:24:26 +0200
commitdd52a3df190ad677e23654dbba8bf553565a159b (patch)
tree50dc25d35110c45c05bbab6ec319dd4a92836a33 /ansible
parent37c8dc6c89714e553bb5ce32a83910a1407d7067 (diff)
downloadpostgresql-setup-tests-dd52a3df190ad677e23654dbba8bf553565a159b.tar.gz
postgresql-setup-tests-dd52a3df190ad677e23654dbba8bf553565a159b.tar.xz
postgresql-setup-tests-dd52a3df190ad677e23654dbba8bf553565a159b.zip
ansible: incorporate os1 triggers
* ansible/dummy-wrapper.yml: Helper playbook to directly invoke "included" playbooks. * ansible/fedora.yml: The "main" playbook (new file). * ansible/include/beakerlib.yml: New file, install beakerlib remotely. * ansible/include/prepare-testenv.yml: Install the test dependencies remotely. * ansible/run_include: Helper script to run included playbooks. * dist: Do not distribute ansible playbooks in tarball. * get_machine: Helper script to obtain openstack machine, not used currently. * lib_pgsql.sh: Assert for PG_VERSION, not for datadir (as it by default exists after postgresql-server installation. * run_remote: Helper script invoking the main ansible playbook. * ansible_helpers/wait-for-ssh: Helper script as 'wait_for' is broken? * README: Document. * .gitignore: Ignore private files.
Diffstat (limited to 'ansible')
-rw-r--r--ansible/dummy-wrapper.yml7
-rw-r--r--ansible/fedora.yml61
-rw-r--r--ansible/include/beakerlib.yml1
-rw-r--r--ansible/include/prepare-testenv.yml3
-rwxr-xr-xansible/run_include8
5 files changed, 80 insertions, 0 deletions
diff --git a/ansible/dummy-wrapper.yml b/ansible/dummy-wrapper.yml
new file mode 100644
index 0000000..b645874
--- /dev/null
+++ b/ansible/dummy-wrapper.yml
@@ -0,0 +1,7 @@
+- name: "{{ script_name }}"
+ hosts: "{{ target }}"
+ remote_user: root
+ gather_facts: False
+
+ tasks:
+ - include: "{{ include_file }}"
diff --git a/ansible/fedora.yml b/ansible/fedora.yml
new file mode 100644
index 0000000..825d7c9
--- /dev/null
+++ b/ansible/fedora.yml
@@ -0,0 +1,61 @@
+- name: self-standing testsuite
+ remote_user: root
+ gather_facts: False
+ hosts: localhost
+ vars_files:
+ - ../private/ostack.yml
+
+ vars:
+ - keypair: praiskup-test
+ - instance_type: a4827976-e727-4135-ba59-7d5fdb9ce4e2
+ - security_group: praiskup-dbt
+ - image_id: 5fd723b7-e00d-49d3-b17b-65af842d02ab
+ - OS_AUTH_URL: http://control.os1.phx2.redhat.com:5000/v2.0
+ - OS_TENANT_ID: "{{ os_tenant_id }}"
+ - OS_USERNAME: "{{ os_username }}"
+ - OS_PASSWORD: "{{ os_nova_password }}"
+ - OS_TENANT_NAME: "Developer Experience - Packaging"
+
+ tasks:
+ - name: generate builder name
+ local_action: shell echo `dd if=/dev/urandom bs=1k count=10 | md5sum ; echo DBTESTS`
+ register: vm_name
+
+ - name: spin it up
+ local_action: nova_compute auth_url={{OS_AUTH_URL}}
+ flavor_id={{instance_type}} image_id="{{ image_id }}" key_name={{ keypair }}
+ login_password={{OS_PASSWORD}} login_tenant_name="{{OS_TENANT_NAME}}"
+ login_username={{OS_USERNAME}} security_groups={{security_group}}
+ wait=yes name="{{vm_name.stdout}}"
+ register: nova
+
+ # This is ugly as hell... Hopefully nothing will be changing.
+ - local_action: command echo "{{ nova.info.addresses["os1-internal-1425"][1].addr }}"
+ register: machine_ip
+
+ - debug: msg="{{ machine_ip.stdout }}"
+
+ - name: wait for the host to be hot
+ local_action: wait_for host={{ machine_ip.stdout }} port=22 delay=5 timeout=600
+
+ - local_action: shell ../ansible_helpers/wait-for-ssh "root@{{ machine_ip.stdout }}"
+
+ - name: add it to the special group
+ local_action: add_host hostname={{ machine_ip.stdout }}
+ groupname=temp_group
+
+ - local_action: shell cd .. ; ./dist
+
+- hosts: temp_group
+ user: root
+ gather_facts: False
+ tasks:
+ - copy: src=../postgresql-setup-tests.tar.gz
+ dest=/root/postgresql-setup-tests.tar.gz
+
+ - include: include/beakerlib.yml
+
+ - include: include/prepare-testenv.yml
+
+ - shell: cd /root && tar -xf postgresql-setup-tests.tar.gz &&
+ cd postgresql-setup-tests && ./run
diff --git a/ansible/include/beakerlib.yml b/ansible/include/beakerlib.yml
new file mode 100644
index 0000000..0461f25
--- /dev/null
+++ b/ansible/include/beakerlib.yml
@@ -0,0 +1 @@
+- yum: conf_file=https://beaker-project.org/yum/beaker-server-Fedora.repo state=present name=beakerlib
diff --git a/ansible/include/prepare-testenv.yml b/ansible/include/prepare-testenv.yml
new file mode 100644
index 0000000..a63e51a
--- /dev/null
+++ b/ansible/include/prepare-testenv.yml
@@ -0,0 +1,3 @@
+- yum: state=present name=postgresql-server
+
+- yum: state=present name=postgresql-upgrade
diff --git a/ansible/run_include b/ansible/run_include
new file mode 100755
index 0000000..3a47f68
--- /dev/null
+++ b/ansible/run_include
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+export ANSIBLE_HOST_KEY_CHECKING=False
+
+ansible-playbook -i hosts \
+ --extra-vars "include_file=$1" \
+ --extra-vars "script_name=dummy target=host" \
+ ./dummy-wrapper.yml