diff --git a/inventory/group_vars/all b/inventory/group_vars/all index e447bb591..22aea202a 100644 --- a/inventory/group_vars/all +++ b/inventory/group_vars/all @@ -27,9 +27,3 @@ dhcp_pool_end: 192.168.1.250 # ipmi_bridging: Default undefined. Valid values: "no", "single", and "dual" # See http://docs.openstack.org/developer/ironic/_modules/ironic/drivers/modules/ipmitool.html #ipmi_bridging: no - -# When testing with VMs, define SSH address, port, and user for agent_ssh driver. -ssh_username: ironic -ssh_port: 1024 -ssh_address: 127.0.0.1 -ssh_private_key_path: /home/ironic/.ssh/id_rsa diff --git a/roles/ironic-enroll/tasks/virtual_enroll.yaml b/roles/ironic-enroll/tasks/virtual_enroll.yaml index 63674a63e..1baf2c6d3 100644 --- a/roles/ironic-enroll/tasks/virtual_enroll.yaml +++ b/roles/ironic-enroll/tasks/virtual_enroll.yaml @@ -44,10 +44,10 @@ driver_info: power: ssh_virt_type: "virsh" - ssh_address: "{{ ssh_address }}" - ssh_port: "{{ ssh_port }}" - ssh_username: "{{ ssh_username }}" - ssh_key_filename: "{{ ssh_private_key_path }}" + ssh_address: 127.0.0.1 + ssh_port: 22 + ssh_username: ironic + ssh_key_filename: /home/ironic/.ssh/id_rsa deploy: deploy_kernel: "{{ deploy_kernel_url }}" deploy_ramdisk: "{{ deploy_ramdisk_url }}" diff --git a/roles/ironic-install/tasks/main.yml b/roles/ironic-install/tasks/main.yml index 7a3e05e84..d246f0a38 100644 --- a/roles/ironic-install/tasks/main.yml +++ b/roles/ironic-install/tasks/main.yml @@ -138,6 +138,24 @@ - name: "Adding ironic user to libvirtd group" user: name=ironic group=libvirtd append=yes when: testing == true +- name: "Creating SSH directory for ironic user" + local_action: file path=/home/ironic/.ssh owner=ironic group=ironic mode=0700 state=directory + when: testing == true +- name: "Checking for ironic user SSH key" + local_action: stat path=/home/ironic/.ssh/id_rsa + register: test_ironic_pvt_key +- name: "Generating SSH key for ironic user" + local_action: command ssh-keygen -f /home/ironic/.ssh/id_rsa -N "" + when: testing == true and test_ironic_pvt_key.stat.exists == false +- name: "Setting ownership on ironic SSH private key" + local_action: file name=/home/ironic/.ssh/id_rsa owner=ironic group=ironic mode=0600 state=file + when: testing == true and test_ironic_pvt_key.stat.exists == false +- name: "Setting ownership on ironic SSH public key" + local_action: file name=/home/ironic/.ssh/id_rsa.pub owner=ironic group=ironic mode=0644 state=file + when: testing == true and test_ironic_pvt_key.stat.exists == false +- name: "Creating authorized_keys file for ironic user" + local_action: command cp -p /home/ironic/.ssh/id_rsa.pub /home/ironic/.ssh/authorized_keys + when: testing == true - name: "Placing services" template: src=init_template.j2 dest=/etc/init/{{item.service_name}}.conf owner=root group=root with_items: