Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Merge bde1683 into e913f02
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmb committed Mar 24, 2015
2 parents e913f02 + bde1683 commit c586372
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Add conditional statement in fabfile to check for ssl cert on roll back before trying to delete it.
* Refactor fab_tasks get_config method to not return *every* config item. Also PEP8 fixes and removing unused functions.
* Change security group input to dictionary so we can create multiple groups that reference each other.
* Include cloudformation config in salt pillar.

## Version 0.1

Expand Down
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ In order to rsync your salt states to the salt master you need to add a `salt` s
**Default value**: /srv/salt
- **remote_pillar_dir**: Pillar root on the master.
**Default value**: /srv/pillar

The cloudformation yaml will be automatically uploaded to your pillar as cloudformation.sls. So if you include ``-cloudformation`` in your pillar top file you can do things like:

::

salt-call pillar.get s3:static-bucket-name

SSL certs for ELBs
++++++++++++++++++++

Expand Down
14 changes: 11 additions & 3 deletions bootstrap_cfn/fab_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

import sys
import random
import yaml
from bootstrap_cfn.config import AWSConfig, ProjectConfig, ConfigParser
from bootstrap_cfn.cloudformation import Cloudformation
from bootstrap_cfn.ec2 import EC2
from bootstrap_cfn.iam import IAM

import os
from StringIO import StringIO

from fabric.api import env, task, sudo
from fabric.api import env, task, sudo, put
from fabric.contrib.project import upload_project

# GLOBAL VARIABLES
Expand Down Expand Up @@ -96,13 +98,11 @@ def get_config():
cfn_config = ConfigParser(project_config.config, get_stack_name())
return cfn_config


def get_connection(klass):
_validate_fabric_env()
aws_config = AWSConfig(env.aws)
return klass(aws_config)


@task
def cfn_delete(force=False):
if not force:
Expand Down Expand Up @@ -261,6 +261,7 @@ def rsync():
work_dir = os.path.join('..', '{0}-deploy'.format(env.application))

project_config = ProjectConfig(env.config, env.environment)
stack_name = get_stack_name()
cfg = project_config.config
salt_cfg = cfg.get('salt', {})

Expand Down Expand Up @@ -300,3 +301,10 @@ def rsync():
remote_dir=remote_pillar_dir,
local_dir=os.path.join(local_pillar_dir, env.environment, '.'),
use_sudo=True)
cf_sls = StringIO(yaml.dump(cfg))
put(
remote_path=os.path.join(
remote_pillar_dir,
'cloudformation.sls'),
local_path=cf_sls,
use_sudo=True)

0 comments on commit c586372

Please sign in to comment.