Skip to content

Commit

Permalink
support centos networking containers.
Browse files Browse the repository at this point in the history
Partial-Bug: #1554943

changes done:
1. add new variable for compute_redhat packages and nova-compute services
2. identify centos as systemd instead of upstart
3. add docker installation method for Redhat family

PATCH 2:
1. address review comments
2. moved to a single variable for compute packages

PATCH 3:
1. addressing missed review comment

PATCH 4:
1. put correct libvirt binary name

Change-Id: I1684ae5eb40e743afcbe517ade72a1a18363fd31
  • Loading branch information
Dheeraj Gautam committed Jul 21, 2017
1 parent bc0b0e3 commit 943aeab
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 9 deletions.
2 changes: 1 addition & 1 deletion playbooks/roles/common/tasks/facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# as ansible wrongly detect ansible_service_mgr as systemd
- name: Setting fact to override ansible_service_mgr for docker. This is to wrongly detect service manager as systemd when ubuntu container run on top of centos
set_fact: ansible_service_mgr=upstart
when: deployment_platform == "docker" and ansible_service_mgr == 'systemd' and not (ansible_distribution == 'Ubuntu' and ansible_distribution_version == '16.04')
when: deployment_platform == "docker" and ansible_service_mgr == 'systemd' and not ((ansible_distribution == "CentOS") or ((ansible_distribution == 'Ubuntu') and ansible_distribution_version == '16.04'))

- name: Set kernel_version_installed flag for compute provision to use
set_fact:
Expand Down
8 changes: 7 additions & 1 deletion playbooks/roles/contrail/bare_metal_agent/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ dpdk_config: "{{ '--dpdk ' + dpdk_params if dpdk_params else '' }}"
kernel_installed: "{{ true if kernel_version_installed == kernel_version else false }}"
kernel_compute_packages: "{{ upgrade_kernel_vrouter_packages if kernel_upgraded or kernel_installed else default_kernel_compute_packages }}"
compute_packages_to_install: "{{ dpdk_compute_packages if dpdk_config else kernel_compute_packages }}"
compute_packages: "{{ compute_packages_to_install + lbaas_packages if enable_lbaas else compute_packages_to_install }}"
compute_packages_redhat:
- contrail-openstack-vrouter
- contrail-vrouter-common
- contrail-vrouter
- contrail-vrouter-init
compute_packages_default: "{{ compute_packages_to_install + lbaas_packages if enable_lbaas else compute_packages_to_install }}"
compute_packages: "{{ compute_packages_redhat if ansible_os_family == 'RedHat' else compute_packages_default }}"

#SRIOV defaults
sriov: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
lineinfile: dest=/etc/sensitive_services line=supervisor-vrouter state=present create=yes

- name: install contrail-vrouter-agent related packages
package: name={{ item }} state=latest
yum: name={{ item }} state=latest
with_items: "{{ compute_packages }}"

# This is a workaround on issue https://github.com/Juniper/contrail-docker/issues/82
Expand Down
3 changes: 3 additions & 0 deletions playbooks/roles/contrail/common/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ my_controller_ip: "{{ controller_list | intersect(ansible_all_ipv4_addresses)|fi
my_analytics_ip: "{{ analytics_list | intersect(ansible_all_ipv4_addresses)|first }}"
my_analyticsdb_ip: "{{ analyticsdb_list | intersect(ansible_all_ipv4_addresses)|first }}"
my_compute_ip: "{{ compute_list | intersect(ansible_all_ipv4_addresses)|first }}"

nova_compute_service: "{{'openstack-nova-compute' if ansible_distribution == 'CentOS' else 'nova-compute'}}"
libvirt_service: "{{'libvirtd' if ansible_distribution == 'CentOS' else 'libvirt-bin'}}"
27 changes: 27 additions & 0 deletions playbooks/roles/docker/tasks/host/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
- name: Add contrail apt repository if required
apt_repository:
repo: "deb {{ contrail_apt_repo }} ./"
state: present
register: apt_repo_added
when: contrail_apt_repo is defined and contrail_apt_repo != ""
ignore_errors: yes

- name: Allow unauthenticated packages for contrail packages to work
copy: content='APT::Get::AllowUnauthenticated "true";' dest=/etc/apt/apt.conf.d/99allowunauth
when: contrail_apt_repo is defined and contrail_apt_repo != ""

# If installing contrail_apt_repo entry, use higher priority for that to make
# sure all packages use the contrail repo
- name: Pin contrail apt repo "contrail" release to priority 999
copy: src=apt-preferences.conf dest=/etc/apt/preferences.d/contrail_repo.pref
when: contrail_apt_repo is defined and contrail_apt_repo != "" and apt_repo_added.get('changed',false)

- name: Run apt-get update
apt: update_cache=yes
when: contrail_apt_repo is defined and contrail_apt_repo != "" and apt_repo_added.get('changed',false)
ignore_errors: yes

- name: install docker using package
package: name="{{ docker_package_name }}" state=installed

14 changes: 14 additions & 0 deletions playbooks/roles/docker/tasks/host/Redhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: "Add contrail yum repo {{contrail_image_id}}"
yum_repository:
name: "{{contrail_image_id}}"
file: cobbler-config
description: "Contrail Package Repo"
baseurl: "{{contrail_yum_repo}}"
priority: 1
gpgcheck: no

- name: install docker using package
yum:
name: "{{ docker_package_name }}"
state: latest
2 changes: 1 addition & 1 deletion playbooks/roles/node/tasks/host/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
gpgcheck: no
enabled: yes
priority: 1
when: contrail_yum_repo
when: contrail_yum_repo is defined and contrail_yum_repo != ""

- name: "Disable firewalld on redhat systems"
service: name=firewalld state=stopped enabled=no
Expand Down
12 changes: 12 additions & 0 deletions playbooks/roles/openstack/compute/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ libvirt_qemu_abs: /etc/apparmor.d/abstractions/libvirt-qemu

#tsn defaults
tsn_node: "{{ hostvars[inventory_hostname].get('tsn_mode') | default('False')}}"

nova_compute_pkgs_default:
- contrail-setup
- nova-compute

nova_compute_pkgs_redhat:
- contrail-setup
- openstack-nova-compute
- contrail-vrouter-agent

nova_compute_pkgs: "{{nova_compute_pkgs_redhat if ansible_os_family == 'RedHat' else nova_compute_pkgs_default}}"

4 changes: 2 additions & 2 deletions playbooks/roles/openstack/compute/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: restart nova-compute
service: name=nova-compute state=restarted
service: name="{{nova_compute_service}}" state=restarted

- name: restart libvirt
service: name=libvirt-bin state=restarted
service: name="{{libvirt_service}}" state=restarted
5 changes: 5 additions & 0 deletions playbooks/roles/openstack/compute/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
sriov_physnets: "{{ sriov_physnets_list | join(',') if sriov_physnets_list else '' }}"
sriov_interfaces: "{{ sriov_intf_list | join(',') if sriov_intf_list else '' }}"

- name: create /etc/contrail
file: >-
path=/etc/contrail
state=directory
- name: Create /etc/contrail/ctrl-details
template: src=ctrl-details.j2 dest=/etc/contrail/ctrl-details

Expand Down
11 changes: 8 additions & 3 deletions playbooks/roles/openstack/compute/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
---
- name: Install nova compute packages
apt: name={{ item }} state=latest force=yes
with_items:
- contrail-setup
- nova-compute
with_items: "{{nova_compute_pkgs}}"
when: ansible_os_family == 'Debian'

- name: Install nova compute packages
yum: name={{ item }} state=latest
with_items: "{{nova_compute_pkgs}}"
when: ansible_os_family == 'RedHat'

- name: Install DPDK packages, if applicable
apt: name={{ item }} state=latest force=yes
Expand All @@ -16,3 +20,4 @@

- name: create a symlink from /bin/true to /sbin/chkconfig
file: src=/bin/true dest=/sbin/chkconfig state=link
when: ansible_os_family == 'Debian'

0 comments on commit 943aeab

Please sign in to comment.