2016-12-12 19:02:45 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Generate the SSH private key
|
2017-05-17 06:30:04 +00:00
|
|
|
shell: >
|
|
|
|
echo -e 'n' |
|
|
|
|
ssh-keygen -b 2048 -C {{ SSH_keys.comment }}
|
|
|
|
-t rsa -f {{ SSH_keys.private }} -q -N ""
|
2016-12-12 19:02:45 +00:00
|
|
|
args:
|
2017-03-31 17:25:39 +00:00
|
|
|
creates: "{{ SSH_keys.private }}"
|
2016-12-12 19:02:45 +00:00
|
|
|
|
|
|
|
- name: Generate the SSH public key
|
2017-05-17 06:30:04 +00:00
|
|
|
shell: >
|
|
|
|
echo `ssh-keygen -y -f {{ SSH_keys.private }}` {{ SSH_keys.comment }}
|
|
|
|
> {{ SSH_keys.public }}
|
2017-04-09 18:39:22 +00:00
|
|
|
changed_when: false
|
2016-12-12 19:02:45 +00:00
|
|
|
|
|
|
|
- name: Change mode for the SSH private key
|
2017-05-17 06:30:04 +00:00
|
|
|
file:
|
|
|
|
path: "{{ SSH_keys.private }}"
|
|
|
|
mode: 0600
|
2017-03-05 20:19:15 +00:00
|
|
|
|
|
|
|
- name: Ensure the dynamic inventory exists
|
|
|
|
blockinfile:
|
|
|
|
dest: configs/inventory.dynamic
|
|
|
|
marker: "# {mark} ALGO MANAGED BLOCK"
|
|
|
|
create: yes
|
|
|
|
block: |
|
|
|
|
[algo:children]
|
2017-04-16 14:19:47 +00:00
|
|
|
{% for group in cloud_providers.keys() %}
|
2017-03-05 20:19:15 +00:00
|
|
|
{{ group }}
|
|
|
|
{% endfor %}
|