add plugins template 89/36489/11
authorchigang <chigang@huawei.com>
Sat, 24 Jun 2017 06:13:53 +0000 (14:13 +0800)
committerJustin chi <chigang@huawei.com>
Tue, 4 Jul 2017 07:51:04 +0000 (07:51 +0000)
JIRA: -

add a plugin template for compass4nfv

Change-Id: Iec767a7fab43617633238f9c5e326896dd6ce82e
Signed-off-by: chigang <chigang@huawei.com>
plugins/ntp/handlers/main.yml [new file with mode: 0644]
plugins/ntp/plugins.desc [new file with mode: 0644]
plugins/ntp/tasks/main.yml [new file with mode: 0644]
plugins/ntp/templates/ntp.conf.j2 [new file with mode: 0644]
plugins/ntp/vars/main.yml [new file with mode: 0644]
plugins/odl/plugins.desc [new file with mode: 0644]
plugins/template/openstack-ansible.inventory [new file with mode: 0644]
plugins/template/plugins.desc [new file with mode: 0644]

diff --git a/plugins/ntp/handlers/main.yml b/plugins/ntp/handlers/main.yml
new file mode 100644 (file)
index 0000000..866f31c
--- /dev/null
@@ -0,0 +1,13 @@
+##############################################################################
+# Copyright (c) 2016-2017 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 ntp service
+  service:
+    name: ntp
+    state: restarted
diff --git a/plugins/ntp/plugins.desc b/plugins/ntp/plugins.desc
new file mode 100644 (file)
index 0000000..3566676
--- /dev/null
@@ -0,0 +1,58 @@
+# This is an example for add a plugin into Compass4nfv
+# It illustrates how feature components can be integrated into Compass4nfv
+# together with scenarios.
+#
+#
+# More details can be found in the development document.
+# ##############################################################
+---
+plugin:
+  # plugin name,it is also as the switch to enable/disable plugin in scenario
+  # files
+  name: ntp
+
+  description: network time protocol
+
+  maintainers:
+    - huangxiangyu5@huawei.com
+
+  # host os type: ubuntu/centos
+  os_version: ubuntu
+
+  # true: this plugin is deployed separately on a new node
+  # false: this plugin is deployed on controller or compute node
+  independent_hosts: false
+
+  # artifact: packege download url for this plugin
+  artifacts:
+    url: http://archive.ubuntu.com/ubuntu/pool/main/n/ntp/ntp_4.2.8p4+dfsg-3ubuntu5.4_amd64.deb
+
+  # global_vars:
+  # define the parameters required by the plugin
+  # and its value will be defined and passed by compass4nfv
+  global_vars:
+    - ntp_server: "0.ubuntu.pool.ntp.org"
+
+  # orchestration
+  # A plugin can have mutiple components, each component may need to be
+  # installed on different inventory or have its own configuration.
+  # due to Compass4nfv currently only supports ansible, so each component
+  # of the installation and configuration script need to be use ansible.
+  # cm : congfiguration management tool : only ansible support
+  # role: each component corresponds to ansible script that locates in the same
+  # directory as plugin.desc.
+  # phrase: pre_openstack -- the component is installed after the OS
+  # provisioning, before the OpenStack deployment.
+  # phrase: post_openstack -- the component is installed before the OpenStack
+  # deployment.
+  # inventory: if the phrase is pre_openstack, inventory can be controller and
+  # compute. if the phrase is post_openstack, inventory can be get from the file
+  # openstack-ansible.inventory
+  orchestration:
+    cm: ansible
+    roles:
+      - role: install ntp
+        phrase: pre_openstack
+        inventory:
+          - controller
+          - compute
diff --git a/plugins/ntp/tasks/main.yml b/plugins/ntp/tasks/main.yml
new file mode 100644 (file)
index 0000000..031fb36
--- /dev/null
@@ -0,0 +1,32 @@
+##############################################################################
+# Copyright (c) 2016-2017 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: download packages
+  get_url:
+    url: "{{ ntp_url }}"
+    dest: "{{ workspace }}"
+
+- name: install dependent packages
+  apt:
+    name: "{{ item }}"
+    state: present
+  with_items:
+    - "{{ dependancy }}"
+
+- name: install ntp package
+  command: dpkg -i "{{ workspace }}/{{ ntp_pkg }}"
+
+- name: config ntp
+  template:
+    src: ntp.con.j2
+    dest: /etc/ntp.conf
+  notify:
+    - restart ntp service
+
+- meta: flush_handlers
diff --git a/plugins/ntp/templates/ntp.conf.j2 b/plugins/ntp/templates/ntp.conf.j2
new file mode 100644 (file)
index 0000000..697e407
--- /dev/null
@@ -0,0 +1,21 @@
+driftfile /var/lib/ntp/ntp.drift
+
+statistics loopstats peerstats clockstats
+filegen loopstats file loopstats type day enable
+filegen peerstats file peerstats type day enable
+filegen clockstats file clockstats type day enable
+
+pool 0.ubuntu.pool.ntp.org iburst
+pool 1.ubuntu.pool.ntp.org iburst
+pool 2.ubuntu.pool.ntp.org iburst
+pool 3.ubuntu.pool.ntp.org iburst
+
+pool "{{ ntp_server }}"
+
+restrict -4 default kod notrap nomodify nopeer noquery limited
+restrict -6 default kod notrap nomodify nopeer noquery limited
+
+restrict 127.0.0.1
+restrict ::1
+
+restrict source notrap nomodify noquery
diff --git a/plugins/ntp/vars/main.yml b/plugins/ntp/vars/main.yml
new file mode 100644 (file)
index 0000000..708fa42
--- /dev/null
@@ -0,0 +1,17 @@
+##############################################################################
+# Copyright (c) 2016-2017 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
+##############################################################################
+---
+workspace: /tmp/plugin
+
+ntp_url: http://archive.ubuntu.com/ubuntu/pool/main/n/ntp/ntp_4.2.8p4+dfsg-3ubuntu5.4_amd64.deb
+
+ntp_pkg: ntp_4.2.8p4+dfsg-3ubuntu5.4_amd64.deb
+
+dependancy:
+  - libopts25
diff --git a/plugins/odl/plugins.desc b/plugins/odl/plugins.desc
new file mode 100644 (file)
index 0000000..04e78f9
--- /dev/null
@@ -0,0 +1,58 @@
+# ##############################################################
+# This is an example for add a plugin into Compass4nfv
+# It illustrates how feature components can be integrated into Compass4nfv
+# together with scenarios.
+#
+#
+# More details can be found in the development document.
+# ##############################################################
+---
+plugin:
+  # plugin name,it is also as the switch to enable/disable plugin in scenario
+  # files
+  name: opendaylight
+
+  description: plugin introduce and description
+  maintainers:
+    - xueyifei@huawei.com
+
+  # true: this plugin is deployed separately on a new node
+  # false: this plugin is deployed on controller or compute node
+  independent_hosts: false
+
+  # artifact: packege download url for this plugin
+  artifacts:
+    url:
+
+  # global_vars:
+  # define the parameters required by the plugin
+  # and its value will be defined and passed by compass4nfv
+  global_vars:
+    - xxx: yyy
+    - ntp_server: "pool.ntp.org"
+
+  # orchestration
+  # A plugin can have mutiple components, each component may need to be
+  # installed on different inventory or have its own configuration.
+  # due to Compass4nfv currently only supports ansible, so each component
+  # of the installation and configuration script need to be use ansible.
+  # cm : congfiguration management tool : only ansible support
+  # role: each component corresponds to ansible script that locates in the same
+  # directory as plugin.desc.
+  # phrase: pre_openstack -- the component is installed after the OS
+  # provisioning, before the OpenStack deployment.
+  # phrase: post_openstack -- the component is installed before the OpenStack
+  # deployment.
+  # inventory: if the phrase is pre_openstack, inventory can be controller and
+  # compute. if the phrase is post_openstack, inventory can be get from the file
+  # openstack-ansible.inventory
+  orchestration:
+    cm: ansible
+    roles:
+      - role: opendaylight
+        phrase: post_openstack
+        inventory:
+          - neutron_all
+          - galera_container
+          - network_hosts
+          - repo_container
diff --git a/plugins/template/openstack-ansible.inventory b/plugins/template/openstack-ansible.inventory
new file mode 100644 (file)
index 0000000..37a4b8e
--- /dev/null
@@ -0,0 +1,253 @@
+# ##############################################################
+# This is OpenStack-ansible inventory list
+# It is generated in runtime and located in "compass-tasks"
+# container, the directory is:
+# /etc/openstack_deploy/openstack_inventory.json
+#
+# The openstack_inventory.json includes hosts and lxc detailed
+# information.
+# ##############################################################
+---
+aodh_alarm_evaluator
+aodh_alarm_notifier
+aodh_all
+aodh_api
+aodh_container
+aodh_listener
+barbican_all
+barbican_api
+barbican_container
+ceilometer_agent_central
+ceilometer_agent_compute
+ceilometer_agent_notification
+ceilometer_all
+ceilometer_api
+ceilometer_api_container
+ceilometer_collector
+ceilometer_collector_container
+ceph-mon
+ceph-mon_container
+ceph-mon_containers
+ceph-mon_hosts
+ceph-osd
+ceph-osd_container
+ceph-osd_containers
+ceph-osd_hosts
+ceph_all
+cinder_all
+cinder_api
+cinder_api_container
+cinder_backup
+cinder_scheduler
+cinder_scheduler_container
+cinder_volume
+cinder_volumes_container
+compute-infra_all
+compute-infra_containers
+compute-infra_hosts
+compute_all
+compute_containers
+compute_hosts
+dashboard_all
+dashboard_containers
+dashboard_hosts
+database_containers
+database_hosts
+designate_all
+designate_api
+designate_central
+designate_container
+designate_mdns
+designate_producer
+designate_sink
+designate_worker
+dnsaas_containers
+dnsaas_hosts
+galera
+galera_all
+galera_container
+glance_all
+glance_api
+glance_container
+glance_registry
+gnocchi_all
+gnocchi_api
+gnocchi_container
+gnocchi_metricd
+haproxy
+haproxy_all
+haproxy_container
+haproxy_containers
+haproxy_hosts
+heat_all
+heat_api
+heat_api_cfn
+heat_api_cloudwatch
+heat_apis_container
+heat_engine
+heat_engine_container
+horizon
+horizon_all
+horizon_container
+host1-host_containers
+host2-host_containers
+host3-host_containers
+hosts
+identity_all
+identity_containers
+identity_hosts
+image_all
+image_containers
+image_hosts
+ironic-compute_containers
+ironic-compute_hosts
+ironic-infra_containers
+ironic-infra_hosts
+ironic-server_containers
+ironic-server_hosts
+ironic_all
+ironic_api
+ironic_api_container
+ironic_compute
+ironic_compute_container
+ironic_conductor
+ironic_conductor_container
+ironic_server
+ironic_server_container
+ironic_servers
+key-manager_containers
+key-manager_hosts
+keystone
+keystone_all
+keystone_container
+log_containers
+log_hosts
+lxc_hosts
+magnum
+magnum-infra_containers
+magnum-infra_hosts
+magnum_all
+magnum_container
+memcached
+memcached_all
+memcached_container
+memcaching_containers
+memcaching_hosts
+metering-alarm_all
+metering-alarm_containers
+metering-alarm_hosts
+metering-compute_all
+metering-compute_container
+metering-compute_containers
+metering-compute_hosts
+metering-infra_all
+metering-infra_containers
+metering-infra_hosts
+metrics_all
+metrics_containers
+metrics_hosts
+mq_containers
+mq_hosts
+network_all
+network_containers
+network_hosts
+neutron_agent
+neutron_agents_container
+neutron_all
+neutron_bgp_dragent
+neutron_dhcp_agent
+neutron_l3_agent
+neutron_lbaas_agent
+neutron_linuxbridge_agent
+neutron_metadata_agent
+neutron_metering_agent
+neutron_openvswitch_agent
+neutron_server
+neutron_server_container
+neutron_sriov_nic_agent
+nova_all
+nova_api_metadata
+nova_api_metadata_container
+nova_api_os_compute
+nova_api_os_compute_container
+nova_api_placement
+nova_api_placement_container
+nova_compute
+nova_compute_container
+nova_conductor
+nova_conductor_container
+nova_console
+nova_console_container
+nova_scheduler
+nova_scheduler_container
+operator_containers
+operator_hosts
+orchestration_all
+orchestration_containers
+orchestration_hosts
+os-infra_containers
+os-infra_hosts
+pkg_repo
+rabbit_mq_container
+rabbitmq
+rabbitmq_all
+remote
+remote_containers
+repo-infra_all
+repo-infra_containers
+repo-infra_hosts
+repo_all
+repo_container
+rsyslog
+rsyslog_all
+rsyslog_container
+sahara-infra_containers
+sahara-infra_hosts
+sahara_all
+sahara_api
+sahara_container
+sahara_engine
+shared-infra_all
+shared-infra_containers
+shared-infra_hosts
+storage-infra_all
+storage-infra_containers
+storage-infra_hosts
+storage_all
+storage_containers
+storage_hosts
+swift-proxy_containers
+swift-proxy_hosts
+swift-remote_containers
+swift-remote_hosts
+swift_acc
+swift_acc_container
+swift_all
+swift_cont
+swift_cont_container
+swift_containers
+swift_hosts
+swift_obj
+swift_obj_container
+swift_proxy
+swift_proxy_container
+swift_remote
+swift_remote_all
+swift_remote_container
+trove-infra_containers
+trove-infra_hosts
+trove_all
+trove_api
+trove_api_container
+trove_conductor
+trove_conductor_container
+trove_taskmanager
+trove_taskmanager_container
+unbound
+unbound_all
+unbound_container
+unbound_containers
+unbound_hosts
+utility
+utility_all
+utility_container
diff --git a/plugins/template/plugins.desc b/plugins/template/plugins.desc
new file mode 100644 (file)
index 0000000..a7b93f6
--- /dev/null
@@ -0,0 +1,59 @@
+# ##############################################################
+# This is an example for add a plugin into Compass4nfv
+# It illustrates how feature components can be integrated into Compass4nfv
+# together with scenarios.
+#
+#
+# More details can be found in the development document.
+# ##############################################################
+---
+plugin:
+  # plugin name,it is also as the switch to enable/disable plugin in scenario
+  # files
+  name: plugin_p1
+
+  description: plugin introduce and description
+  maintainers:
+    - name@company.com
+
+  # true: this plugin is deployed separately on a new node
+  # false: this plugin is deployed on controller or compute node
+  independent_hosts: false
+
+  # artifact: packege download url for this plugin
+  artifacts:
+    url:
+
+  # global_vars:
+  # define the parameters required by the plugin
+  # and its value will be defined and passed by compass4nfv
+  global_vars:
+    - xxx: yyy
+    - ntp_server: "pool.ntp.org"
+
+  # orchestration
+  # A plugin can have mutiple components, each component may need to be
+  # installed on different inventory or have its own configuration.
+  # due to Compass4nfv currently only supports ansible, so each component
+  # of the installation and configuration script need to be use ansible.
+  # cm : congfiguration management tool : only ansible support
+  # role: each component corresponds to ansible script that locates in the same
+  # directory as plugin.desc.
+  # phrase: pre_openstack -- the component is installed after the OS
+  # provisioning, before the OpenStack deployment.
+  # phrase: post_openstack -- the component is installed before the OpenStack
+  # deployment.
+  # inventory: if the phrase is pre_openstack, inventory can be controller and
+  # compute. if the phrase is post_openstack, inventory can be get from the file
+  # openstack-ansible.inventory
+  orchestration:
+    cm: ansible
+    roles:
+      - role: add_interface
+        phrase: pre_openstack
+        inventory:
+          - controller
+          - compute
+      - role: add_flavor
+        phrase: post_openstack
+        inventory: