Sposto la creazione della chiave all'inizio del task di setup.

This commit is contained in:
Emiliano Vavassori 2015-04-22 00:07:42 +02:00
parent 2048720f0c
commit 53c07dd366
3 changed files with 7 additions and 8 deletions

View File

@ -12,5 +12,3 @@
when: ansible_os_family == "RedHat"
- include: mgmtuser.yml
- include: ssh-keygen.yml

View File

@ -1,5 +1,8 @@
---
- include: ssh-keygen.yml
tags: ssh
- include: centos_pkgs.yml
when: ansible_distribution == "CentOS" and ansible_os_family == "RedHat"
tags: centos

View File

@ -1,22 +1,20 @@
---
- name: Verifica presenza directory .ssh
shell: test -d /root/.ssh
shell: test -d $HOME/.ssh
register: check_sshdir
ignore_errors: true
- name: Creazione directory .ssh
shell: mkdir -p /root/.ssh
shell: mkdir -p $HOME/.ssh
when: check_sshdir|failed
- name: Verifica chiave ssh
shell: test -f /root/.ssh/id_rsa
shell: test -f $HOME/.ssh/id_rsa
changed_when: false
ignore_errors: true
register: check_key
- name: Gestione creazione chiave ssh
shell: ssh-keygen -t rsa -b 1024 -f /root/.ssh/id_rsa -N ''
sudo: yes
sudo_user: root
shell: ssh-keygen -t rsa -b 1024 -f $HOME/.ssh/id_rsa -N ''
when: check_key|failed