You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by "Carlos Valiente (JIRA)" <ji...@apache.org> on 2014/07/22 10:25:38 UTC

[jira] [Created] (LIBCLOUD-599) Ability ro rerun deployment scripts

Carlos Valiente created LIBCLOUD-599:
----------------------------------------

             Summary: Ability ro rerun deployment scripts
                 Key: LIBCLOUD-599
                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-599
             Project: Libcloud
          Issue Type: Wish
          Components: Compute
            Reporter: Carlos Valiente
            Priority: Minor


I'm playing now with Puppet, defining a cluster of a Puppet master and
two sample nodes which contact the master. For all nodes I'm using
Libcloud deployment scripts which ensure Puppet is present in the
systems. Something like this:

{noformat}
#!/usr/bin/env python

script_template = """
#!/bin/sh

sudo apt-get -y update
sudo apt-get -y install puppet

if [ -n "%(master)s" ] ; then
  sudo apt-get -y install puppetmaster
fi
"""


master = driver.deploy_node(name="puppet-master",
                            # [..]
			    deploy=script_template % {"master": "1"})

node1 = driver.deploy_node(name="node1",
                           # [..]
			   deploy=script_template % {"master": ""})             
{noformat}

I would like to set the IP address of the Puppet master in the
appropriate places using the Libcloud deployment script, so that
provisioning might continue on all nodes (including in the Puppet
master) using just Puppet.

Unfortunately, I only know the IP address of the Puppet master once it
has been created, by which time I cannot run the Libcloud deployment
script (because I created the node with {{driver.deploy_node()}}).

It would be nice if the Libcloud API let me create a node first, and
then run a deployment script on it. That way I could do something like
this:

{noformat}
#!/usr/bin/env python

script_template = """
#!/bin/sh

sudo apt-get -y update
sudo apt-get -y install puppet

if [ -n "%(master)s" ] ; then
  sudo apt-get -y install puppetmaster
fi

cat > /etc/puppet/puppet.conf <<EOT
[main]
server=%(puppet_master_ip)s
EOT
"""


master = driver.create_node(name="puppet-master",
                            # [..])

node1 = driver.create_node(name="node1",
                           # [..])             


driver.provision_node(node=master,
		      deploy=script_template % {
		          "master": "1",
			  "puppet_master_ip": master.public_ips[0],
                       })

driver.provision_node(node=node1,
		      deploy=script_template % {
		          "master": "0",
			  "puppet_master_ip": master.public_ips[0],
                       })
{noformat}

The new API call {{provision_node()}} would contain just the
provisioning-specific code of the current {{deploy_node()}} call.
Something like this:

{noformat}
def provision_node(self, node, script, **kwargs):
    # Provisioning code from the current ``deploy_node()`` method

def deploy_node(self, **kwargs):
    node = self.create_node(**kwargs)
    self.provision_node(node, **kwargs)
    return node
{noformat}




--
This message was sent by Atlassian JIRA
(v6.2#6252)