diff --git a/playbooks/roles/bifrost-ironic-install/tasks/main.yml b/playbooks/roles/bifrost-ironic-install/tasks/main.yml index 13e6f53fc..085d96d8e 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/main.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/main.yml @@ -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' diff --git a/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 b/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 index f489a20b2..a9127d493 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 @@ -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] diff --git a/playbooks/roles/bifrost-ironic-install/templates/upstart_template.j2 b/playbooks/roles/bifrost-ironic-install/templates/upstart_template.j2 index 6bc3f451b..7c2d93825 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/upstart_template.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/upstart_template.j2 @@ -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 }}