Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multitag Support #11

Merged
merged 3 commits into from
Jan 13, 2014
Merged

Multitag Support #11

merged 3 commits into from
Jan 13, 2014

Conversation

imlucas
Copy link
Contributor

@imlucas imlucas commented Jun 10, 2013

This also fixes the @ec2instance deco to behave like everything else.

New stuff:

Allow specifying multiple tags and region on @ec2instance

from fabric.api import task, env
from awsfabrictasks.decorators import ec2instance

@task
@ec2instance(tags={'Environment': 'production', 'Service Name': 'pythonapp'}, region='us-east-1')
def run_on_production_pythonapp_instances():
    run('whoami')

Allow defining dynamically populated role defs. I find this to be a lot nicer than specifying key pairs to --ec2tags every time.

from fabric.api import task, env
from awsfabrictasks import expand_roledefs

env.roledefs.update({
    'prod_web': {
        'ec2:tagged': {
            'Environment': 'production',
            'Service Name': 'pythonapp',
            'region': 'us-east-1'
        }
    },
    'prod_celeryworkers': {
        'ec2:tagged': {
            'Environment': 'production',
            'Service Name': 'worker',
            'region': 'us-east-1'
        }
    },
    'prod_celerybeat': {
        'ec2:tagged': {
            'Environment': 'production',
            'Service Name': 'celerybeat',
            'region': 'us-east-1'
        }
    },
    'all_prod': {
        'ec2:tagged': {
            'Environment': 'production',
            'region': 'us-east-1'
        }
    }
})

expand_roledefs()

@roles('prod_web')
def run_on_prod_pythonapp():
    run('whoami')

@roles('prod_celeryworkers')
def restart_celeryworkers():
    run('supervisorctl restart celery:celeryworkers:*')

@espenak
Copy link
Owner

espenak commented Aug 19, 2013

I am very very sorry about not replying to this earlier. The notification must have been lost in the mass of email during my summer vacation.

Looks like a very useful addition to the library.

I have a lot of work that needs to be completed by the end of this week, but I will test your pull request as soon as I have some time.

@imlucas
Copy link
Contributor Author

imlucas commented Aug 19, 2013

No worries. Been using this patch almost daily to manage 75+ instances
since I sent the initial PR so I think it's working pretty well :p excited
to see some new stuff coming soon!

On Monday, August 19, 2013, Espen Angell Kristiansen wrote:

I am very very sorry about not replying to this earlier. The
notification must have been lost in the mass of email during my summer
vacation.

Looks like a very useful addition to the library.

I have a lot of work that needs to be completed by the end of this week,
but I will test your pull request as soon as I have some time.


Reply to this email directly or view it on GitHubhttps://github.com//pull/11#issuecomment-22861436
.

@imlucas
Copy link
Contributor Author

imlucas commented Oct 23, 2013

Any updates on this?

espenak added a commit that referenced this pull request Jan 13, 2014
@espenak espenak merged commit 9c4c2d4 into espenak:master Jan 13, 2014
espenak added a commit that referenced this pull request Jan 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants