Setup SSH keys for ironic user

During testing using VMs, let's automatically setup the SSH keys
that will be needed for the agent_ssh driver functionality.
This commit is contained in:
David Shrewsbury 2015-03-16 17:02:33 +00:00
parent 2de31449c3
commit f3bedfa298
3 changed files with 22 additions and 10 deletions

View File

@ -31,10 +31,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 }}"

View File

@ -135,6 +135,24 @@
- name: "Adding ironic user to libvirtd group"
local_action: 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"
local_action: template src=init_template.j2 dest=/etc/init/{{item.service_name}}.conf owner=root group=root
with_items:

View File

@ -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