Mentions légales du service

Skip to content
Snippets Groups Projects
Commit ed24b2b8 authored by SIMONIN Matthieu's avatar SIMONIN Matthieu
Browse files

update skydive

comply with the new network api
new version
parent 11807d0e
No related branches found
No related tags found
No related merge requests found
Showing
with 247 additions and 298 deletions
......@@ -21,7 +21,7 @@ DEFAULT_VARS = {
# there a skydive_fabric variable to do that
"skydive_auto_fabric": "no",
# force python3
"ansible_python_interpreter": "/usr/bin/python3"
"ansible_python_interpreter": "/usr/bin/python3",
}
......@@ -62,9 +62,9 @@ class Skydive(Service):
"""
self.analyzers = analyzers if analyzers is not None else []
assert(self.analyzers is not None)
self.agents = agents if agents is not None else []
assert(self.agents is not None)
assert self.analyzers is not None
self.agents = list(set(agents)) if agents is not None else []
assert self.agents is not None
self.skydive = self.analyzers + self.agents
self.roles: Dict = {}
self.networks = networks
......@@ -82,41 +82,46 @@ class Skydive(Service):
self.extra_vars.update(skydive_fabric=self.fabric_opts)
def build_fabric(self):
def fabric_for_role(network_role, desc):
def fabric_for_role(network):
fabric = []
for agent in self.agents:
device = agent.extra.get("%s_dev" % network_role)
if device is not None:
infos = "cidr=%s, gateway=%s, dns=%s" % (
desc["cidr"],
desc["gateway"],
desc["dns"],
)
infos = "%s, roles=%s" % (infos, "-".join(desc["roles"]))
local_port = "%s-%s" % (network_role, int(len(fabric) / 2))
fabric.append("%s[%s] -> %s" % (desc["cidr"], infos, local_port))
fabric.append(
"%s -> *[Type=host, Hostname=%s]/%s"
% (local_port, agent.alias, device)
)
devices = agent.filter_interfaces([network])
for device in devices:
if device is not None:
infos = f"cidr={network.network}"
infos = "%s, roles=%s" % (infos, "-".join(network.roles))
local_port = "%s-%s" % (
"-".join(network.roles),
int(len(fabric) / 2),
)
fabric.append(
"%s[%s] -> %s" % (network.network, infos, local_port)
)
fabric.append(
"%s -> *[Type=host, Hostname=%s]/%s"
% (local_port, agent.alias, device)
)
return fabric
fabric = []
if self.networks is None:
return fabric
for n in self.networks:
roles = n["roles"]
for role in roles:
# we use the first role to be able to get the associated device
fabric.extend(fabric_for_role(role, n))
break
for network in self.networks:
# we use the first role to be able to get the associated device
fabric.extend(fabric_for_role(network))
return fabric
def deploy(self):
"""Deploy Skydive service."""
# Some requirements
with play_on(pattern_hosts="all", roles=self.roles, priors=self.priors) as p:
with play_on(
pattern_hosts="all",
roles=self.roles,
priors=self.priors,
extra_vars=self.extra_vars,
) as p:
p.pip(display_name="[Preinstall] Installing pyyaml", name="pyyaml")
_playbook = os.path.join(SERVICE_PATH, "skydive", "skydive.yml")
run_ansible([_playbook], roles=self.roles, extra_vars=self.extra_vars)
[defaults]
# For ofter testing ignoring ssh key
host_key_checking = False
# Use the YAML callback plugin. For a better CLI experience
stdout_callback = yaml
# Use the stdout_callback when running ad-hoc commands.
bin_ansible_callbacks = True
......@@ -10,3 +10,7 @@ skydive_listen_ip=0.0.0.0
[agents]
10.0.0.9
# For skydive-flow-matrix add skydive_extra_config:
#[agents:vars]
#skydive_extra_config={'agent.topology.probes': ['socketinfo',]}
......@@ -15,7 +15,7 @@
service_name: skydive-analyzer
exec_start_pre: /usr/bin/{{ skydive_container_cli }} stop skydive-analyzer-{{ ansible_hostname }}
exec_start: |
/usr/bin/{{ skydive_container_cli }} run --rm \
/usr/bin/{{ skydive_container_cli }} run \
{{ skydive_analyzer_docker_extra_env }} --name=skydive-analyzer-{{ ansible_hostname }} \
--net=host \
--user {{ skydive_sysuser_result.uid }}:{{ skydive_sysuser_result.group }} \
......
---
skydive_release: v0.25.0
skydive_release: v0.27.0
skydive_docker_registry: docker.io
skydive_docker_image_tag: latest
skydive_config_file: /etc/skydive/skydive.yml
......
- name: Display all variables/facts known for a host
debug:
var: hostvars[inventory_hostname]
verbosity: 4
- name: Set analyzers list
set_fact:
......
---
- name: Upgrade all packages
yum: name=* state=latest
when: ansible_os_family == 'RedHat'
- name: Install opstools repository
package:
name: centos-release-opstools
state: present
update_cache: yes
when: ansible_distribution == 'CentOS' and skydive_package_location is not defined
- name: Copy skydive packages
......
......@@ -5,6 +5,7 @@ After=docker.service
{% endif %}
[Service]
Type=simple
EnvironmentFile=-/etc/environment
EnvironmentFile=-/etc/sysconfig/{{ service_name }}
{% if exec_start_pre is defined %}
......
......@@ -7,8 +7,6 @@
- https://www.rdoproject.org/repos/rdo-release.rpm
- "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
- shell: "yum update -y"
- package:
name: centos-release-openstack-queens
state: present
......
......@@ -5,7 +5,7 @@
- ffmpeg
- gifsicle
- libvirt
- vagrant-libvirt
- ruby-devel
- virt-what
- ansible
- dnf-utils
......
......@@ -3,10 +3,7 @@
dnf: name=['http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ ansible_distribution_version }}.noarch.rpm']
state=present
- name: "Updating packages"
shell: "dnf update -y"
- name: "Install copr dnf plugin"
package:
name: dnf-plugins-core
state: present
\ No newline at end of file
state: present
......@@ -9,7 +9,7 @@
- name: run gimme in bash profile
lineinfile:
path: /home/vagrant/.bash_profile
line: 'eval "$(gimme 1.11.13)"'
line: 'eval "$(gimme 1.14.x)"'
- name: set GOPATH
lineinfile:
......@@ -22,6 +22,6 @@
line: 'export PATH=/home/vagrant/go/bin:$PATH'
- name: run gimme once
command: /usr/local/bin/gimme 1.11.13
command: /usr/local/bin/gimme 1.14.x
become: yes
become_user: vagrant
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment