Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## UNRELEASED

### NEW COMPONENTS

* Python VirtualEnv component ([GH-74](https://github.com/ystia/forge/issues/74))

### ENHANCEMENTS

* Add a vault in secured full stack topology ([GH-67](https://github.com/ystia/forge/issues/67))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A set of public TOSCA Types and Topology templates used by the Ystia project

## Documentation

See [our documentation for more details](https://github.com/ystia/forge/blob/develop/org/ystia/README.rst)
See [our documentation for more details](https://github.com/ystia/forge/blob/develop/org/ystia/README.rst).

## Downloads

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions org/ystia/python/virtualenv/linux/ansible/playbooks/create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

#
# Copyright 2019 Bull S.A.S. Atos Technologies - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
#
# 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 python requirements
hosts: all
become: true
vars:
pip_extra_args: ""
tasks:
- name: Install pip
easy_install:
name: pip
state: latest

- name: Install 'virtualenv' package
pip:
name: virtualenv
state: latest

- name: Set virtualenv path
set_fact:
VIRTUAL_ENV_PATH: "/usr/local/py-env-{{NODE}}"

- name: Force installation of at least one package
set_fact:
PACKAGES: ["pip"]
when: PACKAGES  | length == 0

- name: Set alternate pip index url
set_fact:
pip_extra_args: "-i {{PIP_INDEX_URL}}"
when: PIP_INDEX_URL is defined and PIP_INDEX_URL  | length > 0

- name: Dumping packages to install
debug:
var: PACKAGES

- name: Install python packages
pip:
name: "{{PACKAGES}}"
extra_args: "{{pip_extra_args}}"
virtualenv: "{{ VIRTUAL_ENV_PATH }}"
virtualenv_python: "python{{VERSION}}"
24 changes: 24 additions & 0 deletions org/ystia/python/virtualenv/linux/ansible/playbooks/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright 2019 Bull S.A.S. Atos Technologies - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
#
# 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: Delete python virtualenv
hosts: all
become: true
tasks:
- name: "Delete {{VIRTUAL_ENV_PATH}}"
file:
path: "{{VIRTUAL_ENV_PATH}}"
state: absent
65 changes: 65 additions & 0 deletions org/ystia/python/virtualenv/linux/ansible/types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
tosca_definitions_version: alien_dsl_2_0_0

#
# Ystia Forge
# Copyright (C) 2018 Bull S. A. S. - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
#

metadata:
template_name: org.ystia.python.virtualenv.linux.ansible
template_version: 2.2.0-SNAPSHOT
template_author: Ystia

description: Python VirtualEnv for linux system

imports:
- tosca-normative-types:1.0.0-ALIEN20
- yorc-types:1.0.0
- org.ystia.python.pub:2.2.0-SNAPSHOT


node_types:
org.ystia.python.virtualenv.linux.ansible.nodes.Python:
derived_from: tosca.nodes.SoftwareComponent
description: Python in a virtualenv component for linux
tags:
icon: /images/python-logo.png
properties:
component_version:
type: version
description: The installed Python version should be the version of the python executable eg 3.5 for python3.5
default: 2.7
packages:
type: list
entry_schema:
type: string
description: Install additionnal package
required: false
pip_index_url:
type: string
description: >
allows to set a custom index url for pip.
This allows offline installations for instance.
default: ""
required: false
attributes:
virtualenv_path: { get_operation_output: [SELF, Standard, create, VIRTUAL_ENV_PATH] }
capabilities:
python_host:
type: org.ystia.python.pub.capabilities.PythonHosting
occurrences: [0,unbounded]
interfaces:
Standard:
create:
inputs:
VERSION: { get_property: [SELF, component_version] }
PACKAGES: { get_property: [SELF, packages] }
PIP_INDEX_URL: { get_property: [SELF, pip_index_url] }
implementation: playbooks/create.yaml
delete:
inputs:
VIRTUAL_ENV_PATH: { get_attribute: [SELF, virtualenv_path] }
implementation: playbooks/delete.yaml