Install python using Ansible

0 votes
How do I install python with Ansible?
Jul 22 in Python by Varsha
18 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 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,710 points
75 views
0 votes
2 answers

How can I install external binaries using portable python

0110100001000101001010101001011010100100111100101001 READ MORE

answered Jan 24 in Python by anonymous
108 views
0 votes
0 answers

How to install python modules using wheeling format?

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

Jun 21 in Python by Waseem
• 4,230 points
15 views
0 votes
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 1 day ago in Python by Arvind
• 2,600 points
15 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,380 points
112 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 in Python by Mohammad
• 3,060 points
45 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 in Python by Radhika
17 views