- name: Ensure key files exist
  fail: msg="Key file {{local_dir + '/' + item}} is empty!"
  when: lookup('file', local_dir + '/' + item)|default(None) == None
  with_items: dev_key_files
  tags: [deployer]

- name: Ensure devs keys are present
  authorized_key: key="{{ lookup('file', local_dir + '/' + item) }}"
                  manage_dir=yes
                  state=present
                  user=deployer
  with_items: dev_key_files
  tags: [deployer]

- name: Ensure DO pubkey is present
  authorized_key: key="{{ lookup('file', 'id_rsa_digital_ocean.pub') }}"
                  manage_dir=yes
                  state=present
                  user=deployer
  tags: [deployer]

- name: Ensure key files exist
  fail: msg="Key file {{item}} is empty!"
  when: lookup('file', item)|default(None) == None
  with_items: dev_key_files
  tags: [deployer]

- name: Ensure devs keys are present
  authorized_key: key="{{ lookup('file', item) }}"
                  manage_dir=yes
                  state=present
                  user=deployer
  with_items: dev_key_files
  tags: [deployer]

- name: Ensure DO pubkey is present
  authorized_key: key="{{ lookup('file', 'id_rsa_digital_ocean.pub') }}"
                  manage_dir=yes
                  state=present
                  user=deployer
  tags: [deployer]

Allow keyfile to exist anywhere on the users system
Allow keyfile to exist anywhere on the users system
