Import the old role.

This commit is contained in:
Andrea Dell'Amico 2020-08-11 19:15:47 +02:00
parent 3843ea13ff
commit adce6d02ad
4 changed files with 64 additions and 67 deletions

View File

@ -1,31 +1,26 @@
Role Name Role Name
========= =========
A brief description of the role goes here. A role that fixes somewhat the python2 installation on Ubuntu Trusty and installs python 2 packages from pip eventually
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables Role Variables
-------------- --------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. The most important variables are listed below:
``` yaml
py_env_install: False
py_env_pkgs_state: present
py_env_site: False
py_env_basic_pkgs:
- python-pip
```
Dependencies Dependencies
------------ ------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. None
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License License
------- -------
@ -35,4 +30,4 @@ EUPL-1.2
Author Information Author Information
------------------ ------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed). Andrea Dell'Amico, <andrea.dellamico@isti.cnr.it>

View File

@ -1,2 +1,8 @@
--- ---
# defaults file for ansible-role-template py_env_install: False
py_env_pkgs_state: present
py_env_site: False
py_env_basic_pkgs:
- python-pip

View File

@ -1,61 +1,25 @@
galaxy_info: galaxy_info:
author: your name author: Andrea Dell'Amico
description: your description description: Systems Architect
company: ISTI-CNR company: ISTI-CNR
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning
# Some suggested licenses: license: EUPL 1.2+
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: EUPL-1.2
min_ansible_version: 2.8 min_ansible_version: 2.8
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit: # To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/ # https://galaxy.ansible.com/api/v1/platforms/
# #
# platforms: platforms:
# - name: Fedora - name: Ubuntu
# versions: versions:
# - all - trusty
# - 25 - bionic
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: [] galaxy_tags:
# List tags for your role here, one per line. A tag is a keyword that describes - python
# and categorizes the role. Users find roles by searching for tags. Be sure to - python2
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: [] dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -1,2 +1,34 @@
--- ---
# tasks file for ansible-role-template - block:
- name: Install python pip
apt: name={{ py_env_basic_pkgs | default([]) }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600
when:
- py_env_install | bool
- ansible_facts['distribution_version'] is version('16.04', '>=')
tags: [ "python", "py_env" ]
- block:
- name: Remove python deb packages
apt: name={{ py_env_dpkg_toremove | default([]) }} state=absent
when: py_env_install | bool
tags: [ "python", "py_env", "py_env_pkgs" ]
- block:
- name: Install deb packages needed to compile the pip modules
apt: name={{ py_pip_deps | default([]) }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600
- name: Install a list of versioned pip packages
pip: name={{ item.pkg }} version={{ item.version }}
with_items: '{{ py_env_versioned_pip_pkgs | default ([]) }}'
- name: Install a list of pip packages
pip: name={{ py_env_pip_pkgs | default ([]) }} state=latest
- name: Install python deb packages
apt: name={{ py_env_dpkg | default([]) }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600
when: py_env_install | bool
tags: [ "python", "py_env", "py_env_pkgs" ]