Ejemplo n.º 1
0
def ubuntu_ami():
    ami = Ami("WebUbuntu", "ubuntu")
    ami.add_role('sudo-nopw', {}, 100)
    ami.add_role('users', {'githubusers':[ 'ibejohn818'] }, 200)
    return ami

def aws_linux_ami():
    ami = Ami("WebUbuntu", "awslinux")
    ami.add_role('sudo-nopw', {}, 100)
    ami.add_role('users', {'githubusers':[ 'ibejohn818'] }, 200)
    return ami

# set path to ansible directory
Ami.ANSIBLE_DIR='./ansible'
# set list to individual ansible roles
# Ami.ANSIBLE_ROLES = [
    # '/path/to/role',
    # '/path/to/another/role'
# ]


session = BotoSession(region_name='us-west-1')

infra = Infra('StackDemo', session)

infra.add_image(ubuntu_ami())

prod_infra = prod_stacks(infra)
dev_infra = dev_stacks(infra)
staging_infra = staging_stacks(infra)
    return ami


# ANSIBLE PATH
Ami.ANSIBLE_DIR = "{}/ansible".format(
    os.path.dirname(os.path.realpath(__file__)))

session = BotoSession(region_name='us-east-2')

infra = Infra('NatDemo', session)

# create sns topic for alarms
# top level sns topic
sns_stack = infra.add_stack(sns.SNSTopicStack("AlarmNotifications"))
# topic subscriptions
## slack subscription
slack_sub = sns_stack.add_subscription(sns.SlackSubscription("AwsAlarms"))
## email subscription
email_sub = sns_stack.add_subscription(sns.EmailSubscription('EmailNotify'))
infra.add_vars({'InputEmailNotifySNSEmailAddress': '*****@*****.**'})

# add ami's to infra
web_ubuntu = web_ubuntu_ami()
aws_bastion = aws_bastion_ami()

infra.add_image(web_ubuntu)
infra.add_image(aws_bastion)

prod = prod_stacks(infra)
dev = dev_stacks(infra)