Install python using Ansible

0 votes
How do I install python with Ansible?
Jul 22, 2019 in Python by Varsha
4,934 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

I want to perform similar task on Windows. Any suggestions ?

Hi,

Ansible has modules for the Windows system as well. You can find all the modules for the Windows system that is available for the Linux system.

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
488 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
828 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
172 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
• 3,020 points
6,722 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,327 views
+2 votes
1 answer
0 votes
2 answers

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

there is sum() function as a built ...READ MORE

answered Oct 25, 2020 in Python by anonymous
17,559 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
577 views