Ansible Quirks – 4

I was installing ansible on OpenSuSE Leap 42.3 machine and faced a problem with multiple python versions. I have both python 2.7 and python 3.4 installed on this machine. Python 2.7 is the default one.

I tried installed ansible with the usual pip install and was faced with an error related to setuptools (could not capture the error message). I upgraded my pip version to the latest one 10.0.1 and then installed ansible.

$ sudo pip install --upgrade pip
$ sudo pip install ansible

After that I ran an ansible-galaxy init command to create one of the roles and I was welcome with the error stating “Error: Ansible requires a minimum of Python2 version 2.6 or Python3 version 3.5. Current version: 3.4.6”. And I was wondering what happened because my default python version was 2.7.

The usual google search did not help me go anywhere. So I looked at the /usr/bin/ansible file and found that it was using python3 interpreter.

$ head -1 /usr/bin/ansible
#!/usr/bin/python3

I then checked the source of pip command and found the same thing.

$ head -1 /usr/bin/pip
#!/usr/bin/python3

So I looked at pip documentation on installing pip for python 2.7 and found this link which helped me with the command to install pip for the default version of python installed –

$ sudo python -m ensurepip --default-pip
Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages
Collecting pip
Installing collected packages: pip
Successfully installed pip-9.0.1

Now when I reinstalled ansible, it installed the correct python interpreter for my system.

$ sudo pip install ansible
Collecting ansible
  Cache entry deserialization failed, entry ignored
.....
.....
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ head -1 /usr/bin/pip /usr/bin/ansible
==> /usr/bin/pip <==
#!/usr/bin/python

==> /usr/bin/ansible <==
#!/usr/bin/python

Now when I upgraded pip it was for the default python version

$ sudo pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
    Successfully uninstalled pip-9.0.1
    Successfully installed pip-10.0.1
$ head -1 /usr/bin/pip /usr/bin/ansible
==> /usr/bin/pip  <==
#!/usr/bin/python

==> /usr/bin/ansible <==
#!/usr/bin/python</p>

In all probability all this was my fault and I think the pip which I upgraded in the beginning of this process may have been installed for python3 by me, otherwise I do not see any reason for all these issues.

Still I thought to share this entry, just in case someone can be helped.

 

Posted in Tips/Code Snippets | Tagged , | 1 Comment

Running Oracle 11g Release 2 (11.2.0.2) XE in Docker Container

In DockerCon2017 Oracle announced the availability of Oracle containers in the docker hub. This was a great step forward. I have been thinking of trying Oracle in docker from quite a while for some personal projects, but was not finding time to experiment. The availability of docker build files on github made this task easier. You would still need to download the Oracle Database files from OTN and place them in the prespecified directory.

I tried 11g R2 XE and it was successful. The instructions provided are quite decent so I am not going to explain everything here again.

I am running Docker 17.04.0-ce on OpenSuSe Leap 42.2. While building both 12c and 11gR2 containers I was getting “HEALTHCHECK Unknown flag error”. This is because  HEALTHCHECK option was made available in Docker 17.06 onwards. As suggested in this issue, I simply removed the following line from the Dockerfile.xe and then the image built flawlessly.

HEALTHCHECK --interval=1m --start-period=5m \
CMD [ "su", "-p", "oracle", "-c", "$ORACLE_BASE/$CHECK_DB_FILE > /dev/null || exit 1" ]

Following is the quick sequence of steps I followed to build the image and to test the connectivity using sqlplus from the container itself.

user01@mylaptop > ./buildDockerImage.sh -v 11.2.0.2 -x
user01@mylaptop > docker run --name oracle --shm-size=1g -p 1521:1521 -p 8080:8080 -e ORACLE_PWD=Passw0rd123 -v /home/user01/Documents/oradata:/u01/app/oracle/oradata oracle/database:11.2.0.2-xe
user01@mylaptop > docker stop oracle
user01@mylaptop > docker start oracle
user01@mylaptop > docker exec -it --user oracle oracle bash
bash-4.2$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Fri Feb 9 01:02:42 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> select sysdate from dual;

SYSDATE
---------
09-FEB-18

SQL>

Next I am planning to get a container running tomcat with ORDS on it. Stay tuned.

Posted in Containers, Databases | Tagged , | Leave a comment

Connecting to Oracle Database over SSH using SQLDeveloper 4.1

As a system administrator, I try to follow the principle of least privilege (minimal privilege). Therefore, in the systems I install, I block all incoming and outgoing ports by default and open only when needed.

While setting up Oracle XE on some machines, port 1521 usually needs to be open so that engineers can connect to the database on that port and perform their developmental work. If this port is blocked and only SSH port is opened in the local firewall, then SQL Developer 4.1 provides a facility to create SSH tunnel and allows connections over that secure tunnel.

Get Started

  • Launching SQL Developer 4.1, click on  the View > SSH menu to open up the SSH Connections panel.
  • In the SSH panel, right-click on the SSH Hosts and choose New SSH Host
  • Complete the SSH connections dialog –
    • Name – This is the connection name and can be anything which identifies the connection.
    • Host – This is the host name or IP address of the host where we are trying to establish the SSH connectivity.
    • Port – This is the port on which your SSH daemon listens to. By default the port is 22, but if your SysAdmin has changed this to something else, please put that value here.
    • If you use a SSH Key File to connect to the server, select the check box “Use key file” and then Browse and select the private key file which needs to be used to establish connection. In case you use password, the you can ignore this check box and during connection, you will be prompted for your password.
    • In order to tunnel the Oracle connections inside an SSH tunnel, you need to select the check box “Add a Local Port Forward”. I normally leave the values in the Name, Host and Port fields to default, but you can change them. If you change these values from Default, localhost and 1521 respectively, then please note it down as you will need to specify this host name and port number in the Oracle Database connections dialog box.

 

  • You can now right click on the SSH Host which you created and click on “Test” to test the connection.
  • After you see the success message, create a new connection for your Oracle database by providing your connection details as usual.
    • If you select the “Connection Type” as “Basic” from the drop-down, the only change would be you host name and port number in case you changed those while creating the SSH connection.
    • If you select the “Connection Type” as “SSH” from the drop down, you just select the Connection name which you created from the “Port Forward” drop down.

I hope this helps.

Posted in Databases | Tagged , | Leave a comment

Ansible Quirks – 3

I was running some playbook today and realise that the command line arguments of ansible-playbook do not behaves expected.

My playbook has the following defined –

remote_user: root

When I issued the following command, my expectation was that the remote user name would be considered as specified by the “-u” option

$ ansible-playbook -u centos -i '192.168.1.192,' play.yml

However, this does not happen and the playbook still tries to connect as the user defined in the yml file.

So, how do we override what is in the yml file through command line. The only way seems to be possible is using the -e or --extra-vars option as follows –

$ ansible-playbook -e "ansible_ssh_user=centos ansible_ssh_private_key_file=~/.ssh/db_hosts_id_rsa " -i '192.168.1.192,' play.yml

Posted in FLOSS, Tips/Code Snippets | Tagged , , | Leave a comment

Quantum Mechanics And Consciousness – A relation established

In the beginning there was classical mechanics propounding the corpuscular theory of matter and describing the motion of bodies under the influence of a system of forces. But this classical mechanics fails to describe the motion of sub-atomic particles and then Quantum Mechanics was born. Quantum Mechanics deals with mechanics of sub-atomic particles.

Moore’s Law and Quantum Computing

According to Moore’s law the number of transistors in a dense integrated circuit doubles every two years. This in-turn means that at some point of time the size of transistors will be equal to atomic size. When that happens, the laws governing modern day computers which are based on classical mechanics will not apply any more since classical mechanics do not deal with sub-atomic particles. At this point of time, what we would need is Quantum computers which are based on laws of quantum mechanics.

Bit and Qubit – Meaow

Schrodinger’s Cat is a thought experiment which simultaneously describes a cat as being dead or alive. If we put a cat in a box and somehow inject a poison in the box, we can not say with surety that the cat is alive or dead. At that moment the cat could be alive or dead. However, when we open the box we will find the cat in any one state – either alive or dead. This experiment shows that until a measurement is done there are multiple states possible (because the states do not get disturbed) and when the measurement is done all the states gets (disturbed) and superimposed into any one of the possible states.

A modern day computer is based on binary number system comprising of two states – 0 or 1. At any point of time any one of these states can be possible and we can easily find out which state it is. However, a quantum computer is based on Qubit or quantum bit. The laws of quantum mechanics allows a qubit to be in a state other than |0) and |1) (pronounced as ket 0 and ket 1, respectively). It can in-fact be a superimposition of both the states at the same time.

|Psi) = alpha|0) + beta|1)

(pronounced as ket psi = alpha ket 0 + beta ket 1)

This is also known as two-state quantum system.

Like there are logic gates in binary computers, there are quantum gates in the quantum computers. A description of all these gates will be beyond the scope of this post.

Quantum System Modelling

The Quantum and Nano Computing Virtual Centre at Dayalbagh Educational Institute has published various research papers with the International Journal of General Systems on this subject. In a paper published in 2011 on Graph-Theoretic Quantum System Modelling For Information / Computation Processing Circuits (GTQSM), the researchers have been able to generalized the graph-theoretic system modelling framework, which was until now used for classical (deterministic) systems, to quantum random systems. Further in the paper the researchers present various applications of GTQSM for quantum information/computation processing circuits. Among other applications of GTQSM presented in this paper, one of the interesting application which caught my attention was a substantive case of 3-port, 5-stage circuit for Quantum Teleportation. Quantum teleportation is a process by which quantum information can be transmitted (exactly, in principal) from one location to another.

GTQSM Linked With Microtubules in Brain – Is our brain a quantum computer?

Microtubules are intracellular structures that are responsible for various kinds of movements on all eukaryotic cells. Eukaryotic cells have a membrane bound nucleus, number of membrane bound organelles (such as mitochondria, chloroplasts, the endoplasmic reticulum, the Golgi apparatus, and lysosomes) and linear chromosomes. These microtubules are filamentous in nature and further made up of tubulin. These microtubules are formed by the polymerization of a dimer of two globular proteins, alpha and beta tubulin. (Side Note – Microtubules function in many essential cellular processes, including mitosis. Tubulin-binding drugs kill cancerous cells by inhibiting microtubule dynamics, which are required for DNA segregation and therefore cell division.)

Another research paper written in 2013 by the researchers at Quantum and Nano Computing Virtual Centre at Dayalbagh Educational Institute on Graph-theoretic quantum system modelling for neuronal microtubules as hierarchical clustered quantum Hopfield networks was published in the International Journal of General Systems in March 2014 . This paper presents an insight, otherwise difficult to gain, for the complex system of systems represented by clustered quantum Hopfield network, hQHN, through the application of GTQSM construct. This paper applies GTQSM in continuum of protein heterodimer tubulin molecules of self-assembling polymers, viz. microtubules in the brain as a holistic system of interacting components representing hierarchical clustered quantum Hopfield network, hQHN, of networks.

Look Ma, I found a link between Quantum Physics and Consciousness!

In my previous blog post “On The Origin of The Universe and Consciousness“, I mentioned that – “In the western perspective the focus is mostly on the outward and in the eastern tradition the focus is on the inwards. As a result of this the western approaches prefer scientific methods.” If we really wanted a scientific approach towards understanding consciousness then a study of human brain is a must. Quantum theories of consciousness are based on mathematical abstraction. The most promising theory in this area is Penrose-Hameroff Orch-OR (Orchestrated Objective Reduction) theory. The International Journal of General Systems have another research paper published in 2015 by researchers at Quantum and Nano Computing Virtual Centre at Dayalbagh Educational Institute. This paper on Modelling microtubules in the brain as n-qudit quantum Hopfield network and beyond presented the extension Penrose-Hameroff model to n-dimensional quantum states or n-qudits thus promising for even higher mathematical abstraction in modelling consciousness systems. This 2015 paper has recently been followed by another paper written in 2016 and published by International Journal of General Systems in April 2017. This paper – From n-qubit multi-particle quantum teleportation modelling to n-qudit contextuality based quantum teleportation and beyond expands the horizon by arguing for point-sized loops or fine-grained particles of nature, which have been rejected out of hand by string theorists. People familiar with Quantum Physics would know that it is not possible to have any particle smaller than Planck’s length, which is 1.6 x 10-35 m. Consequently, this is the length which has any sensible meaning in physics. The argument present in this paper for sizes smaller than Planck’s length is very interesting. Satsangi argues that finer-grained particles than Planck’s length 10−35 m may exist, although, they are not matter anymore. Further he says that why stop at degree of freedom of three? Why not pursue quantum odd-prime based units (qudit) with higher degree n such as 5, 7, 11, 13, 17 and so on till nth degree of freedom even tending to infinity. Satsangi says that it is unscientific to stop at Planck’s dimension, the particles have grown so subtle that we have not devised physical instruments to measure them. Further quoting from the paper (and it is explained in such simple terms that I can not simplify it further) –

“Similarly, on the large side, scientists are not able to consider more than 1010 light years, so they do not know what exists in space beyond 1010 light years. So they are limited deliberately on these counts, whereas mathematics which is part of science, shows that particles are there which are subtler, subtler and subtlest ones. They move to infinity, they are most subtle, they become very small or subtle when we are close to zero, infinity is the macrocosm problem. Scientists can neither access infinity, nor zero, but none would say mathematics is not part of science.

To make the scientific community see what the reality is, the best way forward seems to make them realize that their own mathematics shows that we have to tackle a problem with zero and infinity, since they are not admitting zero point loops.

….The whole basis is a mathematical construct, but naturally, what keeps them in disbelief and doubt their own discoveries is that they visualize that there will be very high temperatures characteristic of fusion reactor such as is present in the sun, which is part of the milky way galaxy where earth is located (as a planet). But they overlook this point that in that environment, what has to survive are these small particles, not the physical body that we possess, this body has to be given up much earlier. Physical body cannot withstand those temperatures. The spirit force as part of Hilbert vector space over a field of complex numbers, are what Roger Penrose says, why not, xy where both x and y are integers, instead of visualizing quantum odd-based prime units, i.e. qudits. These particles possess infinite capabilities mathematically and precisely. So for us, whether we look at it from the angle of modern fashion, or scientific faith or even fantasy, the picture is all very clear that the characterization in scientific space is the Hilbert vector space over a field of complex numbers, or a field of integers, or whatever you want to say in the same vein for that matter. And when you raise the power, the particles under consideration are infinitesimally small and they have infinitely large capabilities, so that is where they possess this characteristic of omniscience along with omnipresence and omnipotence. “

Conclusion

A very deep research is going on in the field of Quantum and Nano Computing, Quantum Information Systems and Consciousness atQuantum and Nano Computing Virtual Centre . Hopefully, we will eventually be able to reach to fully explain consciousness using scientific methods.

Posted in Views | Tagged , , | 1 Comment