Merge devel/290 @ 79b979ec8544ef5d8620c64068d4a42fabf50415
parent
be4f1bdb50
commit
d6329f3446
@ -1,3 +1,4 @@
|
||||
lib/modules/custom_binary_producing_junk
|
||||
lib/modules/custom_binary_producing_json
|
||||
hosts/*.local
|
||||
gcloud
|
||||
|
@ -1,2 +0,0 @@
|
||||
terraform.tfstate*
|
||||
.terraform
|
@ -1,3 +0,0 @@
|
||||
|
||||
default:
|
||||
terraform fmt
|
@ -1,6 +0,0 @@
|
||||
|
||||
# Command line.
|
||||
|
||||
````
|
||||
time LANG=C LC_ALL=C ANSIBLE_STRATEGY=mitogen MITOGEN_GCLOUD_GROUP=debops_all_hosts debops common
|
||||
```
|
@ -1,8 +0,0 @@
|
||||
[defaults]
|
||||
strategy_plugins = ../../../ansible_mitogen/plugins/strategy
|
||||
strategy = mitogen
|
||||
inventory = hosts
|
||||
retry_files_enabled = False
|
||||
host_key_checking = False
|
||||
callback_plugins = ../lib/callback
|
||||
stdout_callback = nice_stdout
|
@ -1,159 +0,0 @@
|
||||
|
||||
- hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- apt: name={{item}} state=installed
|
||||
with_items:
|
||||
- openvpn
|
||||
- tcpdump
|
||||
- python-pip
|
||||
- python-virtualenv
|
||||
- strace
|
||||
- libldap2-dev
|
||||
- linux-perf
|
||||
- libsasl2-dev
|
||||
- build-essential
|
||||
- git
|
||||
- rsync
|
||||
|
||||
- file:
|
||||
path: /etc/openvpn
|
||||
state: directory
|
||||
|
||||
- copy:
|
||||
dest: /etc/openvpn/secret
|
||||
mode: '0600'
|
||||
content: |
|
||||
-----BEGIN OpenVPN Static key V1-----
|
||||
f94005e4206828e281eb397aefd69b37
|
||||
ebe6cd39057d5641c5d8dd539cd07651
|
||||
557d94d0077852bd8f92b68bef927169
|
||||
c5f0e42ac962a2cbbed35e107ffa0e71
|
||||
1a2607c6bcd919ec5846917b20eb6684
|
||||
c7505152815d6ed7b4420714777a3d4a
|
||||
8edb27ca81971cba7a1e88fe3936e13b
|
||||
85e9be6706a30cd1334836ed0f08e899
|
||||
78942329a330392dff42e4570731ac24
|
||||
9330358aaa6828c07ecb41fb9c498a89
|
||||
1e0435c5a45bfed390cd2104073634ef
|
||||
b00f9fae1d3c49ef5de51854103edac9
|
||||
5ff39c9dfc66ae270510b2ffa74d87d2
|
||||
9d4b3844b1e1473237bc6dc78fb03e2e
|
||||
643ce58e667a532efceec7177367fb37
|
||||
a16379a51e0a8c8e3ec00a59952b79d4
|
||||
-----END OpenVPN Static key V1-----
|
||||
|
||||
- copy:
|
||||
dest: /etc/openvpn/k3.conf
|
||||
content: |
|
||||
remote k3.botanicus.net
|
||||
dev tun
|
||||
ifconfig 10.18.0.1 10.18.0.2
|
||||
secret secret
|
||||
|
||||
- shell: systemctl enable openvpn@k3.service
|
||||
- shell: systemctl start openvpn@k3.service
|
||||
|
||||
- lineinfile:
|
||||
line: "{{item}}"
|
||||
path: /etc/sysctl.conf
|
||||
register: sysctl_conf
|
||||
with_items:
|
||||
- "net.ipv4.ip_forward=1"
|
||||
- "kernel.perf_event_paranoid=-1"
|
||||
|
||||
- shell: /sbin/sysctl -p
|
||||
when: sysctl_conf.changed
|
||||
|
||||
- copy:
|
||||
dest: /etc/rc.local
|
||||
mode: "0744"
|
||||
content: |
|
||||
#!/bin/bash
|
||||
iptables -t nat -F;
|
||||
iptables -t nat -X;
|
||||
iptables -t nat -A POSTROUTING -j MASQUERADE;
|
||||
|
||||
- shell: systemctl daemon-reload
|
||||
- shell: systemctl enable rc-local
|
||||
- shell: systemctl start rc-local
|
||||
|
||||
|
||||
- hosts: all
|
||||
vars:
|
||||
git_username: '{{ lookup("pipe", "git config --global user.name") }}'
|
||||
git_email: '{{ lookup("pipe", "git config --global user.email") }}'
|
||||
tasks:
|
||||
- copy:
|
||||
src: ~/.ssh/id_gitlab
|
||||
dest: ~/.ssh/id_gitlab
|
||||
mode: 0600
|
||||
|
||||
- template:
|
||||
dest: ~/.ssh/config
|
||||
src: ssh_config.j2
|
||||
|
||||
- shell: "rsync -a ~/.ssh {{inventory_hostname}}:"
|
||||
connection: local
|
||||
|
||||
- shell: |
|
||||
git config --global user.email "{{git_username}}"
|
||||
git config --global user.name "{{git_email}}"
|
||||
name: set_git_config
|
||||
|
||||
- git:
|
||||
dest: ~/mitogen
|
||||
repo: https://github.com/dw/mitogen.git
|
||||
version: dmw
|
||||
|
||||
- git:
|
||||
dest: ~/ansible
|
||||
repo: https://github.com/ansible/ansible.git
|
||||
#version: dmw
|
||||
|
||||
- pip:
|
||||
virtualenv: ~/venv
|
||||
requirements: ~/mitogen/dev_requirements.txt
|
||||
|
||||
- pip:
|
||||
virtualenv: ~/venv
|
||||
editable: true
|
||||
name: ~/mitogen
|
||||
|
||||
- pip:
|
||||
virtualenv: ~/venv
|
||||
editable: true
|
||||
name: ~/ansible
|
||||
|
||||
- pip:
|
||||
virtualenv: ~/venv
|
||||
name: debops
|
||||
|
||||
- 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
|
@ -1,2 +0,0 @@
|
||||
[controller]
|
||||
c
|
@ -1,149 +0,0 @@
|
||||
variable "node-count" {
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "preemptible" {
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "big" {
|
||||
default = false
|
||||
}
|
||||
|
||||
provider "google" {
|
||||
project = "mitogen-load-testing"
|
||||
region = "europe-west1"
|
||||
zone = "europe-west1-d"
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "controller" {
|
||||
name = "ansible-controller"
|
||||
machine_type = "${var.big ? "n1-highcpu-32" : "custom-1-1024"}"
|
||||
|
||||
allow_stopping_for_update = true
|
||||
can_ip_forward = true
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-9"
|
||||
}
|
||||
}
|
||||
|
||||
scheduling {
|
||||
preemptible = true
|
||||
automatic_restart = false
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = "${google_compute_subnetwork.loadtest-subnet.self_link}"
|
||||
access_config = {}
|
||||
}
|
||||
|
||||
provisioner "local-exec" {
|
||||
command = <<-EOF
|
||||
ip=${google_compute_instance.controller.network_interface.0.access_config.0.nat_ip};
|
||||
ssh-keygen -R $ip;
|
||||
ssh-keyscan $ip >> ~/.ssh/known_hosts;
|
||||
sed -ri -e "s/.*CONTROLLER_IP_HERE.*/ Hostname $ip/" ~/.ssh/config;
|
||||
ansible-playbook -i $ip, controller.yml
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_network" "loadtest" {
|
||||
name = "loadtest"
|
||||
auto_create_subnetworks = false
|
||||
}
|
||||
|
||||
resource "google_compute_subnetwork" "loadtest-subnet" {
|
||||
name = "loadtest-subnet"
|
||||
ip_cidr_range = "10.19.0.0/16"
|
||||
network = "${google_compute_network.loadtest.id}"
|
||||
}
|
||||
|
||||
resource "google_compute_firewall" "allow-all-in" {
|
||||
name = "allow-all-in"
|
||||
network = "${google_compute_network.loadtest.name}"
|
||||
direction = "INGRESS"
|
||||
|
||||
allow {
|
||||
protocol = "all"
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_firewall" "allow-all-out" {
|
||||
name = "allow-all-out"
|
||||
network = "${google_compute_network.loadtest.name}"
|
||||
direction = "EGRESS"
|
||||
|
||||
allow {
|
||||
protocol = "all"
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_route" "route-nodes-via-controller" {
|
||||
name = "route-nodes-via-controller"
|
||||
dest_range = "0.0.0.0/0"
|
||||
network = "${google_compute_network.loadtest.name}"
|
||||
next_hop_instance = "${google_compute_instance.controller.self_link}"
|
||||
next_hop_instance_zone = "${google_compute_instance.controller.zone}"
|
||||
priority = 800
|
||||
tags = ["node"]
|
||||
}
|
||||
|
||||
resource "google_compute_instance_template" "node" {
|
||||
name = "node"
|
||||
tags = ["node"]
|
||||
machine_type = "custom-1-1024"
|
||||
|
||||
scheduling {
|
||||
preemptible = "${var.preemptible}"
|
||||
automatic_restart = false
|
||||
}
|
||||
|
||||
disk {
|
||||
source_image = "debian-cloud/debian-9"
|
||||
auto_delete = true
|
||||
boot = true
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = "${google_compute_subnetwork.loadtest-subnet.self_link}"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Compute Engine tops out at 1000 VMs per group
|
||||
#
|
||||
|
||||
resource "google_compute_instance_group_manager" "nodes-a" {
|
||||
name = "nodes-a"
|
||||
|
||||
base_instance_name = "node"
|
||||
instance_template = "${google_compute_instance_template.node.self_link}"
|
||||
target_size = "${var.node-count / 4}"
|
||||
}
|
||||
|
||||
resource "google_compute_instance_group_manager" "nodes-b" {
|
||||
name = "nodes-b"
|
||||
|
||||
base_instance_name = "node"
|
||||
instance_template = "${google_compute_instance_template.node.self_link}"
|
||||
target_size = "${var.node-count / 4}"
|
||||
}
|
||||
|
||||
resource "google_compute_instance_group_manager" "nodes-c" {
|
||||
name = "nodes-c"
|
||||
|
||||
base_instance_name = "node"
|
||||
instance_template = "${google_compute_instance_template.node.self_link}"
|
||||
target_size = "${var.node-count / 4}"
|
||||
}
|
||||
|
||||
resource "google_compute_instance_group_manager" "nodes-d" {
|
||||
name = "nodes-d"
|
||||
|
||||
base_instance_name = "node"
|
||||
instance_template = "${google_compute_instance_template.node.self_link}"
|
||||
target_size = "${var.node-count / 4}"
|
||||
}
|
@ -1 +0,0 @@
|
||||
google-api-python-client==1.6.5
|
@ -1,19 +0,0 @@
|
||||
[defaults]
|
||||
inventory = hosts,~/mitogen/tests/ansible/lib/inventory
|
||||
gathering = explicit
|
||||
strategy_plugins = ~/mitogen/ansible_mitogen/plugins/strategy
|
||||
action_plugins = ~/mitogen/tests/ansible/lib/action
|
||||
callback_plugins = ~/mitogen/tests/ansible/lib/callback
|
||||
stdout_callback = nice_stdout
|
||||
vars_plugins = ~/mitogen/tests/ansible/lib/vars
|
||||
library = ~/mitogen/tests/ansible/lib/modules
|
||||
retry_files_enabled = False
|
||||
forks = 50
|
||||
|
||||
strategy = mitogen_linear
|
||||
|
||||
host_key_checking = False
|
||||
|
||||
[ssh_connection]
|
||||
ssh_args = -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s
|
||||
pipelining = True
|
@ -1,6 +0,0 @@
|
||||
|
||||
Host localhost-*
|
||||
Hostname localhost
|
||||
|
||||
Host gitlab.com
|
||||
IdentityFile ~/.ssh/id_gitlab
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
if (not os.environ.get('MITOGEN_GCLOUD_GROUP')) or any('--host' in s for s in sys.argv):
|
||||
sys.stdout.write('{}')
|
||||
sys.exit(0)
|
||||
|
||||
import googleapiclient.discovery
|
||||
|
||||
|
||||
def main():
|
||||
project = 'mitogen-load-testing'
|
||||
zone = 'europe-west1-d'
|
||||
prefix = 'node-'
|
||||
|
||||
client = googleapiclient.discovery.build('compute', 'v1')
|
||||
resp = client.instances().list(project=project, zone=zone).execute()
|
||||
|
||||
ips = []
|
||||
for inst in resp['items']:
|
||||
if inst['status'] == 'RUNNING' and inst['name'].startswith(prefix):
|
||||
ips.extend(
|
||||
#bytes(config['natIP'])
|
||||
bytes(interface['networkIP'])
|
||||
for interface in inst['networkInterfaces']
|
||||
#for config in interface['accessConfigs']
|
||||
)
|
||||
|
||||
sys.stderr.write('Addresses: %s\n' % (ips,))
|
||||
gname = os.environ['MITOGEN_GCLOUD_GROUP']
|
||||
groups = {
|
||||
gname: {
|
||||
'hosts': ips
|
||||
}
|
||||
}
|
||||
|
||||
for i in 1, 10, 20, 50, 100:
|
||||
groups['%s-%s' % (gname, i)] = {
|
||||
'hosts': ips[:i]
|
||||
}
|
||||
|
||||
sys.stdout.write(json.dumps(groups, indent=4))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1 +0,0 @@
|
||||
*.tar.bz2 filter=lfs diff=lfs merge=lfs -text
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:123ddbd9055745d37e8f14bf1c8352541ff4d500e6daa4aa3165e604fb7e8b6a
|
||||
size 6176131
|
Loading…
Reference in New Issue