algo/playbooks/local.yml

32 lines
762 B
YAML
Raw Normal View History

2016-12-12 19:02:45 +00:00
---
- name: Generate the SSH private key
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:
creates: "{{ SSH_keys.private }}"
2016-12-12 19:02:45 +00:00
- name: Generate the SSH public key
shell: >
echo `ssh-keygen -y -f {{ SSH_keys.private }}` {{ SSH_keys.comment }}
> {{ SSH_keys.public }}
changed_when: false
2016-12-12 19:02:45 +00:00
- name: Change mode for the SSH private key
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]
{% for group in cloud_providers.keys() %}
2017-03-05 20:19:15 +00:00
{{ group }}
{% endfor %}