--- - hosts: localhost vars: aws_instance_type: "r4.2xlarge" # needs to be hvm:ebs-ssd instance type aws_ami: "ami-20631a36" redundancy: 1 tasks: - name: Provision servers for varnish ec2: #assign_public_ip: True instance_type: "{{ aws_instance_type }}" image: "{{ aws_ami }}" keypair: "jsca@loc.gov" region: "us-east-1" wait: True count: "{{ redundancy }}" volumes: - device_name: "/dev/sda1" volume_type: "gp2" volume_size: 8 delete_on_termination: True register: varnish_ec2 - name: Add new instance to host group add_host: hostname: "{{ item.public_ip }}" groupname: varnish_instances with_items: "{{ varnish_ec2.instances }}" - name: Wait for ssh to come up wait_for: host: "{{ item.public_dns_name }}" port: 22 state: started with_items: "{{ varnish_ec2.instances }}" - name: Configure varnish servers hosts: varnish_instances user: ubuntu become: True gather_facts: True vars: ansible_ssh_private_key_file: "/Users/jscancella/.ssh/jscalocgov.pem" ansible_python_interpreter: "/usr/bin/python3" #because ubuntu 16.04 removed python 2.X varnish_storage: "file,/var/lib/varnish/varnish_storage.bin,6GB" roles: - geerlingguy.varnish