Add configuration of OpenSM Infiniband subnet manager in a Docker container
Follows kolla-ansible service configuration patterns. Uses jumanjiman.opensm Docker image.
This commit is contained in:
parent
d0e0c029b6
commit
1e08a1413d
6
ansible/group_vars/all/opensm
Normal file
6
ansible/group_vars/all/opensm
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
###############################################################################
|
||||
# OpenSM Infiniband subnet manager configuration.
|
||||
|
||||
# Whether OpenSM is enabled.
|
||||
opensm_enabled: False
|
12
ansible/opensm.yml
Normal file
12
ansible/opensm.yml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
# Deploy/pull/reconfigure/upgrade OpenSM Infiniband subnet manager.
|
||||
#
|
||||
# Follows kolla-ansible service deployment patterns.
|
||||
#
|
||||
# Variables:
|
||||
# action: One of deploy, pull, reconfigure, upgrade
|
||||
|
||||
- name: Ensure OpenSM is deployed
|
||||
hosts: controllers[0]
|
||||
roles:
|
||||
- role: opensm
|
10
ansible/overcloud-extras.yml
Normal file
10
ansible/overcloud-extras.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
# Deploy/pull/reconfigure/upgrade overcloud services not managed by
|
||||
# kolla-ansible.
|
||||
#
|
||||
# Follows kolla-ansible service deployment patterns.
|
||||
#
|
||||
# Variables:
|
||||
# action: One of deploy, pull, reconfigure, upgrade
|
||||
|
||||
- include: opensm.yml
|
45
ansible/roles/opensm/README.md
Normal file
45
ansible/roles/opensm/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
OpenSM Infiniband Subnet Manager
|
||||
================================
|
||||
|
||||
This role can be used to configure an OpenSM Infiniband subnet manager running
|
||||
in a Docker container.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
The host executing the role has the following requirements:
|
||||
|
||||
* Docker engine
|
||||
* ``docker-py >= 1.7.0``
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
``opensm_enabled``: Whether OpenSM is enabled. Defaults to ``true``.
|
||||
``opensm_namespace``: Docker image namespace. Defaults to ``jumanjiman``.
|
||||
``opensm_image``: Docker image name.
|
||||
``opensm_tag``: Docker image tag. Defaults to ``latest``.
|
||||
``opensm_image_full``: Full docker image specification.
|
||||
``opensm_restart_policy``: Docker restart policy for OpenSM container. Defaults
|
||||
to ``unless-stopped``.
|
||||
``opensm_restart_retries``: Number of Docker restarts. Defaults to 10.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
The following playbook configures OpenSM.
|
||||
|
||||
---
|
||||
- hosts: opensm
|
||||
roles:
|
||||
- role: opensm
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
- Mark Goddard (<mark@stackhpc.com>)
|
30
ansible/roles/opensm/defaults/main.yml
Normal file
30
ansible/roles/opensm/defaults/main.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
# Roughly follows kolla-ansible's service deployment patterns.
|
||||
|
||||
# Whether OpenSM is enabled.
|
||||
opensm_enabled: true
|
||||
|
||||
# Service deployment definition.
|
||||
opensm_services:
|
||||
opensm:
|
||||
container_name: opensm
|
||||
enabled: "{{ opensm_enabled }}"
|
||||
image: "{{ opensm_image_full }}"
|
||||
privileged: True
|
||||
read_only: True
|
||||
volumes:
|
||||
- "/etc/localtime:/etc/localtime:ro"
|
||||
- "/lib/modules:/lib/modules:ro"
|
||||
- "opensm_cache:/var/cache/opensm"
|
||||
- "opensm_logs:/var/log"
|
||||
|
||||
####################
|
||||
# Docker
|
||||
####################
|
||||
opensm_namespace: "jumanjiman"
|
||||
opensm_image: "{{ docker_registry ~ '/' if docker_registry | default else '' }}{{ opensm_namespace }}/opensm"
|
||||
opensm_tag: "latest"
|
||||
opensm_image_full: "{{ opensm_image }}:{{ opensm_tag }}"
|
||||
|
||||
opensm_restart_policy: "unless-stopped"
|
||||
opensm_restart_retries: 10
|
14
ansible/roles/opensm/tasks/deploy.yml
Normal file
14
ansible/roles/opensm/tasks/deploy.yml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Ensure OpenSM container is running
|
||||
docker_container:
|
||||
image: "{{ item.value.image }}"
|
||||
name: "{{ item.value.container_name }}"
|
||||
network_mode: "host"
|
||||
privileged: "{{ item.value.privileged | default(omit) }}"
|
||||
pull: "{{ action == 'upgrade' }}"
|
||||
read_only: "{{ item.value.read_only | default(omit) }}"
|
||||
restart_policy: "{{ opensm_restart_policy }}"
|
||||
restart_retries: "{{ opensm_restart_retries }}"
|
||||
state: "{{ 'started' if item.value.enabled | bool else 'absent' }}"
|
||||
volumes: "{{ item.value.volumes }}"
|
||||
with_dict: "{{ opensm_services }}"
|
2
ansible/roles/opensm/tasks/main.yml
Normal file
2
ansible/roles/opensm/tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
- include: "{{ action }}.yml"
|
5
ansible/roles/opensm/tasks/pull.yml
Normal file
5
ansible/roles/opensm/tasks/pull.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Pulling OpenSM container image
|
||||
docker_image:
|
||||
name: "{{ opensm_image_full }}"
|
||||
state: present
|
1
ansible/roles/opensm/tasks/reconfigure.yml
Symbolic link
1
ansible/roles/opensm/tasks/reconfigure.yml
Symbolic link
@ -0,0 +1 @@
|
||||
deploy.yml
|
1
ansible/roles/opensm/tasks/upgrade.yml
Symbolic link
1
ansible/roles/opensm/tasks/upgrade.yml
Symbolic link
@ -0,0 +1 @@
|
||||
deploy.yml
|
10
etc/kayobe/opensm.yml
Normal file
10
etc/kayobe/opensm.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
###############################################################################
|
||||
# OpenSM Infiniband subnet manager configuration.
|
||||
|
||||
# Whether OpenSM is enabled.
|
||||
#opensm_enabled:
|
||||
|
||||
###############################################################################
|
||||
# Dummy variable to allow Ansible to accept this file.
|
||||
workaround_ansible_issue_8743: yes
|
@ -399,11 +399,23 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Deploying overcloud services")
|
||||
|
||||
# First prepare configuration.
|
||||
playbooks = _build_playbook_list("kolla-ansible", "kolla-openstack",
|
||||
"swift-setup")
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||
|
||||
# Run kolla-ansible prechecks before deployment.
|
||||
for command in ["prechecks", "deploy"]:
|
||||
self.run_kolla_ansible_overcloud(parsed_args, command)
|
||||
|
||||
# Deploy kayobe extra services.
|
||||
playbooks = _build_playbook_list("overcloud-extras")
|
||||
extra_vars = {"action": "deploy"}
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks,
|
||||
extra_vars=extra_vars)
|
||||
|
||||
# Post-deployment configuration.
|
||||
# FIXME: Fudge to work around incorrect configuration path.
|
||||
extra_vars = {"node_config_directory": parsed_args.kolla_config_path}
|
||||
self.run_kolla_ansible_overcloud(parsed_args, "post-deploy",
|
||||
@ -420,11 +432,23 @@ class OvercloudServiceReconfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Reconfiguring overcloud services")
|
||||
|
||||
# First prepare configuration.
|
||||
playbooks = _build_playbook_list("kolla-ansible", "kolla-openstack",
|
||||
"swift-setup")
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||
|
||||
# Run kolla-ansible prechecks before reconfiguration.
|
||||
for command in ["prechecks", "reconfigure"]:
|
||||
self.run_kolla_ansible_overcloud(parsed_args, command)
|
||||
|
||||
# Reconfigure kayobe extra services.
|
||||
playbooks = _build_playbook_list("overcloud-extras")
|
||||
extra_vars = {"action": "reconfigure"}
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks,
|
||||
extra_vars=extra_vars)
|
||||
|
||||
# Post-deployment configuration.
|
||||
# FIXME: Fudge to work around incorrect configuration path.
|
||||
extra_vars = {"node_config_directory": parsed_args.kolla_config_path}
|
||||
self.run_kolla_ansible_overcloud(parsed_args, "post-deploy",
|
||||
@ -441,19 +465,37 @@ class OvercloudServiceUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Upgrading overcloud services")
|
||||
|
||||
# First prepare configuration.
|
||||
playbooks = _build_playbook_list("kolla-ansible", "kolla-openstack")
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||
|
||||
# Run kolla-ansible prechecks before upgrade.
|
||||
for command in ["prechecks", "upgrade"]:
|
||||
self.run_kolla_ansible_overcloud(parsed_args, command)
|
||||
|
||||
# Upgrade kayobe extra services.
|
||||
playbooks = _build_playbook_list("overcloud-extras")
|
||||
extra_vars = {"action": "upgrade"}
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks,
|
||||
extra_vars=extra_vars)
|
||||
|
||||
|
||||
class OvercloudContainerImagePull(KollaAnsibleMixin, VaultMixin, Command):
|
||||
"""Pull the overcloud container images from a registry."""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Pulling overcloud container images")
|
||||
|
||||
# Pull updated kolla container images.
|
||||
self.run_kolla_ansible_overcloud(parsed_args, "pull")
|
||||
|
||||
# Pull container images for kayobe extra services.
|
||||
playbooks = _build_playbook_list("overcloud-extras")
|
||||
extra_vars = {"action": "pull"}
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks,
|
||||
extra_vars=extra_vars)
|
||||
|
||||
|
||||
class OvercloudContainerImageBuild(KayobeAnsibleMixin, VaultMixin, Command):
|
||||
"""Build the overcloud container images."""
|
||||
|
Loading…
Reference in New Issue
Block a user