Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ovn bgp agent deployment #12

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
host_key_checking = False
stdout_callback = yaml
ansible_ssh_common_args='-o IdentitiesOnly=yes'

ansible_timeout = 3600
[ssh_connection]
ssh_args = -F ssh_config
8 changes: 7 additions & 1 deletion builder
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ fi
vmlist=""

if [ "$action" == "prepare" ]; then
inventory="kolla-inventory"
kolla_inventory=$(grep "inventory_name:" $user_variables | cut -d" " -f2 | sed 's/"//g')
if [ -z "${kolla_inventory}" ]; then
inventory="kolla-inventory"
else
inventory="${kolla_inventory}"
fi


elif [ "$action" == "delete" ]; then
vmlist="-e @vm_list.yml"
Expand Down
21 changes: 15 additions & 6 deletions delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
name: libvirt_network
tasks_from: delete.yml
vars:
libvirt_network_name: "{{ item }}"
with_items:
- "{{ network_ssh }}"
- "{{ network_openstack }}"
- "{{ network_neutron }}"
when: create_networks
libvirt_network_name: "{{ network_ssh }}"
when: destroy_network_ssh
- include_role:
name: libvirt_network
tasks_from: delete.yml
vars:
libvirt_network_name: "{{ network_openstack }}"
when: destroy_network_openstack
- include_role:
name: libvirt_network
tasks_from: delete.yml
vars:
libvirt_network_name: "{{ network_neutron }}"
when: destroy_network_neutron

28 changes: 22 additions & 6 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ ansible_args: >-
ansible_become=True
ansible_private_key_file={{ kolla_ssh_key }}
ansible_python_interpreter={{ kolla_python_interpereter }}

inventory_name: "kolla-inventory"
multinode_file_path: "{{ inventory_name }}"
aio_filepath: "{{ inventory_name }}"
node_vg: ubuntu-vg
node_lv: ubuntu-lv
globals_file: null
Expand All @@ -44,25 +46,39 @@ additional_uploads: []
additional_uploads_deploy_node: []
ara_enable: false

network_ssh_ip: "192.168.122.0"
network_openstack_ip: "192.168.123.0"
network_neutron_ip: "192.168.124.0"
network_ssh_ip: "192.168.122.1"
network_openstack_ip: "192.168.123.1"
network_neutron_ip: "192.168.124.1"

network_ssh_ip_start: '{{ network_ssh_ip.split(".")[:-1] | join(".") + ".2" }}'
network_ssh_ip_end: '{{ network_ssh_ip.split(".")[:-1] | join(".") + ".254" }}'
network_ssh_ip_gateway: '{{ network_ssh_ip.split(".")[:-1] | join(".") + ".254" }}'

network_openstack_ip_start: '{{ network_openstack_ip.split(".")[:-1] | join(".") + ".2" }}'
network_openstack_ip_end: '{{ network_openstack_ip.split(".")[:-1] | join(".") + ".254" }}'
network_openstack_ip_gateway: '{{ network_openstack_ip.split(".")[:-1] | join(".") + ".254" }}'
network_openstack_ip_gateway: '{{ network_openstack_ip.split(".")[:-1] | join(".") + ".1" }}'

network_neutron_ip_start: '{{ network_neutron_ip.split(".")[:-1] | join(".") + ".2" }}'
network_neutron_ip_end: '{{ network_neutron_ip.split(".")[:-1] | join(".") + ".254" }}'
network_neutron_ip_gateway: '{{ network_neutron_ip.split(".")[:-1] | join(".") + ".254" }}'
network_neutron_ip_gateway: '{{ network_neutron_ip.split(".")[:-1] | join(".") + ".1" }}'

external_network_cidr: '{{ network_neutron_ip.split(".")[:-1] | join(".") + ".0" }}/24'
external_network_dhcp_start: '{{ network_neutron_ip.split(".")[:-1] | join(".") + ".150" }}'
external_network_dhcp_end: '{{ network_neutron_ip.split(".")[:-1] | join(".") + ".199" }}'
external_network_gateway: '{{ network_neutron_ip_gateway }}'
external_network_type: "flat"
external_network_vlan_id: 123

