blob: ee20ce310f1f181cecbe77d18beeca35921ee85f [file] [log] [blame]
Andy Bavier38333832017-06-19 09:55:35 -04001# Fetch local user rather than relying on (deprecated) ansible_user
2- name: Get the username running the deploy
3 local_action: command whoami
4 register: username_on_the_host
5 tags:
6 - establish_ssh_keys
7 - skip_ansible_lint
8
9# SSH Key access from the current machine to the target node is required for the
10# synchronize action to work.
11- name: Ensure User SSH Keys
12 local_action: user name='{{ username_on_the_host.stdout }}' generate_ssh_key=yes ssh_key_bits=2048
13 tags:
14 - establish_ssh_keys
15
16- name: Ensure Key Authorized on Target Head Node
17 authorized_key:
18 user: '{{ansible_ssh_user}}'
19 key: "{{lookup('file', '~/.ssh/id_rsa.pub')}}"
20 tags:
21 - establish_ssh_keys