From 43dcf3ba2ed1a0f9254d533e091324eb9e1164dd Mon Sep 17 00:00:00 2001 From: "carey.xu" Date: Mon, 14 Mar 2016 11:26:02 +0800 Subject: disable service autostart when install packages on ubuntu JIRA: COMPASS-336 Change-Id: I36c4e53d8c43231890bf29e678c38e2a22b33788 Signed-off-by: carey.xu --- .../ansible/roles/ceilometer_compute/tasks/main.yml | 13 +++++++++++++ .../roles/ceilometer_controller/tasks/main.yml | 14 +++++++++++++- .../roles/cinder-controller/tasks/cinder_install.yml | 13 +++++++++++++ .../ansible/roles/cinder-volume/tasks/main.yml | 13 +++++++++++++ .../ansible/roles/memcached/handlers/main.yml | 12 ++++++++++++ .../adapters/ansible/roles/memcached/tasks/main.yml | 19 +++++++++++++++---- .../ansible/roles/neutron-compute/tasks/main.yml | 13 +++++++++++++ .../neutron-controller/tasks/neutron_install.yml | 13 +++++++++++++ .../ansible/roles/neutron-network/tasks/firewall.yml | 13 +++++++++++++ .../ansible/roles/neutron-network/tasks/main.yml | 13 +++++++++++++ .../ansible/roles/neutron-network/tasks/vpn.yml | 13 +++++++++++++ .../ansible/roles/nova-compute/tasks/main.yml | 13 +++++++++++++ .../roles/nova-controller/tasks/nova_install.yml | 13 +++++++++++++ 13 files changed, 170 insertions(+), 5 deletions(-) create mode 100644 deploy/adapters/ansible/roles/memcached/handlers/main.yml (limited to 'deploy/adapters') diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/tasks/main.yml b/deploy/adapters/ansible/roles/ceilometer_compute/tasks/main.yml index c6a9fb9c..864ea97a 100644 --- a/deploy/adapters/ansible/roles/ceilometer_compute/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ceilometer_compute/tasks/main.yml @@ -9,10 +9,23 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install ceilometer packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: ceilometer_packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: copy ceilometer configs template: src={{ item.src}} dest=/opt/os_templates with_items: "{{ ceilometer_configs_templates }}" diff --git a/deploy/adapters/ansible/roles/ceilometer_controller/tasks/main.yml b/deploy/adapters/ansible/roles/ceilometer_controller/tasks/main.yml index 261e1ec4..6b1882cc 100644 --- a/deploy/adapters/ansible/roles/ceilometer_controller/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ceilometer_controller/tasks/main.yml @@ -9,15 +9,27 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install ceilometer packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: ceilometer_packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: copy ceilometer configs template: src={{ item.src}} dest=/opt/os_templates with_items: "{{ ceilometer_configs_templates }}" - - name: update ceilometer configs shell: crudini --merge {{ item.1 }} < /opt/os_templates/{{ item.0.src }} with_subelements: diff --git a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml index f4d4e055..d41094da 100644 --- a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml +++ b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml @@ -7,10 +7,23 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install cinder packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: generate common cinder service list lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml index 47336c76..f3f40c12 100644 --- a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml +++ b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml @@ -9,10 +9,23 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install cinder-volume and lvm2 packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: generate cinder volume service list lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) diff --git a/deploy/adapters/ansible/roles/memcached/handlers/main.yml b/deploy/adapters/ansible/roles/memcached/handlers/main.yml new file mode 100644 index 00000000..4c3230c1 --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/handlers/main.yml @@ -0,0 +1,12 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +- name: restart memcahed services + service: name={{ item }} state=restarted enabled=yes + with_items: services| union(services_noarch) diff --git a/deploy/adapters/ansible/roles/memcached/tasks/main.yml b/deploy/adapters/ansible/roles/memcached/tasks/main.yml index 732076ae..99ee6e87 100644 --- a/deploy/adapters/ansible/roles/memcached/tasks/main.yml +++ b/deploy/adapters/ansible/roles/memcached/tasks/main.yml @@ -9,16 +9,27 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" with_items: packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: change memcache listen ip lineinfile: dest=/etc/memcached.conf regexp="^-l " line="-l 0.0.0.0" when: ansible_os_family == "Debian" - -- name: restart services - service: name={{ item }} state=restarted enabled=yes - with_items: services| union(services_noarch) + notify: + - restart memcahed services - meta: flush_handlers diff --git a/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml index 9020ccae..3e4b24bc 100644 --- a/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml +++ b/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml @@ -21,10 +21,23 @@ sysctl: name=net.ipv4.conf.default.rp_filter value=0 state=present reload=yes +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install compute-related neutron packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: fix openstack neutron plugin config file shell: | sed -i 's,plugins/ml2/openvswitch_agent.ini,plugin.ini,g' /usr/lib/systemd/system/neutron-openvswitch-agent.service diff --git a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml index 600fe157..be64c41c 100644 --- a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml +++ b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml @@ -9,10 +9,23 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install controller-related neutron packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: generate neutron control service list lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/firewall.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/firewall.yml index c0246663..aec714f3 100755 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/firewall.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/firewall.yml @@ -9,9 +9,22 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install firewall packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: firewall_packages +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: update firewall related conf shell: crudini --set --list /etc/neutron/neutron.conf DEFAULT service_plugins firewall diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml index 924a02e5..9b41ac18 100644 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml @@ -31,10 +31,23 @@ failed_when: iproute_out.rc == 255 when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }}" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install neutron network related packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: generate neutron network service list lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/vpn.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/vpn.yml index 896b4358..9722ab7c 100755 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/vpn.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/vpn.yml @@ -9,10 +9,23 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install vpn packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: vpn_packages +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: update vpn related conf shell: crudini --set /etc/neutron/l3_agent.ini vpnagent vpn_device_driver neutron_vpnaas.services.vpn.device_drivers.strongswan_ipsec.StrongSwanDriver; crudini --set --list /etc/neutron/neutron.conf DEFAULT service_plugins vpnaas diff --git a/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml b/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml index b29d828d..7ee60baa 100644 --- a/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml +++ b/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml @@ -9,10 +9,23 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install nova-compute related packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: update nova-compute conf template: src=templates/{{ item }} dest=/etc/nova/{{ item }} with_items: diff --git a/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml b/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml index 5160c5e1..865ad2e5 100644 --- a/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml +++ b/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml @@ -9,10 +9,23 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + - name: install nova related packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + - name: generate nova control service list lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) -- cgit 1.2.3-korg