summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qtip/ansible_library/modules/apex_generate_inventory.py3
-rw-r--r--qtip/ansible_library/modules/fuel.py3
-rw-r--r--resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg2
-rw-r--r--tests/unit/ansible_library/modules/apex_generate_inventory_test.py10
-rw-r--r--tests/unit/ansible_library/modules/fuel_test.py12
5 files changed, 16 insertions, 14 deletions
diff --git a/qtip/ansible_library/modules/apex_generate_inventory.py b/qtip/ansible_library/modules/apex_generate_inventory.py
index b1cc976d..0c9500f1 100644
--- a/qtip/ansible_library/modules/apex_generate_inventory.py
+++ b/qtip/ansible_library/modules/apex_generate_inventory.py
@@ -79,7 +79,8 @@ def generate_inventory(baremetal_info, server_info):
node_ip = re.findall('.+=(\d+.\d+.\d+.\d+)$', server['Networks'])[0]
hosts[role].append(node_ip)
# To match ssh.cfg.j2 template
- hosts_meta[node_ip] = {'ansible_ssh_host': node_ip}
+ hosts_meta[node_ip] = {'ansible_ssh_host': node_ip,
+ 'ansible_user': 'heat-admin'}
for host in hosts:
hosts[host].sort()
diff --git a/qtip/ansible_library/modules/fuel.py b/qtip/ansible_library/modules/fuel.py
index 5ec45dd1..04154e34 100644
--- a/qtip/ansible_library/modules/fuel.py
+++ b/qtip/ansible_library/modules/fuel.py
@@ -98,7 +98,8 @@ def generate_inventory(nodes):
'ip': node['ip'],
'mac': node['mac'],
'cluster': cluster_id,
- 'ansible_ssh_host': node['ip']
+ 'ansible_ssh_host': node['ip'],
+ 'ansible_user': 'root'
}
hosts_meta[hostname] = node_meta
diff --git a/resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg b/resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg
index f0e33fd4..1b7c0183 100644
--- a/resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg
+++ b/resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg
@@ -9,7 +9,7 @@
{% for (name, host) in hosts_meta.items() %}
Host {{ name }}
HostName {{ host.ansible_ssh_host }}
- User root
+ User {{ host.ansible_user }}
ProxyCommand ssh -o 'ForwardAgent yes' {{ installer_host }} 'ssh-add && nc %h %p'
{% endfor %}
diff --git a/tests/unit/ansible_library/modules/apex_generate_inventory_test.py b/tests/unit/ansible_library/modules/apex_generate_inventory_test.py
index 7df9d35c..668a0155 100644
--- a/tests/unit/ansible_library/modules/apex_generate_inventory_test.py
+++ b/tests/unit/ansible_library/modules/apex_generate_inventory_test.py
@@ -23,8 +23,8 @@ def test_generate_inventory(data_root):
u'compute': [u'192.0.2.5', u'192.0.2.6'],
u'control': [u'192.0.2.7', u'192.0.2.8', u'192.0.2.9']}
assert dict(inventory['hosts_meta']) == {
- u'192.0.2.5': {'ansible_ssh_host': u'192.0.2.5'},
- u'192.0.2.6': {'ansible_ssh_host': u'192.0.2.6'},
- u'192.0.2.7': {'ansible_ssh_host': u'192.0.2.7'},
- u'192.0.2.8': {'ansible_ssh_host': u'192.0.2.8'},
- u'192.0.2.9': {'ansible_ssh_host': u'192.0.2.9'}}
+ u'192.0.2.5': {'ansible_ssh_host': u'192.0.2.5', 'ansible_user': 'heat-admin'},
+ u'192.0.2.6': {'ansible_ssh_host': u'192.0.2.6', 'ansible_user': 'heat-admin'},
+ u'192.0.2.7': {'ansible_ssh_host': u'192.0.2.7', 'ansible_user': 'heat-admin'},
+ u'192.0.2.8': {'ansible_ssh_host': u'192.0.2.8', 'ansible_user': 'heat-admin'},
+ u'192.0.2.9': {'ansible_ssh_host': u'192.0.2.9', 'ansible_user': 'heat-admin'}}
diff --git a/tests/unit/ansible_library/modules/fuel_test.py b/tests/unit/ansible_library/modules/fuel_test.py
index e004fc17..9ec1806f 100644
--- a/tests/unit/ansible_library/modules/fuel_test.py
+++ b/tests/unit/ansible_library/modules/fuel_test.py
@@ -34,21 +34,21 @@ def test_generate_inventory(data_root):
u'node-27'],
u'mongo': [u'node-24']}
assert dict(inventory['hosts_meta']) == {
- u'node-23': {'ansible_ssh_host': u'10.20.11.10', 'cluster': 4, 'ip': u'10.20.11.10',
+ u'node-23': {'ansible_ssh_host': u'10.20.11.10', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.10',
'mac': u'74:4a:a4:01:71:61', 'name': u'Untitled (71:61)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-24': {'ansible_ssh_host': u'10.20.11.11', 'cluster': 4, 'ip': u'10.20.11.11',
+ u'node-24': {'ansible_ssh_host': u'10.20.11.11', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.11',
'mac': u'74:4a:a4:01:73:50', 'name': u'Untitled (73:50)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-25': {'ansible_ssh_host': u'10.20.11.12', 'cluster': 4, 'ip': u'10.20.11.12',
+ u'node-25': {'ansible_ssh_host': u'10.20.11.12', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.12',
'mac': u'74:4a:a4:00:d8:76', 'name': u'Untitled (d8:76)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-26': {'ansible_ssh_host': u'10.20.11.15', 'cluster': 4, 'ip': u'10.20.11.15',
+ u'node-26': {'ansible_ssh_host': u'10.20.11.15', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.15',
'mac': u'74:4a:a4:01:61:ae', 'name': u'Untitled (61:ae)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-27': {'ansible_ssh_host': u'10.20.11.13', 'cluster': 4, 'ip': u'10.20.11.13',
+ u'node-27': {'ansible_ssh_host': u'10.20.11.13', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.13',
'mac': u'74:4a:a4:01:82:c0', 'name': u'Untitled (82:c0)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-28': {'ansible_ssh_host': u'10.20.11.14', 'cluster': 4, 'ip': u'10.20.11.14',
+ u'node-28': {'ansible_ssh_host': u'10.20.11.14', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.14',
'mac': u'74:4a:a4:01:74:63', 'name': u'Untitled (74:63)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'}}