Install python using Ansible

0 votes
How do I install python with Ansible?
Jul 22, 2019 in Python by Varsha
1,946 views

1 answer to this question.

0 votes

Try something like:

- hosts: all
  remote_user: root
  gather_facts: false
  tasks:

  - name: Check for Python
      raw: test -e /usr/bin/python
      changed_when: false
      failed_when: false
      register: check_python

 - name: Install Python
      raw: yum -y install python
      when: check_python.rc != 0

It basically checks I python is already installed. If it hasn't it will install it. The task, in this case, installs python on CentOs or Ubuntu using yum.

answered Jul 22, 2019 by Travis

Related Questions In Python

0 votes
1 answer

How to install Python MySQLdb module using pip?

It's easy to do, but hard to ...READ MORE

answered Aug 20, 2018 in Python by charlie_brown
• 7,780 points
180 views
0 votes
2 answers

How can I install external binaries using portable python

0110100001000101001010101001011010100100111100101001 READ MORE

answered Jan 24, 2019 in Python by anonymous
481 views
0 votes
0 answers

How to install python modules using wheeling format?

Can you show the installation of pyaudio ...READ MORE

Jun 21, 2019 in Python by Waseem
• 4,540 points
66 views
+1 vote
1 answer

How to install tensorflow using anaconda and python 3.7.1 on windows?

Since I am using python 3.5 so ...READ MORE

answered Aug 19, 2019 in Python by Arvind
• 2,980 points
4,247 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,420 points
594 views
0 votes
1 answer
0 votes
1 answer

How can I write a program to add two numbers using functions in python?

def add(a,b):      return a + b #when i call ...READ MORE

answered May 20, 2019 in Python by Mohammad
• 3,210 points
6,309 views
0 votes
1 answer

How do I create 3 X 4 array of random numbers between 0 and 100 using python?

Use numpy in the following manner: np.random.rand(3,4)*100 When you ...READ MORE

answered May 24, 2019 in Python by Radhika
68 views