Rabbitmq process exited supervisor and couldn't respawn it afterwards.
Updated the way rabbitmq service and node are spawned to have them
RUNNING after a service stop or node down.
JIRA: YARDSTICK-1600
Change-Id: Idd6812db7a1985e8c727efd7ea45572199c1a4a9
Signed-off-by: Stepan Andrushko <stepanx.andrushko@intel.com>
- { role: configure_gui, when: installation_mode != inst_mode_container_pull }
- { role: download_trex, when: installation_mode != inst_mode_container_pull }
- { role: install_trex, when: installation_mode != inst_mode_container_pull }
- - { role: configure_rabbitmq, when: installation_mode == inst_mode_baremetal }
+ - role: configure_rabbitmq
+ install_mode: "{{ installation_mode }}"
post_tasks:
# See the License for the specific language governing permissions and
# limitations under the License.
---
-- name: Restart rabbitmq
- service:
- name: rabbitmq-server
- state: restarted
+- block:
+ - name: Restart rabbitmq
+ service:
+ name: rabbitmq-server
+ state: restarted
-- name: rabbitmqctl start_app
- shell: rabbitmqctl start_app
+ - name: rabbitmqctl start_app
+ shell: rabbitmqctl start_app
-- name: Configure rabbitmq
- rabbitmq_user:
- user: yardstick
- password: yardstick
- configure_priv: .*
- read_priv: .*
- write_priv: .*
- state: present
+ - name: Configure rabbitmq
+ rabbitmq_user:
+ user: yardstick
+ password: yardstick
+ configure_priv: .*
+ read_priv: .*
+ write_priv: .*
+ state: present
+ when: install_mode == inst_mode_baremetal
+
+- name: Create rabbitmq file for supervisor
+ template:
+ src: rabbitmq.sh.j2
+ dest: /etc/yardstick/rabbitmq.sh
+ mode: 0755
+ when: install_mode == inst_mode_container
--- /dev/null
+#!/bin/bash\r
+trap "rabbitmqctl stop_app" EXIT\r
+\r
+rabbitmqctl stop_app\r
+service rabbitmq-server restart\r
+rabbitmqctl start_app\r
+\r
+tmp_file="/tmp/$(basename -- $0).configured"\r
+if [ ! -f "$tmp_file" ]; then\r
+ rabbitmqctl add_user yardstick yardstick\r
+ rabbitmqctl set_permissions -p / yardstick '.*' '.*' '.*'\r
+ touch "$tmp_file"\r
+fi\r
+\r
+while :\r
+do\r
+ sleep 5\r
+ service rabbitmq-server status > /dev/null 2>&1 || exit 1\r
+ rabbitmqctl report | grep "Status of node rabbit@`hostname`" > /dev/null 2>&1 || exit 1\r
+done\r
# nginx service start when boot
supervisor_config='/etc/supervisor/conf.d/yardstick.conf'
-rabbitmq_config='/etc/supervisor/conf.d/rabbitmq.conf'
if [[ ! -e "${supervisor_config}" ]]; then
[program:yardstick_uwsgi]
directory = /etc/yardstick
command = uwsgi -i yardstick.ini
-EOF
-
-fi
-
-if [[ ! -e "${rabbitmq_config}" ]]; then
- cat << EOF > "${rabbitmq_config}"
[program:rabbitmq]
-command = /bin/bash -c "service rabbitmq-server restart
- rabbitmqctl start_app
- rabbitmqctl add_user yardstick yardstick
- rabbitmqctl set_permissions -p / yardstick '.*' '.*'"
+command=/etc/yardstick/rabbitmq.sh
EOF
fi