diff --git a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml index d37f4bb4e..5b8cb6e1f 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml @@ -35,7 +35,7 @@ # NOTE(sean-k-mooney) only the RabbitMQ server and MySQL db are started # during bootstrapping. all other services are started in the Start phase. - name: "Start database service" - service: name={{ mysql_service_name }} state=started + service: name={{ mysql_service_name }} state=started enabled=yes - name: "RabbitMQ - Testing if hostname is defined in /etc/hosts" command: grep -i "{{ ansible_hostname }}" /etc/hosts ignore_errors: yes @@ -56,7 +56,7 @@ - epmd when: ansible_os_family == 'Suse' - name: "Start rabbitmq-server" - service: name=rabbitmq-server state=started + service: name=rabbitmq-server state=started enabled=yes # NOTE(cinerama): on some systems, rabbit may not be ready when we want to # make changes to users if we don't wait first - name: "Wait for rabbitmq" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/inspector_start.yml b/playbooks/roles/bifrost-ironic-install/tasks/inspector_start.yml index 38d57c956..7518b3280 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/inspector_start.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/inspector_start.yml @@ -17,3 +17,4 @@ service: name=ironic-inspector state=restarted + enabled=yes diff --git a/playbooks/roles/bifrost-ironic-install/tasks/start.yml b/playbooks/roles/bifrost-ironic-install/tasks/start.yml index b868d4231..4a6f32990 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/start.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/start.yml @@ -22,20 +22,20 @@ when: remote_syslog_server is defined and remote_syslog_server != "" - name: "Start database service" - service: name={{ mysql_service_name }} state=started + service: name={{ mysql_service_name }} state=started enabled=yes - name: "Start rabbitmq-server" - service: name=rabbitmq-server state=started + service: name=rabbitmq-server state=started enabled=yes - name: "start ironic-inspector" include: inspector_start.yml when: enable_inspector | bool == true - name: "Start ironic-conductor" - service: name=ironic-conductor state=started + service: name=ironic-conductor state=started enabled=yes - name: "Start ironic-api" - service: name=ironic-api state=started + service: name=ironic-api state=started enabled=yes - name: "Start ironic-conductor" service: name=ironic-conductor state=restarted @@ -51,13 +51,13 @@ when: "{{ testing | bool == true and include_dhcp_server | bool == true }}" - name: "Ensure services are running with current config" - service: name={{ item }} state=restarted + service: name={{ item }} state=restarted enabled=yes with_items: - xinetd - nginx - name: "Ensure dnsmasq is running with current config" - service: name={{ item }} state=restarted + service: name={{ item }} state=restarted enabled=yes with_items: - dnsmasq when: "{{ include_dhcp_server | bool == true }}" diff --git a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml index b7a24d825..b89f9ee5b 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml @@ -31,10 +31,10 @@ # NOTE(sean-k-mooney) only the RabbitMQ server and MySQL db are started # during bootstrapping. all other services are started in the Start phase. - name: "Start database service" - service: name={{ mysql_service_name }} state=started + service: name={{ mysql_service_name }} state=started enabled=yes - name: "Start rabbitmq-server" - service: name=rabbitmq-server state=started + service: name=rabbitmq-server state=started enabled=yes # NOTE(cinerama): on some systems, rabbit may not be ready when we want to # make changes to users if we don't wait first @@ -208,14 +208,6 @@ group: "{{ nginx_user }}" # TODO(TheJulia): Split webserver user/group. mode: 0755 -- name: "Ensure /run/uwsgi exists" - file: - name: "/run/uwsgi" - state: directory - owner: "{{ nginx_user }}" - group: "{{ nginx_user }}" # TODO(TheJulia): Split webserver user/group. - mode: 0775 - - name: "Place keystone public uwsgi config" template: src: keystone-public.ini.j2 @@ -271,4 +263,13 @@ owner: "root" group: "root" with_items: - - { service_path: "{{ uwsgi_install_prefix.stdout | default('') }}", service_name: 'uwsgi', username: "{{nginx_user}}", args: '--master --emperor /etc/uwsgi/apps-enabled'} + - { service_path: "{{ uwsgi_install_prefix.stdout | default('') }}", + service_name: 'uwsgi', + username: "{{ nginx_user }}", + exec_start_pre: "/usr/bin/install -m 755 -o {{ nginx_user }} -g {{ nginx_user }} -d /run/uwsgi", + args: '--master --emperor /etc/uwsgi/apps-enabled'} + +# NOTE(ashestakov) https://github.com/ansible/ansible-modules-core/issues/3764 +- name: "Remove uwsgi sysvinit init script" + command: update-rc.d -f uwsgi remove + ignore_errors: yes diff --git a/playbooks/roles/bifrost-keystone-install/tasks/start.yml b/playbooks/roles/bifrost-keystone-install/tasks/start.yml index cddcca11a..3d712d196 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/start.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/start.yml @@ -15,18 +15,8 @@ command: systemctl daemon-reload when: init_template == 'systemd_template.j2' -- name: "Ensure required services are started" - service: name={{ item }} state=started +- name: "Ensure services are running with current config" + service: name={{ item }} state=restarted enabled=yes with_items: - nginx - uwsgi - -# In the event that this server was already running, -# we need to HUP the service to help ensure that it -# has the latest configuration. We do this because we -# cannot trust what service returns as each init system -# behaves differently. -- name: "Send services a reload signal" - service: name={{ item }} state=reloaded - with_items: - - nginx diff --git a/playbooks/roles/bifrost-keystone-install/templates/systemd_template.j2 b/playbooks/roles/bifrost-keystone-install/templates/systemd_template.j2 index 1b5a384f3..7b134370e 100644 --- a/playbooks/roles/bifrost-keystone-install/templates/systemd_template.j2 +++ b/playbooks/roles/bifrost-keystone-install/templates/systemd_template.j2 @@ -2,6 +2,11 @@ Description={{ item.service_name }} service [Service] +Restart=on-failure +PermissionsStartOnly=true +{% if item.exec_start_pre %} +ExecStartPre={{ item.exec_start_pre }} +{% endif %} ExecStart={{ item.service_path }}/{{ item.service_name }} {{ item.args }} User={{ item.username }}