-
Notifications
You must be signed in to change notification settings - Fork 1
/
playbook-compat-sudo.yml
77 lines (74 loc) · 2.85 KB
/
playbook-compat-sudo.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
- hosts: all
gather_facts: False
tasks:
- name: install python 2 on ubuntu 16.04 et al
sudo: yes
# Needs trailing ";" under certain combinations of docker,
# ansible.
# It does not seem possible to conditionally include a file in
# ansible 1.x without parsing it, which prevents use of "become".
# However, in ansible 2.3, "sudo" stopped working for "raw" so we
# just try to become root in various ways.
raw: >
if command -v apt; then
test -e /usr/bin/python ||
(command -v apt && apt -y update && apt install -y python-minimal) ||
(command -v apt && sudo apt -y update && sudo apt install -y python-minimal)
fi;
# Needed since Ansible 2.2 per
# https://github.com/ansible/ansible/pull/17112/files
changed_when: False
register: result_python2_ubuntu
until: result_python2_ubuntu|success
# Workaround https://github.com/ansible/ansible/issues/16868 and
# increase default retry count
retries: 20
delay: 10
- name: install python 2 on fedora 25 et al
sudo: yes
# Needs trailing ";" under certain combinations of docker,
# ansible.
# It does not seem possible to conditionally include a file in
# ansible 1.x without parsing it, which prevents use of "become".
# However, in ansible 2.3, "sudo" stopped working for "raw" so we
# just try to become root in various ways.
raw: >
if command -v dnf; then
test -e /usr/bin/python ||
(command -v dnf && dnf install -y python2) ||
(command -v dnf && sudo dnf install -y python2)
fi;
# Needed since Ansible 2.2 per
# https://github.com/ansible/ansible/pull/17112/files
changed_when: False
register: result_python2_fedora
until: result_python2_fedora|success
# Workaround https://github.com/ansible/ansible/issues/16868 and
# increase default retry count
retries: 20
delay: 10
- name: install simplejson on CentOS 5 et al
sudo: yes
# Needs trailing ";" under certain combinations of docker,
# ansible.
# It does not seem possible to conditionally include a file in
# ansible 1.x without parsing it, which prevents use of "become".
# However, in ansible 2.3, "sudo" stopped working for "raw" so we
# just try to become root in various ways.
raw: >
if command -v yum; then
python -c "import json" ||
python -c "import simplejson" ||
(command -v yum && yum -y install python-simplejson) ||
(command -v yum && sudo yum -y install python-simplejson)
fi;
# Needed since Ansible 2.2 per
# https://github.com/ansible/ansible/pull/17112/files
changed_when: False
register: result_simplejson_centos
until: result_simplejson_centos|success
# Workaround https://github.com/ansible/ansible/issues/16868 and
# increase default retry count
retries: 20
delay: 10