From 1ea564ab95125e28d2c693fdaa507cf1b289ea38 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 7 Feb 2022 10:20:24 +0100 Subject: [PATCH 1/2] Update install --- ansible_install.yaml | 14 ++++++++------ install.sh | 10 ++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ansible_install.yaml b/ansible_install.yaml index f84b2ffa1..ae218e5f2 100644 --- a/ansible_install.yaml +++ b/ansible_install.yaml @@ -38,13 +38,17 @@ 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,gcc,openssh-client,sshpass install_recommends=no - when: ansible_distribution == "Debian" or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 20) + apt: name=python3-pip,python3-dev install_recommends=no + when: ansible_python_version is version('3', '>=') - name: Debian/Ubuntu install python-pip with apt - apt: name=python-pip,python-dev,gcc,openssh-client,sshpass install_recommends=no - when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int < 20 + apt: name=python-pip,python-dev install_recommends=no + when: ansible_python_version is version('3', '<') - name: Apt install requirements Debian apt: name=default-libmysqlclient-dev @@ -85,14 +89,12 @@ pip: name: pip>18.0,<21.0 executable: "{{pip_exec}}" - extra_args: --prefer-binary when: ansible_python_version is version('3.6', '<') - name: Upgrade pip in py3.6 + pip: name: pip>18.0 executable: "{{pip_exec}}" - extra_args: --prefer-binary when: ansible_python_version is version('3.6', '>=') - name: Install setuptools with pip diff --git a/install.sh b/install.sh index 02ed9c0cf..81221179f 100755 --- a/install.sh +++ b/install.sh @@ -57,8 +57,9 @@ distribution_major_version() { } ansible_installed=`type -p ansible-playbook` +ansible3_installed=`type -p ansible-playbook-3` -if [ x${ansible_installed}x != "xx" ] +if [ x${ansible_installed}x != "xx" ] || [ x${ansible_installed3}x != "xx" ] then echo "Ansible installed. Do not install." else @@ -111,4 +112,9 @@ else fi echo "Call Ansible playbook to install the IM." -ansible-playbook ansible_install.yaml +if [ x${ansible3_installed}x != "xx" ] +then + ansible-playbook-3 ansible_install.yaml +else + ansible-playbook ansible_install.yaml +fi From 738772be29a9123f695b26ce3f9eac089102db06 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 7 Feb 2022 10:40:29 +0100 Subject: [PATCH 2/2] Update install --- ansible_install.yaml | 10 +++++----- install.sh | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ansible_install.yaml b/ansible_install.yaml index ae218e5f2..27406e84e 100644 --- a/ansible_install.yaml +++ b/ansible_install.yaml @@ -2,11 +2,11 @@ connection: local tasks: - name: Yum install epel-release - action: yum pkg=epel-release state=installed + command: yum install -y epel-release when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora" - name: Install libselinux-python in RH - action: yum pkg=libselinux-python state=installed + command: yum install -y libselinux-python when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora" ################################################ Configure Ansible ################################################### @@ -44,11 +44,11 @@ - name: Debian/Ubuntu install python3-pip with apt apt: name=python3-pip,python3-dev install_recommends=no - when: ansible_python_version is version('3', '>=') + 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_python_version is version('3', '<') + when: ansible_os_family == "Debian" and ansible_python_version is version('3', '<') - name: Apt install requirements Debian apt: name=default-libmysqlclient-dev @@ -67,7 +67,7 @@ when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int < 20 - name: Yum install requirements RH - yum: name=python3-pip,wget,openssh-clients,sshpass,gcc,python3-devel,mysql-devel + 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 diff --git a/install.sh b/install.sh index 81221179f..f1d96fe81 100755 --- a/install.sh +++ b/install.sh @@ -59,10 +59,8 @@ distribution_major_version() { ansible_installed=`type -p ansible-playbook` ansible3_installed=`type -p ansible-playbook-3` -if [ x${ansible_installed}x != "xx" ] || [ x${ansible_installed3}x != "xx" ] +if [ x${ansible_installed}x == "xx" ] && [ x${ansible3_installed}x == "xx" ] then - echo "Ansible installed. Do not install." -else echo "Ansible not installed. Installing ..." DISTRO=$(distribution_id) case $DISTRO in @@ -101,6 +99,8 @@ else echo "Unsupported distribution: $DISTRO" ;; esac +else + echo "Ansible installed. Do not install." fi if [ -f "ansible_install.yaml" ] @@ -112,6 +112,7 @@ else 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