Merge "Use ansible_service_mgr fact"
This commit is contained in:
commit
c39e415b5e
@ -13,20 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Detect whether the init system is upstart of systemd.
|
|
||||||
- name: Check init system
|
|
||||||
command: cat /proc/1/comm
|
|
||||||
changed_when: false
|
|
||||||
register: _pid1_name
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Set the name of pid1
|
|
||||||
set_fact:
|
|
||||||
pid1_name: "{{ _pid1_name.stdout }}"
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Gather variables for each operating system
|
- name: Gather variables for each operating system
|
||||||
include_vars: "{{ item }}"
|
include_vars: "{{ item }}"
|
||||||
with_first_found:
|
with_first_found:
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
when:
|
when:
|
||||||
- pid1_name == "systemd"
|
- ansible_service_mgr == 'systemd'
|
||||||
notify:
|
notify:
|
||||||
- Reload systemd daemon
|
- Reload systemd daemon
|
||||||
|
|
||||||
@ -37,6 +37,6 @@
|
|||||||
src: "smt.conf"
|
src: "smt.conf"
|
||||||
dest: "/etc/init/smt.conf"
|
dest: "/etc/init/smt.conf"
|
||||||
when:
|
when:
|
||||||
- pid1_name != "systemd"
|
- ansible_service_mgr != 'systemd'
|
||||||
notify:
|
notify:
|
||||||
- Reload upstart init scripts
|
- Reload upstart init scripts
|
||||||
|
@ -14,10 +14,12 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- include: nova_init_upstart.yml
|
- include: nova_init_upstart.yml
|
||||||
when: pid1_name == "init"
|
when:
|
||||||
|
- ansible_service_mgr == 'upstart'
|
||||||
|
|
||||||
- include: nova_init_systemd.yml
|
- include: nova_init_systemd.yml
|
||||||
when: pid1_name == "systemd"
|
when:
|
||||||
|
- ansible_service_mgr == 'systemd'
|
||||||
|
|
||||||
- name: Load service
|
- name: Load service
|
||||||
service:
|
service:
|
||||||
|
Loading…
Reference in New Issue
Block a user