add python 2/3 test
This commit is contained in:
12
files/pytest.py
Normal file
12
files/pytest.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from __future__ import print_function
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
try:
|
||||||
|
print("UID: ", os.getuid())
|
||||||
|
my_generator = (letter for letter in 'abcdefg')
|
||||||
|
next(my_generator)
|
||||||
|
my_generator.next()
|
||||||
|
print("It Works!")
|
||||||
|
except:
|
||||||
|
print("You Broke It")
|
||||||
|
sys.exit(1)
|
@ -2,7 +2,7 @@
|
|||||||
- name: install and check python
|
- name: install and check python
|
||||||
hosts: all
|
hosts: all
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
become: no
|
become: yes
|
||||||
|
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
@ -10,6 +10,13 @@
|
|||||||
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Set ansible_python_interpreter if not defined
|
||||||
|
set_fact:
|
||||||
|
ansible_python_interpreter: /usr/bin/python
|
||||||
|
when:
|
||||||
|
- ansible_python_interpreter is not defined
|
||||||
|
|
||||||
|
|
||||||
- name: Install python packages
|
- name: Install python packages
|
||||||
package :
|
package :
|
||||||
name : "{{ item }}"
|
name : "{{ item }}"
|
||||||
@ -36,4 +43,28 @@
|
|||||||
var: ansible_python.executable
|
var: ansible_python.executable
|
||||||
|
|
||||||
|
|
||||||
|
- name: Deploy sample script
|
||||||
|
copy:
|
||||||
|
src : files/pytest.py
|
||||||
|
dest : /tmp/pytest.py
|
||||||
|
mode : 0755
|
||||||
|
|
||||||
|
|
||||||
|
- name: Execute sample script
|
||||||
|
command : "{{ ansible_python_interpreter }} /tmp/pytest.py"
|
||||||
|
register : r_sample_script
|
||||||
|
|
||||||
|
|
||||||
|
- name: Show r_sample_script
|
||||||
|
debug:
|
||||||
|
var: r_sample_script
|
||||||
|
|
||||||
|
|
||||||
|
- name: Cleanup sample script
|
||||||
|
file:
|
||||||
|
path : /tmp/pytest.py
|
||||||
|
state : absent
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CONC="50"
|
CONC="100"
|
||||||
REQU="100"
|
REQU="500"
|
||||||
|
|
||||||
BASE_URL="tower2.thezengarden.net"
|
BASE_URL="tower2.thezengarden.net"
|
||||||
AAP_JOB_ID="11"
|
AAP_JOB_ID="11"
|
||||||
|
Reference in New Issue
Block a user