Make Ansible got faster
Still not what I would call fast though.
diff --git a/ansible.cfg b/ansible.cfg
index d5122a1..de128bb 100644
--- a/ansible.cfg
+++ b/ansible.cfg
@@ -1,7 +1,9 @@
[defaults]
inventory = ./production
vault_password_file = ~/.couchdb-ansible-vault
+forks = 10
[ssh_connection]
ssh_args = -F ./ssh.cfg
-control_path = ~/.ssh/ansible-%%r@%%h:%%p
+control_path = /tmp/ansible-%%r@%%h:%%p
+pipelining = True
\ No newline at end of file
diff --git a/ssh.cfg b/ssh.cfg
index 95da36a..02ab8fe 100644
--- a/ssh.cfg
+++ b/ssh.cfg
@@ -4,54 +4,78 @@
ForwardAgent yes
StrictHostKeyChecking no
ControlMaster auto
- ControlPath ~/.ssh/ansible-%r@%h:%p
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
+
+Host couchdb-worker-x86-64-debian-dal-1-01
+ Hostname 10.240.0.4
+ User root
+ StrictHostKeyChecking no
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@169.48.153.153
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
+
+Host couchdb-worker-x86-64-debian-dal-1-02
+ Hostname 10.240.0.5
+ User root
+ StrictHostKeyChecking no
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@169.48.153.153
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
+
+Host couchdb-worker-x86-64-debian-dal-1-03
+ Hostname 10.240.0.6
+ User root
+ StrictHostKeyChecking no
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@169.48.153.153
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
+
+Host couchdb-worker-x86-64-debian-dal-1-04
+ Hostname 10.240.0.9
+ User root
+ StrictHostKeyChecking no
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@169.48.153.153
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
+
+Host couchdb-worker-x86-64-debian-dal-1-05
+ Hostname 10.240.0.10
+ User root
+ StrictHostKeyChecking no
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@169.48.153.153
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
+
+Host couchdb-worker-x86-64-debian-dal-1-06
+ Hostname 10.240.0.14
+ User root
+ StrictHostKeyChecking no
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@169.48.153.153
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
+
+Host couchdb-worker-x86-64-debian-dal-1-07
+ Hostname 10.240.0.15
+ User root
+ StrictHostKeyChecking no
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@169.48.153.153
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
ControlPersist 30m
Host couchdb-worker-x86-64-debian-dal-1-08
Hostname 10.240.0.16
User root
StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@169.48.153.153
-
-Host couchdb-worker-x86-64-debian-dal-1-05
- Hostname 10.240.0.10
- User root
- StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@169.48.153.153
-
-Host couchdb-worker-x86-64-debian-dal-1-04
- Hostname 10.240.0.9
- User root
- StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@169.48.153.153
-
-Host couchdb-worker-x86-64-debian-dal-1-07
- Hostname 10.240.0.15
- User root
- StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@169.48.153.153
-
-Host couchdb-worker-x86-64-debian-dal-1-06
- Hostname 10.240.0.14
- User root
- StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@169.48.153.153
-
-Host couchdb-worker-x86-64-debian-dal-1-01
- Hostname 10.240.0.4
- User root
- StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@169.48.153.153
-
-Host couchdb-worker-x86-64-debian-dal-1-03
- Hostname 10.240.0.6
- User root
- StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@169.48.153.153
-
-Host couchdb-worker-x86-64-debian-dal-1-02
- Hostname 10.240.0.5
- User root
- StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@169.48.153.153
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@169.48.153.153
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
diff --git a/tools/gen-config b/tools/gen-config
index 1f39bd9..ffc59d3 100755
--- a/tools/gen-config
+++ b/tools/gen-config
@@ -175,11 +175,11 @@
def write_inventory(fname, bastions, ci_agents):
inventory = {"all": {
"children": {
- "ci_agents": {
- "hosts": ci_agents
- },
"bastions": {
"hosts": bastions
+ },
+ "ci_agents": {
+ "hosts": ci_agents
}
}
}}
@@ -196,7 +196,7 @@
ForwardAgent yes
StrictHostKeyChecking no
ControlMaster auto
- ControlPath ~/.ssh/ansible-%r@%h:%p
+ ControlPath /tmp/ansible-%r@%h:%p
ControlPersist 30m
""")
@@ -205,18 +205,21 @@
Hostname {ip_addr}
User root
StrictHostKeyChecking no
- ProxyCommand /usr/bin/ssh -W %h:%p -q root@{bastion_ip}
+ ProxyCommand /usr/bin/ssh -F ./ssh.cfg -W %h:%p -q root@{bastion_ip}
+ ControlMaster auto
+ ControlPath /tmp/ansible-%r@%h:%p
+ ControlPersist 30m
""")
with open(filename, "w") as handle:
- for host, info in bastions.items():
+ for host, info in sorted(bastions.items()):
args = {
"host": host,
"ip_addr": info["ip_addrs"]["public"]
}
entry = bastion_tmpl.format(**args)
handle.write(entry)
- for host, info in ci_agents.items():
+ for host, info in sorted(ci_agents.items()):
args = {
"host": host,
"ip_addr": info["ip_addrs"]["private"],