Get install path for ironic services

Depending on the distribution, pip can install the ironic
services in /usr/bin or in /usr/local/bin. Find the correct
path so we can supply it to the templates for the systemd
and upstart files.

Change-Id: I058e6fdbe7d89249b4c9818a37ee22dafdd5d594
This commit is contained in:
stephane 2015-08-28 11:52:19 -07:00
parent 4c65e3d7b3
commit e6bfd65d0f
3 changed files with 7 additions and 4 deletions

View File

@ -149,11 +149,14 @@
- name: "Creating authorized_keys file for ironic user"
command: cp -p /home/ironic/.ssh/id_rsa.pub /home/ironic/.ssh/authorized_keys
when: testing == true
- name: "Get ironic-api & ironic-conductor install location"
shell: echo $(dirname $(which ironic-api))
register: ironic_install_prefix
- name: "Placing services"
template: src={{ init_template }} dest={{ init_dest_dir }}{{item.service_name}}{{ init_ext }} owner=root group=root
with_items:
- { service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
- { service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
- { service_path: "{{ ironic_install_prefix.stdout }}", service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
- { service_path: "{{ ironic_install_prefix.stdout }}", service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
- name: "Reload systemd configuration"
command: systemctl daemon-reload
when: init_template == 'systemd_template.j2'

View File

@ -2,7 +2,7 @@
Description={{ item.service_name }} service
[Service]
ExecStart=/usr/bin/{{ item.service_name }} {{ item.args }}
ExecStart={{ item.service_path }}/{{ item.service_name }} {{ item.args }}
User={{ item.username }}
[Install]

View File

@ -7,4 +7,4 @@ end script
respawn
respawn limit 2 10
exec start-stop-daemon --start -c {{ item.username }} --exec /usr/local/bin/{{ item.service_name }} -- {{ item.args }}
exec start-stop-daemon --start -c {{ item.username }} --exec {{ item.service_path }}/{{ item.service_name }} -- {{ item.args }}