Created
April 4, 2014 01:09
-
-
Save abutcher/9966083 to your computer and use it in GitHub Desktop.
Don't puke!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Class: aws::failover::secondaryip | |
| # | |
| # Associate a secondary IP to the primary interface of a node. | |
| # | |
| # Parameters: | |
| # service_ip - The ip address you've pre-allocated for the service | |
| # aws_user - The system user who will be executing the aws call | |
| # | |
| # Sample Usage : | |
| # class { 'aws::failover::secondaryip': | |
| # service_ip => 'A REAL IP ADDRESS', | |
| # aws_user => 'A REAL ACCOUNT YOU MADE', | |
| # } | |
| # | |
| class aws::failover::secondaryip ( $service_ip, $aws_user ) { | |
| exec { 'assign-private-ip-address' : | |
| command => "su -c \'aws ec2 assign-private-ip-addresses --allow-reassignment --network-interface-id $(aws ec2 describe-instances --instance-ids ${::hostname} | grep NetworkInterfaceId | cut -d\\\" -f4) --private-ip-addresses ${service_ip}\' ${aws_user}", | |
| unless => "ping -c 3 -W 1 ${service_ip}", | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment