diff --git a/README.md b/README.md index f20eb6a9e..9f9584f36 100644 --- a/README.md +++ b/README.md @@ -181,40 +181,34 @@ connector. It is available as the package ``pyvmomi`` at the pip repository. ### 3.3 INSTALLING -#### 3.3.1 Using installer (Recommended option) - -The IM provides a script to install the IM in one single step (using pip). -You only need to execute the following command: - -```sh -$ wget -qO- https://raw.githubusercontent.com/grycap/im/master/install.sh | bash -``` - -It works for the most recent version of the main Linux distributions (RHEL, CentOS, Fedora, Ubuntu, Debian). -In case that you O.S. does not work with this install script see next sections. - -#### 3.3.2 From PIP +#### 3.3.1 From PIP First you need to install pip tool and some packages needed to compile some of the IM requirements. To install them in Debian and Ubuntu based distributions, do:: ```sh $ apt update -$ apt install gcc python-dev libffi-dev libssl-dev python-pip sshpass python-pysqlite2 +$ apt install -y gcc python3-dev libffi-dev libssl-dev python3-pip sshpass default-libmysqlclient-dev ``` In Red Hat based distributions (RHEL, CentOS, Amazon Linux, Oracle Linux, Fedora, etc.), do: ```sh -$ yum install epel-release -$ yum install which gcc python-devel libffi-devel openssl-devel python-pip sshpass python-sqlite3dbm +$ yum install -y epel-release +$ yum install -y which gcc python3-devel libffi-devel openssl-devel python3-pip sshpass ``` Then you only have to call the install command of the pip tool with the IM package: ```sh -$ pip install IM +$ pip3 install IM +``` + +You can also install an specific branch of the Github repository: + +```sh +$ pip install git+https://github.com/grycap/im.git@master ``` Pip will also install the, non installed, pre-requisites needed. So Ansible 2.4 or later will @@ -224,86 +218,6 @@ of IM features that you need requires to install some of the packages of section You must also remember to modify the ansible.cfg file setting as specified in the REQUISITES section. -#### 3.3.3 From System packages - -This option is not recommended as in most of the cases some packages will not have the last version, -so part of the IM functionality may not be available. - -##### 3.3.3.1 From RPM packages (RH7) - -Download the RPM package from [GitHub](https://github.com/grycap/im/releases/latest). -Also remember to download the RPMs of the RADL and TOSCA parser packages from its corresponding GitHub repositories: [RADL](https://github.com/grycap/radl/releases/latest) and [TOSCA parser](https://github.com/indigo-dc/tosca-parser/releases/latest). - - -You must have the epel repository enabled: - -```sh -$ yum install epel-release -``` - -Then install the downloaded RPMs: - -```sh -$ yum localinstall IM-*.rpm RADL-*.rpm -``` - -Azure python SDK is not available in CentOS. So if you need the Azure plugin you have to manually install them using pip as -shown in the OPTIONAL PACKAGES section. - - -##### 3.3.3.2 From Deb package (Tested with Ubuntu 14.04, 16.04 and 18.04) - -Download the Deb package from [GitHub](https://github.com/grycap/im/releases/latest). -Also remember to download the Debs of the RADL and TOSCA parser packages from its corresponding GitHub repositories: [RADL](https://github.com/grycap/radl/releases/latest) and [TOSCA parser](https://github.com/indigo-dc/tosca-parser/releases/latest). - - -In Ubuntu 14.04 there are some requisites not available for the "trusty" version or are too old, so you have to manually install them manually. -You can download it from their corresponding PPAs. But here you have some links: - - * python-backports.ssl-match-hostname: [download](http://archive.ubuntu.com/ubuntu/pool/universe/b/backports.ssl-match-hostname/python-backports.ssl-match-hostname_3.4.0.2-1_all.deb) - * python-scp: [download](http://archive.ubuntu.com/ubuntu/pool/universe/p/python-scp/python-scp_0.10.2-1_all.deb) - * python-libcloud: [download](http://archive.ubuntu.com/ubuntu/pool/universe/libc/libcloud/python-libcloud_2.2.1-1_all.deb) - * python-xmltodict: [download](http://archive.ubuntu.com/ubuntu/pool/universe/p/python-xmltodict/python-xmltodict_0.11.0-1_all.deb) - -Also Azure python SDK is not available in Ubuntu 16.04. So if you need the Azure plugin you have to manually install them. -You can download it from their corresponding PPAs. But here you have some links: - - * python-msrestazure: [download](https://launchpad.net/ubuntu/+archive/primary/+files/python-msrestazure_0.4.3-1_all.deb) - * python-msrest: [download](https://launchpad.net/ubuntu/+archive/primary/+files/python-msrest_0.4.4-1_all.deb) - * python-azure: [download](https://launchpad.net/ubuntu/+archive/primary/+files/python-azure_2.0.0~rc6+dfsg-2_all.deb) - -It is also recommended to configure the Ansible PPA to install the newest versions of Ansible (see [Ansible installation](http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu)): - -```sh -$ sudo apt-get install software-properties-common -$ sudo apt-add-repository ppa:ansible/ansible -$ sudo apt-get update -``` - -Put all the .deb files in the same directory and do:: - -```sh -$ sudo dpkg -i *.deb -$ sudo apt install -f -y -``` - -#### 3.3.4 FROM SOURCE - -Select a proper path where the IM service will be installed (i.e. /usr/local/im, -/opt/im or other). This path will be called IM_PATH - -```sh -$ tar xvzf IM-X.XX.tar.gz -$ chown -R root:root IM-X.XX -$ mv IM-X.XX /usr/local -``` - -Finally you must copy (or link) $IM_PATH/scripts/im file to /etc/init.d directory. - -```sh -$ ln -s /usr/local/im/scripts/im /etc/init.d/im -``` - ### 3.4 START IM ON BOOT In case that you want the IM service to be started at boot time, you must diff --git a/ansible_install.yaml b/ansible_install.yaml deleted file mode 100644 index ff0b958fe..000000000 --- a/ansible_install.yaml +++ /dev/null @@ -1,132 +0,0 @@ -- hosts: localhost - connection: local - tasks: - - name: Yum install epel-release - command: yum install -y epel-release - when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora" - - - name: Install libselinux-python in RH - command: yum install -y libselinux-python - when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora" - -################################################ Configure Ansible ################################################### - - - name: Create /etc/ansible - file: path=/etc/ansible state=directory - - - name: Set host_key_checking to false in ansible.cfg - ini_file: dest=/etc/ansible/ansible.cfg section=defaults option=host_key_checking value=False - - - name: Set nocolor to 1 in ansible.cfg to avoid strange chars in Ansible outputs - ini_file: dest=/etc/ansible/ansible.cfg section=defaults option=nocolor value=1 - - - name: Set timeout to 30 in ansible.cfg to avoid problems with some VMs - ini_file: dest=/etc/ansible/ansible.cfg section=defaults option=timeout value=30 - - - name: Set transport to ssh in ansible.cfg - ini_file: dest=/etc/ansible/ansible.cfg section=defaults option=transport value=ssh - - - name: Change ssh_args to set ControlPersist to 15 min in ansible.cfg - ini_file: dest=/etc/ansible/ansible.cfg section=ssh_connection option=ssh_args value="-o ControlMaster=auto -o ControlPersist=900s" - - - name: Activate SSH pipelining in ansible.cfg - ini_file: dest=/etc/ansible/ansible.cfg section=ssh_connection option=pipelining value=True - -################################################ Install IM ################################################### - - - name: Apt-get update - apt: update_cache=yes cache_valid_time=3600 - when: ansible_os_family == "Debian" - - - name: Debian/Ubuntu install requisites - apt: name=gcc,openssh-client,sshpass install_recommends=no - when: ansible_os_family == "Debian" - - - name: Debian/Ubuntu install python3-pip with apt - apt: name=python3-pip,python3-dev install_recommends=no - when: ansible_os_family == "Debian" and ansible_python_version is version('3', '>=') - - - name: Debian/Ubuntu install python-pip with apt - apt: name=python-pip,python-dev install_recommends=no - when: ansible_os_family == "Debian" and ansible_python_version is version('3', '<') - - - name: Apt install requirements Debian - apt: name=default-libmysqlclient-dev - when: ansible_distribution == "Debian" or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 20) - - - name: Assure that my_config.h exists - file: - path: /usr/include/mysql/my_config.h - state: touch - mode: '0644' - ignore_errors: yes - when: ansible_distribution == "Debian" - - - name: Apt install requirements Ubuntu - apt: name=libmysqld-dev - when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int < 20 - - - name: Yum install requirements RH - command: yum install -y python3-pip wget openssh-clients sshpass gcc python3-devel mysql-devel - when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora" - - - name: Yum install requirements Fedora - yum: name=python3-pip,redhat-rpm-config,wget,openssh-clients,sshpass,gcc,python3-devel,mysql-devel - when: ansible_distribution == "Fedora" - - - name: Set pip3 - set_fact: - pip_exec: pip3 - when: ansible_python_version is version('3', '>=') - - - name: Set pip2 - set_fact: - pip_exec: pip2 - when: ansible_python_version is version('3', '<') - - # Version over 21 does not work with python 3.5 or older - - name: Upgrade pip in py3.5 - pip: - name: pip>18.0,<21.0 - executable: "{{pip_exec}}" - when: ansible_python_version is version('3.6', '<') - - - name: Upgrade pip in py3.6 + - pip: - name: pip>18.0 - executable: "{{pip_exec}}" - when: ansible_python_version is version('3.6', '>=') - - - name: Install setuptools with pip - pip: - name: setuptools,six - executable: "{{pip_exec}}" - extra_args: "-I" - - - name: Install cryptography - pip: - name: cryptography<3.3 - executable: "{{pip_exec}}" - extra_args: --prefer-binary - - - name: Install pyOpenSSL - pip: - name: pyOpenSSL>20.0 - executable: "{{pip_exec}}" - extra_args: --prefer-binary - - - name: Install Azure pip libraries - pip: - name: msrest,msrestazure,azure-common,azure-mgmt-storage,azure-mgmt-compute,azure-mgmt-network,azure-mgmt-resource,azure-mgmt-dns - executable: "{{pip_exec}}" - - - name: Install pip libraries - pip: - name: mysqlclient,xmltodict,cheroot,pymongo - executable: "{{pip_exec}}" - - - name: Install IM - pip: - name: IM - executable: "{{pip_exec}}" - diff --git a/doc/source/manual.rst b/doc/source/manual.rst index b2daca4ac..53cab5cb1 100644 --- a/doc/source/manual.rst +++ b/doc/source/manual.rst @@ -104,16 +104,6 @@ Optional Packages Installation ------------ -Using installer (Recommended option) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The IM provides a script to install the IM in one single step (using pip). -You only need to execute the following command:: - - $ wget -qO- https://raw.githubusercontent.com/grycap/im/master/install.sh | bash - -It works for the most recent version of the main Linux distributions (RHEL, CentOS, Fedora, Ubuntu, Debian). -In case that you O.S. does not work with this install script see next sections. - From Pip ^^^^^^^^ @@ -121,18 +111,22 @@ First you need to install pip tool and some packages needed to compile some of t To install them in Debian and Ubuntu based distributions, do:: $ apt update - $ apt install gcc python-dev libffi-dev libssl-dev python-pip sshpass python-pysqlite2 python-requests + $ apt install gcc python3-dev libffi-dev libssl-dev python3-pip sshpass python-pysqlite2 python-requests In Red Hat based distributions (RHEL, CentOS, Amazon Linux, Oracle Linux, Fedora, etc.), do:: $ yum install epel-release - $ yum install which gcc python-devel libffi-devel openssl-devel python-pip sshpass python-sqlite3dbm + $ yum install which gcc python3-devel libffi-devel openssl-devel python3-pip sshpass default-libmysqlclient-dev Then you only have to call the install command of the pip tool with the IM package:: $ pip install IM +You can also install an specific branch of the Github repository:: + + $ pip install git+https://github.com/grycap/im.git@master + Pip will also install the, non installed, pre-requisites needed. So Ansible 2.4 or later will be installed in the system. Some of the optional packages are also installed please check if some of IM features that you need requires to install some of the packages of section "Optional Packages". @@ -140,68 +134,6 @@ of IM features that you need requires to install some of the packages of section You must also remember to modify the ansible.cfg file setting as specified in the "Prerequisites" section. -From RPM packages (RH7) -^^^^^^^^^^^^^^^^^^^^^^^ -Download the RPM package from `GitHub `_. -Also remember to download the RPM of the RADL package also from `GitHub `_. -You must have the epel repository enabled:: - - $ yum install epel-release - -Then install the downloaded RPMs:: - - $ yum localinstall IM-*.rpm RADL-*.rpm - -Azure python SDK is not available in CentOS. So if you need the Azure plugin you have to manually install them using pip:: - - $ pip install msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns - -From Deb package (Tested with Ubuntu 14.04 and 16.04) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Download the Deb package from `GitHub `_ -Also remember to download the Deb of the RADL package also from `GitHub `_. - -In Ubuntu 14.04 there are some requisites not available for the "trusty" version or are too old, so you have to manually install them manually. -You can download it from their corresponding PPAs. But here you have some links: - - * python-backports.ssl-match-hostname: `download `_ - * python-scp: `download `_ - * python-libcloud: `download `_ - * python-xmltodict: `download `_ - -Also Azure python SDK is not available in Ubuntu 16.04. So if you need the Azure plugin you have to manually install them. -You can download it from their corresponding PPAs. But here you have some links: - - * python-msrestazure: `download `_ - * python-msrest: `download `_ - * python-azure: `download `_ - -It is also recommended to configure the Ansible PPA to install the newest versions of Ansible (see `Ansible installation `_):: - - $ sudo apt-get install software-properties-common - $ sudo apt-add-repository ppa:ansible/ansible - $ sudo apt-get update - -Put all the .deb files in the same directory and do:: - - $ sudo dpkg -i *.deb - $ sudo apt install -f -y - -From Source -^^^^^^^^^^^ - -Once the dependences are installed, just download the tarball of *IM Service* -from `Download `_, extract the -content and move the extracted directory to the installation path (for instance -:file:`/usr/local` or :file:`/opt`):: - - $ tar xvzf IM-0.1.tar.gz - $ sudo chown -R root:root IM-0.1.tar.gz - $ sudo mv IM-0.1 /usr/local - -Finally you must copy (or link) $IM_PATH/scripts/im file to /etc/init.d directory:: - - $ sudo ln -s /usr/local/IM-0.1/scripts/im /etc/init.d Configuration ------------- diff --git a/install.sh b/install.sh deleted file mode 100755 index f1d96fe81..000000000 --- a/install.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -distribution_id() { - RETVAL="" - if [ -z "${RETVAL}" -a -e "/etc/os-release" ]; then - . /etc/os-release - RETVAL="${ID}" - fi - - if [ -z "${RETVAL}" -a -e "/etc/centos-release" ]; then - RETVAL="centos" - fi - - if [ -z "${RETVAL}" -a -e "/etc/fedora-release" ]; then - RETVAL="fedora" - fi - - if [ -z "${RETVAL}" -a -e "/etc/redhat-release" ]; then - RELEASE_OUT=$(head -n1 /etc/redhat-release) - case "${RELEASE_OUT}" in - Red\ Hat\ Enterprise\ Linux*) - RETVAL="rhel" - ;; - CentOS*) - RETVAL="centos" - ;; - Fedora*) - RETVAL="fedora" - ;; - esac - fi - - if [ -z "${RETVAL}" ]; then - RETVAL="unknown" - fi - - echo ${RETVAL} -} - -distribution_major_version() { - if [ -f /etc/lsb-release ]; then - . /etc/lsb-release - echo ${DISTRIB_RELEASE} | sed -e 's|\([0-9]\+\)\([0-9.]*\).*|\1|' - else - for RELEASE_FILE in /etc/system-release \ - /etc/centos-release \ - /etc/fedora-release \ - /etc/redhat-release - do - if [ -e "${RELEASE_FILE}" ]; then - RELEASE_VERSION=$(head -n1 ${RELEASE_FILE}) - break - fi - done - echo ${RELEASE_VERSION} | sed -e 's|\(.\+\) release \([0-9]\+\)\([0-9.]*\).*|\2|' - fi -} - -ansible_installed=`type -p ansible-playbook` -ansible3_installed=`type -p ansible-playbook-3` - -if [ x${ansible_installed}x == "xx" ] && [ x${ansible3_installed}x == "xx" ] -then - echo "Ansible not installed. Installing ..." - DISTRO=$(distribution_id) - case $DISTRO in - debian) - apt-get update - apt-get -y install gnupg wget - echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" >> /etc/apt/sources.list - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 - apt-get update - apt-get -y install ansible - ;; - ubuntu) - apt-get update - if [ $(distribution_major_version) -ge "20" ] - then - apt-get -y install wget ansible - else - apt-get -y install software-properties-common - apt-add-repository -y ppa:ansible/ansible - apt-get update - apt-get -y install wget ansible - fi - ;; - rhel) - yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-$(distribution_major_version).noarch.rpm - yum install -y wget ansible-python3 - ;; - centos) - yum install -y epel-release wget - yum install -y ansible-python3 - ;; - fedora) - yum install -y wget ansible-python3 yum - ;; - *) - echo "Unsupported distribution: $DISTRO" - ;; - esac -else - echo "Ansible installed. Do not install." -fi - -if [ -f "ansible_install.yaml" ] -then - echo "ansible_install.yaml file present. Do not download." -else - echo "Downloading ansible_install.yaml file from github." - wget http://raw.githubusercontent.com/grycap/im/master/ansible_install.yaml -fi - -echo "Call Ansible playbook to install the IM." -ansible3_installed=`type -p ansible-playbook-3` -if [ x${ansible3_installed}x != "xx" ] -then - ansible-playbook-3 ansible_install.yaml -else - ansible-playbook ansible_install.yaml -fi diff --git a/setup.py b/setup.py index 43650084e..a94e97b1e 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ long_description_content_type=long_desc_type, description="IM is a tool to manage virtual infrastructures on Cloud deployments", platforms=["any"], - install_requires=["ansible >= 2.4", "paramiko >= 1.14", "PyYAML", suds_pkg, sqlite_pkg, "cheroot", + install_requires=["ansible >=2.4,<2.9.27", "paramiko >= 1.14", "PyYAML", suds_pkg, sqlite_pkg, "cheroot", "boto >= 2.29", "apache-libcloud >= 3.2.0", "RADL >= 1.1.5", "bottle", "netaddr", "requests >= 2.19", "scp", "tosca-parser", 'defusedxml', 'urllib3>=1.23', 'hvac'] )