aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTin Lam <tinlam@gmail.com>2016-08-21 01:01:04 -0500
committerTin Lam <tinlam@gmail.com>2016-09-14 10:12:08 -0500
commit4b3d8116ce1e4e848af6d8c229765528996772bb (patch)
treeb6bb809c5e05066fd0d028468b8c9c23ab025212
parentd3302a7e695dcb9f8f5c991a1722621a418b81b3 (diff)
downloadkolla-4b3d8116ce1e4e848af6d8c229765528996772bb.tar.gz
kolla-4b3d8116ce1e4e848af6d8c229765528996772bb.zip
Add ansible role for vmtp container
Add vmtp ansible role to kolla. Co-Authored-By: Larry Rensing <lr699s@att.com> Co-Authored-By: Tin Lam <tinlam@gmail.com> Partially implements: bp vmtp-container Change-Id: Ib3945e0a94cca9f3a8c4f55953b40674c88ac8e4
-rw-r--r--ansible/group_vars/all.yml1
-rw-r--r--ansible/inventory/all-in-one3
-rw-r--r--ansible/inventory/multinode3
-rw-r--r--ansible/roles/vmtp/defaults/main.yml25
-rw-r--r--ansible/roles/vmtp/meta/main.yml3
-rw-r--r--ansible/roles/vmtp/tasks/config.yml26
-rw-r--r--ansible/roles/vmtp/tasks/deploy.yml6
-rw-r--r--ansible/roles/vmtp/tasks/do_reconfigure.yml58
-rw-r--r--ansible/roles/vmtp/tasks/main.yml2
-rw-r--r--ansible/roles/vmtp/tasks/pull.yml7
-rw-r--r--ansible/roles/vmtp/tasks/reconfigure.yml4
-rw-r--r--ansible/roles/vmtp/tasks/start.yml11
-rw-r--r--ansible/roles/vmtp/tasks/upgrade.yml4
-rw-r--r--ansible/roles/vmtp/templates/cfg.default.yaml.j241
-rw-r--r--ansible/site.yml7
15 files changed, 201 insertions, 0 deletions
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index 1b9dff1b8..907cea6ab 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -264,6 +264,7 @@ enable_sahara: "no"
enable_senlin: "no"
enable_swift: "no"
enable_tempest: "no"
+enable_vmtp: "no"
enable_watcher: "no"
ironic_keystone_user: "ironic"
diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one
index a1dcf2f8b..fb164de18 100644
--- a/ansible/inventory/all-in-one
+++ b/ansible/inventory/all-in-one
@@ -120,6 +120,9 @@ control
[senlin:children]
control
+[vmtp:children]
+control
+
[watcher:children]
control
diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode
index be0dc85dc..08160ef66 100644
--- a/ansible/inventory/multinode
+++ b/ansible/inventory/multinode
@@ -138,6 +138,9 @@ control
[senlin:children]
control
+[vmtp:children]
+control
+
[watcher:children]
control
diff --git a/ansible/roles/vmtp/defaults/main.yml b/ansible/roles/vmtp/defaults/main.yml
new file mode 100644
index 000000000..1899d8be0
--- /dev/null
+++ b/ansible/roles/vmtp/defaults/main.yml
@@ -0,0 +1,25 @@
+---
+project_name: "vmtp"
+
+####################
+# Docker
+####################
+vmtp_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-vmtp"
+vmtp_tag: "{{ openstack_release }}"
+vmtp_image_full: "{{ vmtp_image }}:{{ vmtp_tag }}"
+
+#########################
+# VMTP Specific resources
+#########################
+vmtp_vm_image_name: "Ubuntu Server 16.04"
+vmtp_vm_ssh_username: "ubuntu"
+vmtp_vm_flavor_type: "m1.small"
+vmtp_vm_nameservers: ['8.8.8.8', '8.8.4.4']
+vmtp_vm_image_url: "https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img"
+vmtp_internal_network_name: ['vmtp-demo-net']
+vmtp_internal_subnet_name: ['vmtp-demo-subnet']
+vmtp_internal_subnet_name_ipv6: ['vmtp-demo-v6-subnet']
+vmtp_internal_cidr: ['10.0.0.0/24']
+vmtp_internal_cidr_v6: ['2001:45::/64']
+vmtp_router_name: "pns-router"
+vmtp_os_dp_network: "physnet1"
diff --git a/ansible/roles/vmtp/meta/main.yml b/ansible/roles/vmtp/meta/main.yml
new file mode 100644
index 000000000..6b4fff8fe
--- /dev/null
+++ b/ansible/roles/vmtp/meta/main.yml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - { role: common }
diff --git a/ansible/roles/vmtp/tasks/config.yml b/ansible/roles/vmtp/tasks/config.yml
new file mode 100644
index 000000000..c63c93e80
--- /dev/null
+++ b/ansible/roles/vmtp/tasks/config.yml
@@ -0,0 +1,26 @@
+---
+- name: Ensuring config directories exist
+ file:
+ path: "{{ node_config_directory }}/vmtp"
+ state: "directory"
+ recurse: yes
+
+- name: Register binary python path
+ command: echo /usr/lib/python2.7/site-packages
+ register: python_path
+ when: kolla_install_type == 'binary'
+
+- name: Register source python path
+ command: echo /var/lib/kolla/venv/lib/python2.7/site-packages
+ register: python_path
+ when: kolla_install_type != 'binary'
+
+- name: Copying over configuration file for vmtp
+ merge_yaml:
+ sources:
+ - "{{ role_path }}/templates/{{ item }}.j2"
+ - "{{ node_custom_config }}/{{ item }}"
+ - "{{ node_custom_config }}/vmtp/{{ item }}"
+ dest: "{{ python_path }}/vmtp/{{ item }}"
+ with_items:
+ - "cfg.default.yaml"
diff --git a/ansible/roles/vmtp/tasks/deploy.yml b/ansible/roles/vmtp/tasks/deploy.yml
new file mode 100644
index 000000000..d4daf108c
--- /dev/null
+++ b/ansible/roles/vmtp/tasks/deploy.yml
@@ -0,0 +1,6 @@
+---
+- include: config.yml
+ when: inventory_hostname in groups['vmtp']
+
+- include: start.yml
+ when: inventory_hostname in groups['vmtp']
diff --git a/ansible/roles/vmtp/tasks/do_reconfigure.yml b/ansible/roles/vmtp/tasks/do_reconfigure.yml
new file mode 100644
index 000000000..3cf5f2940
--- /dev/null
+++ b/ansible/roles/vmtp/tasks/do_reconfigure.yml
@@ -0,0 +1,58 @@
+---
+- name: Ensure container is up
+ kolla_docker:
+ name: "vmtp"
+ action: "get_container_state"
+ register: container_state
+ failed_when: container_state.Running == false
+ when: inventory_hostname in groups['vmtp']
+
+- include: config.yml
+
+- name: Check configuration
+ command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
+ changed_when: false
+ failed_when: false
+ register: check_results
+ when: inventory_hostname in groups['vmtp']
+ with_items:
+ - { name: vmtp, group: vmtp }
+
+# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS'
+# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE',
+# just remove the container and start again
+- name: Containers config strategy
+ kolla_docker:
+ name: "vmtp"
+ action: "get_container_env"
+ register: container_envs
+ when: inventory_hostname in groups['vmtp']
+
+- name: Remove the containers
+ kolla_docker:
+ name: "vmtp"
+ action: "remove_container"
+ register: remove_containers
+ when:
+ - config_strategy == "COPY_ONCE" or item[0]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
+ - item[1]['rc'] == 1
+ - inventory_hostname in groups['vmtp']
+ with_together:
+ - "{{ container_envs.results }}"
+ - "{{ check_results.results }}"
+
+- include: start.yml
+ when: remove_containers.changed
+
+- name: Restart containers
+ kolla_docker:
+ name: "vmtp"
+ action: "restart_container"
+ when:
+ - config_strategy == 'COPY_ALWAYS'
+ - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
+ - item[1]['rc'] == 1
+ - inventory_hostname in groups['vmtp']
+ with_together:
+ - "{{ container_envs.results }}"
+ - "{{ check_results.results }}"
diff --git a/ansible/roles/vmtp/tasks/main.yml b/ansible/roles/vmtp/tasks/main.yml
new file mode 100644
index 000000000..bef222f6a
--- /dev/null
+++ b/ansible/roles/vmtp/tasks/main.yml
@@ -0,0 +1,2 @@
+---
+- include: "{{ action }}.yml" \ No newline at end of file
diff --git a/ansible/roles/vmtp/tasks/pull.yml b/ansible/roles/vmtp/tasks/pull.yml
new file mode 100644
index 000000000..0be3c5eec
--- /dev/null
+++ b/ansible/roles/vmtp/tasks/pull.yml
@@ -0,0 +1,7 @@
+---
+- name: Pulling vmtp image
+ kolla_docker:
+ action: "pull_image"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ vmtp_image_full }}"
+ when: inventory_hostname in groups['vmtp']
diff --git a/ansible/roles/vmtp/tasks/reconfigure.yml b/ansible/roles/vmtp/tasks/reconfigure.yml
new file mode 100644
index 000000000..559f7c954
--- /dev/null
+++ b/ansible/roles/vmtp/tasks/reconfigure.yml
@@ -0,0 +1,4 @@
+---
+- include: do_reconfigure.yml
+ serial: "30%"
+ when: inventory_hostname in groups['vmtp']
diff --git a/ansible/roles/vmtp/tasks/start.yml b/ansible/roles/vmtp/tasks/start.yml
new file mode 100644
index 000000000..c3a2b19b7
--- /dev/null
+++ b/ansible/roles/vmtp/tasks/start.yml
@@ -0,0 +1,11 @@
+---
+- name: Starting vmtp container
+ kolla_docker:
+ action: "start_container"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ vmtp_image_full }}"
+ name: "vmtp"
+ volumes:
+ - "{{ node_config_directory }}/vmtp/:{{ container_config_directory }}/:ro"
+ - "/etc/localtime:/etc/localtime:ro"
+ - "kolla_logs:/var/log/kolla"
diff --git a/ansible/roles/vmtp/tasks/upgrade.yml b/ansible/roles/vmtp/tasks/upgrade.yml
new file mode 100644
index 000000000..1f16915ad
--- /dev/null
+++ b/ansible/roles/vmtp/tasks/upgrade.yml
@@ -0,0 +1,4 @@
+---
+- include: config.yml
+
+- include: start.yml
diff --git a/ansible/roles/vmtp/templates/cfg.default.yaml.j2 b/ansible/roles/vmtp/templates/cfg.default.yaml.j2
new file mode 100644
index 000000000..991c86c69
--- /dev/null
+++ b/ansible/roles/vmtp/templates/cfg.default.yaml.j2
@@ -0,0 +1,41 @@
+image_name: {{ vmtp_vm_image_name }}
+ssh_vm_username: {{ vmtp_vm_ssh_username }}
+flavor_type: {{ vmtp_vm_flavor_type }}
+availability_zone: {{ vmtp_vm_availability_zone }}
+dns_nameservers: {{ vmtp_vm_nameservers }}
+vm_image_url: {{ vmtp_vm_image_url }}
+
+reuse_network_name:
+floating_ip: True
+reuse_existing_vm:
+config_drive:
+user_data_file:
+ipv6_mode:
+router_name: {{ vmtp_router_name }}
+
+internal_network_name: {{ vmtp_internal_network_name }}
+internal_subnet_name: {{ vmtp_internal_subnet_name }}
+internal_subnet_name_ipv6: {{ vmtp_internal_subnet_name_ipv6 }}
+internal_cidr: {{ vmtp_internal_cidr }}
+internal_cidr_v6: {{ vmtp_internal_cidr_v6 }}
+
+public_key_file:
+private_key_file:
+public_key_name: 'pns_public_key'
+vm_name_server: 'TestServer'
+vm_name_client: 'TestClient'
+security_group_name: 'pns-security'
+
+ping_count: 2
+ping_pass_threshold: 80
+ssh_retry_count: 50
+generic_retry_count: 50
+
+tcp_tp_loop_count: 3
+tcp_pkt_sizes: [65536]
+udp_pkt_sizes: [128, 1024, 8192]
+icmp_pkt_sizes: [64, 391, 1500]
+udp_loss_rate_range: [2, 5]
+
+vm_bandwidth: 0
+os_dataplane_network: {{ vmtp_os_dp_network }}
diff --git a/ansible/site.yml b/ansible/site.yml
index 67f1e2a32..a275f3d7a 100644
--- a/ansible/site.yml
+++ b/ansible/site.yml
@@ -326,6 +326,13 @@
when: enable_rally | bool }
- hosts:
+ - vmtp
+ roles:
+ - { role: vmtp,
+ tags: vmtp,
+ when: enable_vmtp | bool }
+
+- hosts:
- watcher-api
- watcher-engine
- watcher-applier