---
- name: add demo public key
  ec2_key:
    region: "{{ aws_region }}"
    name: "demo-key"
    key_material: "{{ item }}"
  with_file: "keys/demo.pub"
---
- name: add demo public key
  ec2_key:
    region: "{{ aws_region }}"
    name: "{{ ssh_key_name }}"
    key_material: "{{ item }}"
  with_file: "keys/demo.pub"
Use variable for key name.
Use variable for key name.
