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

Added support for tags to the ec2 module #1947

Closed
wants to merge 7 commits into from

Conversation

lardcanoe
Copy link
Contributor

Example:

  • - name: Launch New Server Instances
  • local_action: ec2
    • keypair=${grp_name}
    • group=${grp_name}
    • instance_type=${item.instance}
    • image=${item.image}
    • wait=true
    • user_data='{"servertype":"${item.type}","group":"${grp_name}","name":"${item.name}"}'
    • instance_tags='{"Name":"${grp_name}-${item.name}", "GroupType":"${grp_name}-${item.type}", "ServerType":"${item.type}", "Group":"${grp_name}", "Deployment":"${deployment}"}'
  • register: instres
  • with_items: ${instances}

@mpdehaan
Copy link
Contributor

json code is available via "module.jsonify(datastructure)" which can clean up the try/except ImportError block. Can you update the pull request to use that?

Otherwise looks good to me though bouncing it off some EC2 users wouldn't hurt. In queue for inclusion for 1.1 as we're at feature freeze for 1.0 right now (releasing Friday).

Thanks very much!

@lardcanoe
Copy link
Contributor Author

Made the change you requested, though I couldn't use jsonify since that is "dumps" and I needed "loads" so I made a new function in module for that.

@lwade
Copy link
Contributor

lwade commented Feb 3, 2013

I'll look to test this tomorrow.

@lwade
Copy link
Contributor

lwade commented Feb 4, 2013

Tested and this works fine, thanks. I'd like to suggest we make the documented syntax very clear here, in that it does follow AWS semantics:

key[=value]

ref: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html

Thus with the module,

instance_tags='{"Name":""}'

works fine. So perhaps line 106 should read:

instance_tags='{"Key":"Value"}

@mpdehaan
Copy link
Contributor

mpdehaan commented Feb 4, 2013

Yeah the DOCUMENTATION header is all inline for all modules in the library/
dir, so send whatever patches you feel appropriate.

We don't have that luxury for the inventory plugins yet if you have tried
using those (upgrades to those also welcome).

On Mon, Feb 4, 2013 at 8:07 AM, Lester Wade notifications@github.comwrote:

Tested and this works fine, thanks. I'd like to suggest we make the
documented syntax very clear here, in that it does follow AWS semantics:

key[=value]

ref: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html

Thus with the module,

instance_tags='{"Name":""}'

works fine. So perhaps line 106 should read:

instance_tags='{"Key":"Value"}


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

@mpdehaan
Copy link
Contributor

mpdehaan commented Feb 7, 2013

Thanks! This is in queue for looking at probably Saturday.

Small request -- rather than do merge commits, can you start doing "git pull --rebase" (or just git fetch / git rebase)?

This keeps merges out of the history.

I would also recommend starting a new branch for each new line of development, so this branch would be like "ec2_add_tags".

Another cool thing you may want to look at is "git rebase -i" which allows you to squash changes all into one commit.

This pull request is ok as I can review it with "git am" and apply manually, just sharing for future reference!

@lardcanoe
Copy link
Contributor Author

Your patience with a git n00b like me is impressive. I will practice those
commands on another repo so next time it will go smoother. Appreciate the
advice!

On Thu, Feb 7, 2013 at 8:07 AM, Michael DeHaan notifications@github.comwrote:

Thanks! This is in queue for looking at probably Saturday.

Small request -- rather than do merge commits, can you start doing "git
pull --rebase" (or just git fetch / git rebase)?

This keeps merges out of the history.

I would also recommend starting a new branch for each new line of
development, so this branch would be like "ec2_add_tags".

Another cool thing you may want to look at is "git rebase -i" which allows
you to squash changes all into one commit.

This pull request is ok as I can review it with "git am" and apply
manually, just sharing for future reference!


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

@mpdehaan
Copy link
Contributor

mpdehaan commented Feb 9, 2013

all merged in, thanks!

@mpdehaan mpdehaan closed this Feb 9, 2013
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants