Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _provision(roles):
nodes = []
for value in roles.values():
nodes.extend(value)
# remove duplicate hosts
# Note(jrbalderrama): do we have to implement hash/equals in Host?
nodes = set([node.address for node in nodes])
# Provision nodes so we can run Ansible on it
remote.exec_command_on_nodes(
nodes,
'apt-get update && apt-get -y --force-yes install python',
'Installing python...')
# Bind volumes of docker in /tmp (free storage location on G5k)
remote.exec_command_on_nodes(
nodes,
('mkdir -p /tmp/docker/volumes; '
'mkdir -p /var/lib/docker/volumes'),
'Creating docker volumes directory in /tmp')
remote.exec_command_on_nodes(
nodes,
('(mount | grep /tmp/docker/volumes) || '
'mount --bind /tmp/docker/volumes /var/lib/docker/volumes'),
'Bind mount')
nodes,
('mkdir -p /tmp/docker/volumes; '
'mkdir -p /var/lib/docker/volumes'),
'Creating docker volumes directory in /tmp')
remote.exec_command_on_nodes(
nodes,
('(mount | grep /tmp/docker/volumes) || '
'mount --bind /tmp/docker/volumes /var/lib/docker/volumes'),
'Bind mount')
# Bind nova local storage in /tmp
remote.exec_command_on_nodes(
nodes,
'mkdir -p /tmp/nova ; mkdir -p /var/lib/nova',
'Creating nova directory in /tmp')
remote.exec_command_on_nodes(
nodes,
('(mount | grep /tmp/nova) || '
'mount --bind /tmp/nova /var/lib/nova'),
'Bind mount')