Created
December 3, 2019 21:36
-
-
Save jonsbun/ca77975e3df80a879e8d4e284c89b7a6 to your computer and use it in GitHub Desktop.
Prepare Server(s) for Ansible (ansible-init): https://github.com/jonsbun/ansible-init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Prepare localhost for Ansible usage | |
hosts: localhost | |
connection: local | |
gather_facts: yes | |
tasks: | |
- name: Generate SSH key | |
user: | |
name: "{{ ansible_user_id }}" | |
generate_ssh_key: yes | |
- name: Prepare host(s) for Ansible usage | |
hosts: all | |
gather_facts: no | |
tasks: | |
- name: Set authorized key on remote | |
authorized_key: | |
user: "{{ ansible_user }}" | |
state: present | |
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment