sodafoundation / installer

provides easy installation and basic deployment based on specific configurations for SODA Projects
Apache License 2.0
35 stars 68 forks source link

Installer installing wrong version of ansible #323

Open PravinRanjan10 opened 4 years ago

PravinRanjan10 commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

If i select backend as ceph, and the ceph version is stable-3.1, ansible verion should be 2.4.x But at the end it is always installing ansible 2.5.1 version.(Which should not). Our script is identifying that, ansible 2.4 should be installed but at end installing 2.5.1 version.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

PravinRanjan10 commented 4 years ago

oot@root1-Latitude-E7450:~/opensds-installer/ansible# chmod +x ./install_ansible.sh && ./install_ansible.sh Reading...: /root/opensds-installer/ansible/group_vars/osdsdock.yml Installing ansible 2.4 required for ceph-ansible stable-3.1 branch. . . .

After this operation, 26.9 MB of additional disk space will be used. Selecting previously unselected package ansible. (Reading database ... 213240 files and directories currently installed.) Preparing to unpack .../ansible_2.5.1+dfsg-1ubuntu0.1_all.deb ... Unpacking ansible (2.5.1+dfsg-1ubuntu0.1) ... Setting up ansible (2.5.1+dfsg-1ubuntu0.1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... ansible 2.5.1 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.15+ (default, Oct 7 2019, 17:39:04) [GCC 7.4.0] root@root1-Latitude-E7450:~/opensds-installer/ansible# root@root1-Latitude-E7450:/opensds-installer/ansible# ansible --version ansible 2.5.1 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.15+ (default, Oct 7 2019, 17:39:04) [GCC 7.4.0]

PravinRanjan10 commented 4 years ago

@joseph-v

thatsdone commented 4 years ago

Hi @PravinRanjan10,

Two questions.

Q1. Do you have NON snipped version terminal log? install_ansible.sh shows the ppa repository being used like the bottom.

Q2. Which Ubuntu version are you using? Xenial? or Bionic?

install_ansible.sh executes apt commands like below:

# incorrect version removed, or no ansible found.
echo Installing ansible ${REQUIRED_ANSIBLE_VER} required for ceph-ansible ${CEPH_ANSIBLE_BRANCH} branch.
sudo add-apt-repository -y ppa:ansible/ansible-${REQUIRED_ANSIBLE_VER}
sudo apt-get update
sudo apt-get install -y ansible
sleep 3
sudo add-apt-repository -y -r ppa:ansible/ansible-${REQUIRED_ANSIBLE_VER}

In this case, REQUIRED_ANSIBLE_VER is '2.4', so this is strange.

But, according to the ansible official ppa site information:

https://launchpad.net/~ansible/+archive/ubuntu/ansible-2.4

I guess now ansible 2.5 could be installed in case of Bionic. Please note that install_ansible.sh was tested under Xenial. But, anyway this is an issue to be fixed. You can assign me to this issue.

Terminal log of 'install_ansible.sh'on Ubuntu Xenial in my lab.

ubuntu@ubuntu201:~/opensds-installer/ansible$ bash install_ansible.sh
Reading...: /home/ubuntu/opensds-installer/ansible/group_vars/osdsdock.yml
Installing ansible 2.4 required for ceph-ansible stable-3.1 branch.
gpg: keyring `/tmp/tmpmnqv52j0/secring.gpg' created
gpg: keyring `/tmp/tmpmnqv52j0/pubring.gpg' created
gpg: requesting key 7BB9C367 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpmnqv52j0/trustdb.gpg: trustdb created
gpg: key 7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:2 http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial InRelease [18.0
 kB]
Hit:3 http://nova.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:5 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:6 http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial/main amd64 Pack
ages [540 B]
Get:7 http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial/main Translatio
n-en [344 B]
Fetched 18.9 kB in 1s (9,741 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
(snip)
PravinRanjan10 commented 4 years ago

@thatsdone, The detail of machine is below: Distributor ID: Ubuntu Description: Ubuntu 18.04.3 LTS Release: 18.04 Codename: bionic

As per discussion, please take a look

thatsdone commented 4 years ago

@PravinRanjan10

Hi, I figured out the root cause and a quick workaround.

This issue comes from the default distro bundled version of ansible. Ubuntu bionic bundles ansible 2.5 series, and we need to specify exact version when we want to use a downgraded version like below.

ubuntu@ubuntu203:~/opensds-installer/ansible$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

ubuntu@ubuntu203:~/opensds-installer/ansible$ sudo add-apt-repository -y ppa:ansible/ansible-2.4
  (snip)
ubuntu@ubuntu203:~/opensds-installer/ansible$ sudo apt-get -y install ansible=2.4.6.0-1ppa~bionic
Reading package lists... Done
Building dependency tree
Reading state information... Done
  (snip)
Setting up ansible (2.4.6.0-1ppa~bionic) ...
ubuntu@ubuntu203:~/opensds-installer/ansible$
ubuntu@ubuntu203:~/opensds-installer/ansible$ ansible --version
ansible 2.4.6.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/ubuntu/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Nov  7 2019, 10:07:09) [GCC 7.4.0]
ubuntu@ubuntu203:~/opensds-installer/ansible$

I don't think this is the reason why you got #326 , but anyway I will update 'install_ansible.sh' soon.

Here is a (manual) workaround procedure.

  1. Identify your preferred ansible verson.
    • In your case, it should be 2.4
  2. Add appropriate ppa repository.
    • `sudo add-apt-repository -y ppa:ansible/ansible-2.4
  3. run apt-get update
  4. check the package version
    • apt-cache showpkg ansible | grep 2.4
    • Now the up-to-date ppa version of 2.4 series seems to be '2.4.6.0-1ppa~bionic'
  5. Install the exact version ansible by specifying package version above.
    • sudo apt-get -y install ansible=2.4.6.0-1ppa~bionic
  6. Check version of the installed ansible
    • ansible --version

Regards,

thatsdone commented 4 years ago

Sorry for my (very) late action. I created a PR for this issue.

kumarashit commented 4 years ago

@PravinRanjan10