Skip to content

Instantly share code, notes, and snippets.

@foxutech
Last active March 20, 2018 19:29
Show Gist options
  • Save foxutech/261f60d0c7b288edaec6cd23b045a7d6 to your computer and use it in GitHub Desktop.
Save foxutech/261f60d0c7b288edaec6cd23b045a7d6 to your computer and use it in GitHub Desktop.
---
- hosts: localhost
gather_facts: True
become: True
tasks:
- name: Download Python 3.3
get_url: dest=/var/local url=http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
sudo: yes
- name: Ensure Python 3.3 is extracted
shell: chdir=/var/local tar xJf ./Python-3.3.5.tar.xz -C /opt creates=/opt/Python-3.3.5
sudo: yes
- name: Ensure Python 3.3 is configured
shell: chdir=/opt/Python-3.3.5 ./configure --prefix=/opt/python3.3
- name: Ensure Python 3.3 make'd
shell: chdir=/opt/Python-3.3.5 make
- name: Ensure Python 3.3 installed
shell: chdir=/opt/Python-3.3.5 make install
sudo: yes
- name: install PIP on redhat or centos
yum: name=python-pip state=present
when: (ansible_os_family == "CentOS" and ansible_distribution_major_version == "6") or
(ansible_os_family == "RedHat" and ansible_distribution_major_version == "6")
become: yes
- name: Install PIP on ubuntu
apt: name=python-pip state=present
when: (ansible_os_family == "Debian" and ansible_distribution_major_version == "7")
become: yes
- name: upgrade pip
raw: pip install --upgrade pip
become: True
- name: upgrade setup tools
raw: pip install --upgrade setuptools
become: True
- name: install ansible-container
pip: name=ansible-container[docker,k8s] state=present
- name: create a directory
file:
path: /test/ansiblecontainer
state: directory
- name: cd directory
command: cd /test/ansiblecontainer
- name: Run the command if the specified file does not exist.
command: ansible-container init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment