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

Add support for AWS spot instance #97

Merged
merged 1 commit into from
Dec 5, 2018
Merged

Add support for AWS spot instance #97

merged 1 commit into from
Dec 5, 2018

Conversation

nicosingh
Copy link
Contributor

The idea is to use aws_spot_instance_request terraform resources, the same way as we do for aws_instance resources.

For instance, this spot request:

resource "aws_spot_instance_request" "cheap_worker" {
  ami                  = "ami-1234"
  key_name             = "cheap-worker-ssh-key"
  security_groups      = ["cheap-worker-security-group"]
  wait_for_fulfillment = true
  spot_type            = "one-time"
  instance_type        = "t3.medium"

  tags {
    Role = "cheap-worker"
  }
}

Will match later in ansible-playbook using the defined Role:

---
- hosts: role_cheap-worker
  remote_user: ubuntu
  become: yes
  become_user: root
  tasks:
    - name: install apps
       apt: name=cowsay update_cache=yes

@adammck adammck merged commit 260af32 into adammck:master Dec 5, 2018
@adammck
Copy link
Owner

adammck commented Dec 5, 2018

This is a great idea. Thank you!

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.

2 participants