Add experimental installation from docker

This is our first attempt at running nodepool from docker, consider it
experimental.  The idea here, is you now have the option of using the
official docker images from https://hub.docker.com/u/zuul for nodepool.

Users themself will be required to manage / configure docker, this role
only installs / configures / starts nodepool.

Change-Id: I2f3aa301e626a7b09ff129a21a188cee06e31f18
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2018-08-16 20:25:04 -04:00
parent 794a330d65
commit 34bd22ca8b
10 changed files with 81 additions and 1 deletions

View File

@ -44,12 +44,23 @@
parent: ansible-role-nodepool-src
nodeset: ubuntu-bionic
# Testing for nodepool_install_method: docker
- job:
name: ansible-role-nodepool-docker
parent: ansible-role-nodepool-base
nodeset: ubuntu-bionic
vars:
nodepool_install_method: docker
nodepool_file_nodepool_builder_service_src: etc/systemd/system/nodepool-builder.service.j2
nodepool_file_nodepool_launcher_service_src: etc/systemd/system/nodepool-launcher.service.j2
- project:
templates:
- windmill-jobs-fedora-latest
- windmill-jobs-bionic
check:
jobs:
- ansible-role-nodepool-docker
- ansible-role-nodepool-fedora-latest
- ansible-role-nodepool-ubuntu-bionic
- ansible-role-nodepool-src-fedora-latest
@ -58,6 +69,7 @@
- windmill-tox-molecule
gate:
jobs:
- ansible-role-nodepool-docker
- ansible-role-nodepool-fedora-latest
- ansible-role-nodepool-ubuntu-bionic
- ansible-role-nodepool-src-fedora-latest

View File

@ -21,6 +21,12 @@ Requirements
------------
* pip3 to be installed if using nodepool_install_method: (git|pip)
* docker to be installed if using nodepool_install_method: docker
*NOTE*
Docker support should be consider experimental. You will need to create
systemd service files manually. There are too many possible settings
for docker, which make is almost impossible to support via Ansible.
Packages
~~~~~~~~

View File

@ -3,3 +3,4 @@
docker.io [test platform:dpkg]
docker [test platform:fedora]
python-docker [test platform:dpkg]

View File

@ -69,6 +69,10 @@ nodepool_pip_name: nodepool
# nodepool_pip_virtualenv_python:
# nodepool_pip_virtualenv:
nodepool_docker_name:
- zuul/nodepool-builder
- zuul/nodepool-launcher
# tasks/service.yaml
nodepool_file_nodepool_builder_service_manage: true
nodepool_file_nodepool_builder_service_group: root

View File

@ -1 +1,2 @@
ansible>=2.4.0
docker

19
tasks/install/docker.yaml Normal file
View File

@ -0,0 +1,19 @@
# Copyright 2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Install nodepool using docker
become: true
docker_image:
name: "{{ item }}"
with_items: "{{ nodepool_docker_name }}"

View File

@ -1,3 +1,2 @@
ara
docker
molecule

View File

@ -12,3 +12,13 @@
dest: /etc/pip.conf
regexp: ^extra-index-url
state: absent
- name: Execute bindep role
include_role:
name: bindep
vars:
bindep_profile: ansible test
- name: Execute test-setup role
include_role:
name: test-setup

View File

@ -0,0 +1,14 @@
[Unit]
Description=Nodepool Builder Service
After=docker.service
Requires=docker.service
[Service]
Type=simple
# Options to pass to nodepool-builder.
Environment="ARGS=-l /etc/nodepool/builder-logging.conf"
ExecStart=/usr/bin/docker run --rm --name nodepool-builder -u 1001:1001 -v /var/lib/nodepool:/var/lib/nodepool -v /etc/nodepool:/etc/nodepool -v /opt/nodepool:/opt/nodepool -v /var/log/nodepool:/var/log/nodepool -h nodepool-builder zuul/nodepool-builder nodepool-builder -d $ARGS
ExecStop=/usr/bin/docker stop nodepool-builder
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Nodepool Launcher Service
After=docker.service
Requires=docker.service
[Service]
Type=simple
# Options to pass to nodepool-launcher.
Environment="ARGS=-l /etc/nodepool/launcher-logging.conf --no-webapp"
ExecStart=/usr/bin/docker run --rm --name nodepool-launcher -u 1001:1001 -v /var/lib/nodepool:/var/lib/nodepool -v /etc/nodepool:/etc/nodepool -v /opt/nodepool:/opt/nodepool -v /var/log/nodepool:/var/log/nodepool -h nodepool-launcher zuul/nodepool-launcher nodepool-launcher -d $ARGS
ExecStop=/usr/bin/docker stop nodepool-launcher
[Install]
WantedBy=multi-user.target