aboutsummaryrefslogtreecommitdiff
path: root/roles/ssh_keys/tasks/main.yml.2016-09-22.01
blob: b9536c47e80f6c39be3b9f2374e7b78abbc0a7c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
- name: ssh_keys get vars
  include_vars: default.yml

- name: ssh_keys get OS vars
  include_vars: '{{ item }}'
  with_first_found:
    - '{{ ansible_distribution }}.yml'
    - default.yml

- stat: path='{{ master_home_dir }}/{{ item | basename | regex_replace('\.pubkeys?$','') }}/.ssh'
  register: files_stat
  with_fileglob:
    - '*.pubkey'
    - '*.pubkeys'

- debug: var='{{ item.stat.exists }}'
  with_items: '{{ files_stat.results }}'

- name: ssh_keys deploy keys
  template: src='{{ item }}' dest='{{ master_home_dir }}/{{ item | basename | regex_replace('\.pubkeys?$','') }}/.ssh/authorized_keys' mode=0600 owner='{{ item | basename | regex_replace('\.pubkeys?$',"") }}'
  with_fileglob:
    - '*.pubkey'
    - '*.pubkeys'
  #when: item2.stat.exists
  #with_items: '{{ files_stat.results }}'
bgstack15