Avoid install python2 each time at pre_task

Python2 check, miss a parenthesis for apt-get and update.
```
( /usr/bin/python --version 2>&1 | grep -c 'Python' > /dev/null ) || apt-get update && apt-get -y install python
```
becomes to
```
(( /usr/bin/python --version 2>&1 | grep -c 'Python' > /dev/null ) || apt-get update ) && apt-get -y install python
```
so `apt-get -y install python` ever is executed even Python2 it's present

then we need to put update and install together
```
( /usr/bin/python --version 2>&1 | grep -c 'Python' > /dev/null ) || ( apt-get  update && apt-get -y install python )
```
pull/148/head
Jorge Senín 2019-11-24 02:15:59 +01:00
rodzic 68351f56b8
commit e02b1acae8
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -4,7 +4,7 @@
gather_facts: no
pre_tasks:
- name: Install python2 required by Ansible
raw: "( /usr/bin/python --version 2>&1 | grep -c 'Python' > /dev/null ) || apt-get update && apt-get -y install python"
raw: "( /usr/bin/python --version 2>&1 | grep -c 'Python' > /dev/null ) || ( apt-get update && apt-get -y install python )"
- hosts: all
become: yes