Skip to content
Snippets Groups Projects
Commit 532119ae authored by shivupoojar's avatar shivupoojar
Browse files

Added docker node template for ubuntu

parent d016a6e2
No related branches found
No related tags found
1 merge request!1Master
Showing
with 221 additions and 0 deletions
Copyright (c) 2019 Contributors to the RADON project
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.
\ No newline at end of file
text/plain
\ No newline at end of file
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
radon.nodes.docker.DockerEngineUT:
derived_from: radon.nodes.abstract.ContainerRuntime
metadata:
targetNamespace: "radon.nodes.docker"
abstract: "false"
final: "false"
attributes:
port:
type: integer
default: { get_attribute: [ SELF, docker, port ] }
requirements:
- host:
capability: tosca.capabilities.Compute
relationship: tosca.relationships.HostedOn
occurrences: [ 1, 1 ]
capabilities:
host:
occurrences: [ 1, UNBOUNDED ]
valid_source_types: [ radon.nodes.docker.DockerApplication ]
type: radon.capabilities.container.DockerRuntime
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
operations:
configure:
implementation:
primary: create
timeout: 0
artifacts:
create:
type: radon.artifacts.Ansible
file: create-centos.yml
![](https://img.shields.io/badge/Status:-RELEASED-green)
![](https://img.shields.io/badge/%20-DEPLOYABLE-blueviolet)
## Docker Engine Node Type
Type that represents a Docker runtime to run multiple Docker container applications on a single host.
| Name | URI | Version | Derived From |
|:---- |:--- |:------- |:------------ |
| `DockerRuntime` | `radon.nodes.docker.DockerRuntime` | 1.0.0 | `radon.nodes.abstract.ContainerRuntime` |
### Attributes
| Name | Type | Default Value | Description |
|:---- |:---- |:------------- |:----------- |
| `port` | `integer` | The port value exposed by the `docker` capability | Exposed port of the Docker daemon |
### Capabilities
| Name | Type | Valid Source Types | Occurrences |
|:---- |:---- |:------------------ |:----------- |
| `docker` | `radon.capabilities.container.DockerRuntime` | `radon.nodes.docker.DockerApplication` | [1, UNBOUNDED] |
text/x-web-markdown
\ No newline at end of file
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
image/png
\ No newline at end of file
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
image/png
\ No newline at end of file
---
- name: create
hosts: all
gather_facts: true
become: true
become_method: sudo
# vars:
# ansible_ssh_private_key_file: "{{ ssh_key_file }}"
# ansible_ssh_user: "{{ ssh_user }}"
tasks:
- name: Prerequirements for yum module
yum:
name: "*"
state: latest
- name: Create target directory
file:
path=/etc/docker/
state=directory
mode=0755
- name: configure docker network address, ahead of time, to solve issues with docker default network collision with UT VPN
copy:
dest: /etc/docker/daemon.json
content: |
{
"default-address-pools": [{"base":"172.80.0.0/16","size":24}]
}
owner: root
group: root
mode: '0644'
- name: Install yum utils
yum:
name: "{{ item }}"
state: latest
with_items:
- yum-utils
- device-mapper-persistent-data
- lvm2
- python3-pip
- python3-setuptools
- name: Add Docker repo
get_url:
url: https://download.docker.com/linux/centos/docker-ce.repo
dest: /etc/yum.repos.d/docer-ce.repo
become: yes
- name: Enable Docker Edge repo
ini_file:
dest: /etc/yum.repos.d/docer-ce.repo
section: 'docker-ce-edge'
option: enabled
value: 0
become: yes
- name: Enable Docker Test repo
ini_file:
dest: /etc/yum.repos.d/docer-ce.repo
section: 'docker-ce-test'
option: enabled
value: 0
become: yes
- name: Install Docker
package:
name: docker-ce
state: latest
become: yes
- name: Add user centos to docker group
user:
name: centos
groups: docker
append: yes
become: yes
- name: send TERM signal to process with PID 1
shell: "kill -TERM 1"
become: yes
- name: Start Docker service
service:
name: docker
state: started
enabled: yes
become: yes
- name: Install Docker Module for Python
pip:
name: "docker"
# - name: Install required packages
# yum:
# pkg:
# - apt-transport-https
# - ca-certificates
# - curl
# - gnupg
# - software-properties-common
# - name: Add Docker GPG key
# apt_key:
# url: https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg
# id: 0EBFCD88
# state: present
# - name: Add Docker repository
# apt_repository:
# filename: docker
# repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release|lower }} stable
# update_cache: true
# - name: Create target directory
# file:
# path=/tmp/docker/
# state=directory
# mode=0755
# - name: Create target directory
# file:
# path=/etc/docker/
# state=directory
# mode=0755
# - name: configure docker network address, ahead of time, to solve issues with docker default network collision with UT VPN
# copy:
# dest: /etc/docker/daemon.json
# content: |
# {
# "default-address-pools": [{"base":"172.80.0.0/16","size":24}]
# }
# owner: root
# group: root
# mode: '0644'
# - name: Install docker-ce
# apt:
# name: docker-ce
# - name: Start and enable docker service
# service:
# name: docker
# enabled: true
# state: started
# when: ansible_os_family == "Debian"
text/plain
\ No newline at end of file
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