network_ssh_bridge: virbr0
network_openstack_bridge: virbr2
network_neutron_bridge: virbr3

create_networks: false
create_network_ssh: "{{ create_networks }}"
create_network_openstack: "{{ create_networks }}"
create_network_neutron: "{{ create_networks }}"

destroy_networks: false
destroy_network_ssh: "{{ destroy_networks }}"
destroy_network_openstack: "{{ destroy_networks }}"
destroy_network_neutron: "{{ destroy_networks }}"
8 changes: 8 additions & 0 deletions kolla-files/all-in-one
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ control
[neutron:children]
network

[frr:children]
compute
network

[ovn-bgp-agent:children]
compute
network

[openvswitch:children]
network
compute
Expand Down
2 changes: 0 additions & 2 deletions remote

This file was deleted.

1 change: 1 addition & 0 deletions roles/create_aio/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ansible_args: >-
ansible_private_key_file={{ kolla_ssh_key }}
ansible_python_interpreter={{ kolla_python_interpereter }}
is_remote: false
aio_filepath: "kolla-inventory"
2 changes: 1 addition & 1 deletion roles/create_aio/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
delegate_to: localhost
template:
src: all-in-one.j2
dest: kolla-inventory
dest: "{{ aio_filepath }}"

- name: Add Proxy Jump to SSH Config
include_role:
Expand Down
8 changes: 8 additions & 0 deletions roles/create_multinode/templates/multinode.j2
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@ neutron
compute
network

[frr:children]
compute
network

[ovn-bgp-agent:children]
compute
network

# Cinder
[cinder-api:children]
cinder
Expand Down
1 change: 1 addition & 0 deletions roles/create_vm/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ generate_mac_addresses: false
mac_addresses: []
ssh_config: "ssh_config"
is_remote: false
libvirt_domain_type: kvm
2 changes: 1 addition & 1 deletion roles/create_vm/templates/kolla-node.xml.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<domain type="kvm">
<domain type="{{ libvirt_domain_type }}">
<name>{{ node_name }}</name>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
Expand Down
14 changes: 7 additions & 7 deletions roles/delete_nodes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
state: absent
loop: "{{ to_delete }}"

- name: Deleting SSH proxy entry
delegate_to: localhost
blockinfile:
path: "{{ ssh_config }}"
marker: "# {mark} KOLLA-PROXY"
state: absent
when: is_remote
# - name: Deleting SSH proxy entry
# delegate_to: localhost
# blockinfile:
# path: "{{ ssh_config }}"
# marker: "# {mark} KOLLA-PROXY"
# state: absent
# when: is_remote

- name: Add remove host from dhcp pool
shell: |
Expand Down
1 change: 1 addition & 0 deletions roles/libvirt_network/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ libvirt_network_ip_gateway: "192.168.100.1"
libvirt_network_ip_netmask: 255.255.255.0
libvirt_network_domain: kolla.local
libvirt_network_auto_dhcp: true
libvirt_network_type: nat
15 changes: 9 additions & 6 deletions roles/libvirt_network/templates/network.xml.j2
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<network>
<name>{{ libvirt_network_name }}</name>
<bridge name="{{ libvirt_network_bridge }}" />
<forward mode='nat'/>
<forward mode='{{ libvirt_network_type }}'/>
{% if libvirt_network_type != 'bridge' %}
<ip address="{{ libvirt_network_ip_gateway }}" netmask="{{ libvirt_network_ip_netmask }}">
{% if libvirt_network_auto_dhcp %}
<dhcp>
<range start="{{ libvirt_network_ip_start }}" end="{{ libvirt_network_ip_end }}" />
</dhcp>
{% endif %}
{% if libvirt_network_auto_dhcp %}
<dhcp>
<range start="{{ libvirt_network_ip_start }}" end="{{ libvirt_network_ip_end }}" />
</dhcp>
{% endif %}
</ip>
{% endif %}

