Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I25f96652ccfc2865c14a1a97c1eb7676d803aa88 Partial-Bug: #1743610
- Loading branch information
Showing
5 changed files
with
184 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
playbooks/roles/create_containers/tasks/create_vrouter_dpdk.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
- name: create /etc/contrail/vrouter | ||
file: | ||
path: /etc/contrail/vrouter | ||
state: directory | ||
recurse: yes | ||
|
||
- name: "get /etc/contrail/common_vrouter.env stat" | ||
stat: | ||
path: "/etc/contrail/common_vrouter.env" | ||
register: st | ||
|
||
- name: "delete /etc/contrail/common_vrouter.env if exists" | ||
file: | ||
path: "/etc/contrail/common_vrouter.env" | ||
state: absent | ||
when: st.stat.exists is defined and st.stat.exists | ||
|
||
- name: "create /etc/contrail/common_vrouter.env" | ||
file: | ||
path: "/etc/contrail/common_vrouter.env" | ||
state: touch | ||
|
||
- name: "populate cluster wide common_vrouter.env" | ||
lineinfile: dest=/etc/contrail/common_vrouter.env regexp='.*{{ item.key }}$' line="{{ item.key }}={{ item.value }}" state=present | ||
with_dict: "{{ contrail_configuration }}" | ||
|
||
- name: "populate pod specific common_vrouter.env" | ||
lineinfile: dest=/etc/contrail/common_vrouter.env regexp='.*{{ config_item.key }}$' line="{{ config_item.key }}={{ config_item.value }}" state=present | ||
with_dict: "{{ roles[inventory_hostname].vrouter_dpdk }}" | ||
loop_control: | ||
loop_var: config_item | ||
ignore_errors: yes | ||
|
||
- name: get pop | ||
set_fact: | ||
pop: "{{ roles[inventory_hostname].vrouter_dpdk.location }}" | ||
when: roles[inventory_hostname].vrouter_dpdk.location is defined | ||
|
||
- name: "populate pop settings" | ||
lineinfile: dest=/etc/contrail/common_vrouter.env regexp='.*{{ pop_config.key }}$' line="{{ pop_config.key }}={{ pop_config.value }}" state=present | ||
with_dict: "{{ remote_locations[pop] }}" | ||
loop_control: | ||
loop_var: pop_config | ||
when: pop is defined | ||
|
||
- name: calculate XMPP port if not assigned | ||
set_fact: | ||
xmpp_port: "{{ remote_locations[pop].CLUSTER_ID|int + 15268 }}" | ||
when: pop is defined and remote_locations[pop].XMPP_SERVER_PORT is undefined | ||
|
||
- name: set XMPP_SERVER_PORT port if assigned | ||
set_fact: | ||
xmpp_port: "{{ remote_locations[pop].XMPP_SERVER_PORT }}" | ||
when: pop is defined and remote_locations[pop].XMPP_SERVER_PORT is defined | ||
|
||
- name: "populate xmpp port" | ||
lineinfile: dest=/etc/contrail/common_vrouter.env regexp='.*XMPP_SERVER_PORT$' line="XMPP_SERVER_PORT={{ xmpp_port }}" state=present | ||
when: xmpp_port is defined | ||
|
||
- name: update image | ||
shell: "docker pull {{ container_registry }}/{{ item }}:{{ contrail_version_tag }}" | ||
with_items: | ||
- contrail-nodemgr | ||
- contrail-agent-vrouter-init-kernel-dpdk | ||
- contrail-agent-vrouter-dpdk | ||
- contrail-agent-net-watchdog | ||
- contrail-agent-vrouter | ||
when: UPDATE_IMAGES is undefined or UPDATE_IMAGES != false | ||
|
||
- name: "create contrail vrouter compose file" | ||
template: | ||
src: contrail-vrouter-dpdk.yaml.j2 | ||
dest: "/etc/contrail/vrouter/docker-compose.yaml" | ||
|
||
- name: "start contrail vrouter" | ||
docker_service: | ||
project_src: /etc/contrail/vrouter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
playbooks/roles/create_containers/templates/contrail-vrouter-dpdk.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
version: '2' | ||
services: | ||
nodemgr: | ||
image: "{{ container_registry }}/contrail-nodemgr:{{ contrail_version_tag }}" | ||
env_file: /etc/contrail/common_vrouter.env | ||
environment: | ||
- NODE_TYPE=vrouter | ||
network_mode: host | ||
volumes: | ||
- /var/log/contrail:/var/log/contrail | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- /etc/contrail/vrouter:/etc/contrail | ||
restart: on-failure | ||
vrouter-init-kernel-dpdk: | ||
image: "{{ container_registry }}/contrail-agent-vrouter-init-kernel-dpdk:{{ contrail_version_tag }}" | ||
env_file: /etc/contrail/common_vrouter.env | ||
environment: | ||
- AGENT_MODE=dpdk | ||
network_mode: host | ||
privileged: true | ||
pid: host | ||
volumes: | ||
- /dev:/dev | ||
- /lib/modules:/lib/modules | ||
- /var/run:/var/run | ||
- /var/log/contrail:/var/log/contrail | ||
- /etc/contrail/vrouter:/etc/contrail | ||
vrouter-agent-dpdk: | ||
image: "{{ container_registry }}/contrail-agent-vrouter-dpdk:{{ contrail_version_tag }}" | ||
env_file: /etc/contrail/common_vrouter.env | ||
environment: | ||
- AGENT_MODE=dpdk | ||
network_mode: host | ||
pid: host | ||
privileged: true | ||
volumes: | ||
- /dev:/dev | ||
- /lib/modules:/lib/modules | ||
- /var/run:/var/run | ||
- /var/log/contrail:/var/log/contrail | ||
- /etc/contrail/vrouter:/etc/contrail | ||
restart: on-failure | ||
depends_on: | ||
- vrouter-init-kernel-dpdk | ||
vrouter-agent-net-watchdog: | ||
image: "{{ container_registry }}/contrail-agent-net-watchdog:{{ contrail_version_tag }}" | ||
env_file: /etc/contrail/common_vrouter.env | ||
environment: | ||
- AGENT_MODE=dpdk | ||
network_mode: host | ||
privileged: true | ||
volumes: | ||
- /dev:/dev | ||
- /etc/sysconfig/network-scripts:/etc/sysconfig/network-scripts | ||
- /lib/modules:/lib/modules | ||
- /var/run:/var/run | ||
- /var/log/contrail:/var/log/contrail | ||
- /etc/contrail/vrouter:/etc/contrail | ||
restart: on-failure | ||
depends_on: | ||
- vrouter-agent-dpdk | ||
vrouter-agent: | ||
image: "{{ container_registry }}/contrail-agent-vrouter:{{ contrail_version_tag }}" | ||
env_file: /etc/contrail/common_vrouter.env | ||
environment: | ||
- AGENT_MODE=dpdk | ||
network_mode: host | ||
privileged: true | ||
volumes: | ||
- /dev:/dev | ||
- /lib/modules:/lib/modules | ||
- /var/run:/var/run | ||
- /var/log/contrail:/var/log/contrail | ||
- /etc/contrail/vrouter:/etc/contrail | ||
restart: on-failure | ||
depends_on: | ||
- vrouter-agent-net-watchdog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters