Skip to content
Snippets Groups Projects
Commit b513f0a6 authored by dehury's avatar dehury
Browse files

added new nodetype for DevOps course

parent 83fe1ae8
No related branches found
No related tags found
No related merge requests found
Showing
with 374 additions and 0 deletions
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
radon.nodes.VM.waldurOS:
metadata:
targetNamespace: "radon.nodes.VM"
abstract: "false"
final: "false"
attributes:
private_address:
type: string
public_ip:
type: string
public_address:
type: string
id:
type: string
properties:
flavor:
type: string
image:
type: string
floating_ip:
type: boolean
required: false
default: true
offering:
type: string
required: false
project:
type: string
required: false
networks:
type: string
description: e.g. devops-internal-pi-sub-net
required: false
system_volume_size:
type: string
vm_name:
type: string
description: name of the VM
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
- virtualenv
- 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"
\ 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.container:
metadata:
targetNamespace: "radon.nodes.docker"
abstract: "false"
final: "false"
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
radon.nodes.docker.containerNginx:
derived_from: radon.nodes.docker.DockerApplication
metadata:
targetNamespace: "radon.nodes.docker"
abstract: "false"
final: "false"
properties:
container_port:
type: string
required: false
default: 80
image_name:
type: string
container_name:
type: string
required: false
host_port:
type: string
required: false
default: 8080
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
operations:
stop:
description: The standard stop operation
start:
description: The standard start operation
create:
description: The standard create operation
inputs:
container_port:
type: string
required: true
default: { get_property: [ SELF, container_port ] }
image_name:
type: string
default: { get_property: [ SELF, image_name ] }
container_name:
type: string
required: true
default: { get_property: [ SELF, container_name ] }
host_port:
type: string
required: true
default: { get_property: [ SELF, host_port ] }
implementation:
primary: create
timeout: 0
configure:
description: The standard configure operation
delete:
description: The standard delete operation
artifacts:
create:
type: radon.artifacts.Ansible
file: create-centos.yaml
---
- name: create
hosts: all
gather_facts: true
become: true
become_method: sudo
tasks:
- name: Start container
docker_container:
name: "{{container_name}}"
image: "{{image_name}}"
ports:
- "{{host_port}}:{{container_port}}"
state: started
\ No newline at end of file
text/x-yaml
\ No newline at end of file
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
radon.nodes.waldur.WaldurPlatform:
metadata:
targetNamespace: "radon.nodes.waldur"
abstract: "false"
final: "false"
properties:
api:
type: string
description: Do not modify, you dont know what you are doing.
required: false
default: "https://api.etais.ee/api/"
token:
type: string
description: should be in the format "token 645hy" excluding double quote
required: false
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
radon.nodes.webserver.nginx:
metadata:
targetNamespace: "radon.nodes.webserver"
abstract: "false"
final: "false"
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