-
Notifications
You must be signed in to change notification settings - Fork 1
/
CentOS7x_Install-Python3x-via-Source-playbook.yml
53 lines (40 loc) · 2.02 KB
/
CentOS7x_Install-Python3x-via-Source-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
################################################################################
# description: Installs Python 3x programming language via source on CentOS7x
# usage: ansible-playbook CentOS7x_Install-Python3x-via-Source-playbook.yml --extra-vars 'HostOrGroup=YourServerOrGroupNameGoesHere'
# author: Ernest G. Wilson II <[email protected]> (https://github.com/ernestgwilsonii)
# license: MIT
################################################################################
# Ansible Playbook options
# REF: http://docs.ansible.com/ansible/playbooks.html
#####################################################
- name: Install Python 3x programming language via source on CentOS7x
hosts: "{{ HostOrGroup|default ('FATAL ERROR --> HostOrGroup NOT SET! You must specify either a Host or a Group name!') }}"
serial: "100%"
gather_facts: False
tasks:
# Install yum packages
# REF: http://docs.ansible.com/ansible/yum_module.html
######################################################
- name: Install Development Tools group packages
yum:
name="@Development Tools"
state=present
# Note: RHEL7x has two (2) types of group lists "package groups" and "environment groups"
# Use: yum group list
# REF: http://docs.ansible.com/ansible/yum_module.html#notes
# unarchive - Unpacks an archive after (optionally) copying it from the local machine
# REF: http://docs.ansible.com/ansible/unarchive_module.html
############################################################
- name: Download and extract the source code into /tmp/Python-3.x.x
unarchive:
src: https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
dest: /tmp
copy: no
# Execute raw command(s)
# REF: http://docs.ansible.com/ansible/raw_module.html
##########################################################
- name: Compile and install Python3x to /usr/local/bin/python3.5
raw: cd /tmp/Python-3.5.2; ./configure --prefix=/usr/local && make altinstall
# SSH comman line verification:
# /usr/local/bin/python3.5 -V