From b0aa4131739b2e80662749bc47134516bfc7dd33 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 17 May 2018 18:14:20 +0100 Subject: [PATCH] tests: import benchmark reproduction setup playbook Incomplete, also needs to mess around with Gcloud routing and handle box setup/teardown, because that's another "well engineered" waste of time. --- tests/ansible/gcloud/README.md | 6 ++ tests/ansible/gcloud/ansible.cfg | 3 + tests/ansible/gcloud/controller.yml | 86 +++++++++++++++++++++++++++++ tests/ansible/gcloud/hosts | 2 + 4 files changed, 97 insertions(+) create mode 100644 tests/ansible/gcloud/README.md create mode 100644 tests/ansible/gcloud/ansible.cfg create mode 100644 tests/ansible/gcloud/controller.yml create mode 100644 tests/ansible/gcloud/hosts diff --git a/tests/ansible/gcloud/README.md b/tests/ansible/gcloud/README.md new file mode 100644 index 00000000..9ec53050 --- /dev/null +++ b/tests/ansible/gcloud/README.md @@ -0,0 +1,6 @@ + +# Command line. + +```` +time LANG=C LC_ALL=C ANSIBLE_STRATEGY=mitogen MITOGEN_GCLOUD_GROUP=debops_all_hosts debops common +``` diff --git a/tests/ansible/gcloud/ansible.cfg b/tests/ansible/gcloud/ansible.cfg new file mode 100644 index 00000000..d1fcd982 --- /dev/null +++ b/tests/ansible/gcloud/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +inventory = hosts +retry_files_enabled = False diff --git a/tests/ansible/gcloud/controller.yml b/tests/ansible/gcloud/controller.yml new file mode 100644 index 00000000..4c768510 --- /dev/null +++ b/tests/ansible/gcloud/controller.yml @@ -0,0 +1,86 @@ + +- hosts: controller + tasks: + - shell: "rsync -a ~/.ssh {{inventory_hostname}}:" + connection: local + + - lineinfile: + line: "net.ipv4.ip_forward=1" + path: /etc/sysctl.conf + register: sysctl_conf + become: true + + - shell: /sbin/sysctl -p + when: sysctl_conf.changed + become: true + + - shell: | + iptables -t nat -F; + iptables -t nat -X; + iptables -t nat -A POSTROUTING -j MASQUERADE; + become: true + + - apt: name={{item}} state=installed + become: true + with_items: + - python-pip + - python-virtualenv + - strace + - libldap2-dev + - libsasl2-dev + - build-essential + - git + + - git: + dest: ~/mitogen + repo: https://github.com/dw/mitogen.git + version: dmw + + - git: + dest: ~/ansible + repo: https://github.com/dw/ansible.git + version: lazy-vars + + - pip: + virtualenv: ~/venv + requirements: ~/mitogen/dev_requirements.txt + + - pip: + virtualenv: ~/venv + editable: true + name: ~/mitogen + + - pip: + virtualenv: ~/venv + editable: true + name: ~/ansible + + - lineinfile: + line: "source $HOME/venv/bin/activate" + path: ~/.profile + + - name: debops-init + shell: ~/venv/bin/debops-init ~/prj + args: + creates: ~/prj + + - name: grpvars + copy: + dest: "{{ansible_user_dir}}/prj/ansible/inventory/group_vars/all/dhparam.yml" + content: | + --- + dhparam__bits: [ '256' ] + + - blockinfile: + path: ~/prj/.debops.cfg + insertafter: '\[ansible defaults\]' + block: | + strategy_plugins = {{ansible_user_dir}}/mitogen/ansible_mitogen/plugins/strategy + forks = 50 + host_key_checking = False + + - file: + path: ~/prj/ansible/inventory/gcloud.py + state: link + src: ~/mitogen/tests/ansible/lib/inventory/gcloud.py + diff --git a/tests/ansible/gcloud/hosts b/tests/ansible/gcloud/hosts new file mode 100644 index 00000000..b4562cb5 --- /dev/null +++ b/tests/ansible/gcloud/hosts @@ -0,0 +1,2 @@ +[controller] +35.206.145.240