</network>
1 change: 1 addition & 0 deletions roles/nginx_proxy/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
reverse_proxy_ip_address: "{{kolla_internal_vip_address}}"
# 80 and 443 Are added automatically depending on your kolla settings
# If your remote server is on the cloud, make sure
# ingress to all ports you forward is allowed
Expand Down
2 changes: 1 addition & 1 deletion roles/nginx_proxy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# tasks file for nginx_proxy
- name: Register Kolla Variables
set_fact:
globals: "{{ lookup('file', 'kolla-files/' ~ globals_file) | from_yaml }}"
globals: "{{ lookup('file', 'kolla-files/' ~ globals_file | default('') ) | from_yaml }}"
- name: Get Kolla uses external TLS
set_fact:
use_tls: "{{ globals.kolla_enable_tls_external | default(false) }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/nginx_proxy/templates/passthrough.conf.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
stream {
{% macro stream(port,ssl=false, ip=globals.kolla_internal_vip_address)%}
{% macro stream(port,ssl=false, ip=reverse_proxy_ip_address)%}
server {
listen {{port}};
proxy_pass {{ip}}:{{port}};
Expand Down
2 changes: 1 addition & 1 deletion roles/upload_archive/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source_local_path: "../kolla-ansible"
source_node_path: "/home/kolla/kolla-ansible"
source_name: "Kolla Ansible"
kolla_group: "kolla"
mode: ""
mode: "0777"
4 changes: 4 additions & 0 deletions roles/upload_to_nodes/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ mode: ""
kolla_vip_last_digit: 200
kolla_internal_vip_address: "192.168.123.200"
globals_file: null

demo_net_cidr: "10.0.0.0/24"
demo_net_gateway: "10.0.0.1"
demo_net_dns: "8.8.8.8"
6 changes: 3 additions & 3 deletions roles/upload_to_nodes/files/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ enable_horizon_heat: "{{ enable_heat | bool }}"
#enable_neutron_qos: "no"
#enable_neutron_agent_ha: "no"
#enable_neutron_bgp_dragent: "no"
#enable_neutron_provider_networks: "no"
#enable_neutron_provider_networks: "yes"
#enable_neutron_segments: "no"
#enable_neutron_sfc: "no"
#enable_neutron_trunk: "no"
Expand All @@ -429,8 +429,8 @@ enable_horizon_heat: "{{ enable_heat | bool }}"
#enable_osprofiler: "no"
#enable_placement: "{{ enable_nova | bool or enable_zun | bool }}"
#enable_prometheus: "no"
enable_proxysql: "yes"
enable_redis: "yes"
enable_proxysql: "no"
enable_redis: "no"
#enable_sahara: "no"
#enable_senlin: "no"
#enable_skyline: "no"
Expand Down
14 changes: 10 additions & 4 deletions roles/upload_to_nodes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
group: kolla
mode: '0644'

when: globals_file != None
- name: Template 'init-runonce' demo setup file
template:
src: init-runonce.j2
dest: /home/kolla/init-runonce
owner: kolla
group: kolla
mode: '0775'
- name: Copy all-in-one to deploy node
copy:
src: kolla-files/all-in-one
Expand Down Expand Up @@ -75,10 +81,10 @@
mode: "0600"
when: not is_aio

- name: Ensure kolla venv is sourced on login
lineinfile:
- name: Template extra bashrc
blockinfile:
path: /home/kolla/.bashrc
line: "source kolla/bin/activate"
block: "{{ lookup('template', 'bashrc.j2') }}"
state: present

- name: Set KOLLA_INVENTORY to multinode
Expand Down
15 changes: 15 additions & 0 deletions roles/upload_to_nodes/templates/bashrc.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source kolla/bin/activate
export EXT_NET_CIDR='{{ external_network_cidr }}'
export EXT_NET_RANGE='start={{ external_network_dhcp_start }},end={{ external_network_dhcp_end }}'
export EXT_NET_GATEWAY='{{ external_network_gateway }}'

export DEMO_NET_CIDR='{{ demo_net_cidr }}'
export DEMO_NET_GATEWAY='{{demo_net_gateway}}'
export DEMO_NET_DNS='{{demo_net_dns}}'

# Specify clouds.yaml file to use
export OS_CLIENT_CONFIG_FILE=/etc/kolla/clouds.yaml

# Select admin account from clouds.yaml
export OS_CLOUD=kolla-admin

Loading