How do I adjust the version of Python in the VM that vagrant/ansible provision? I setup a virtualenv with 2.7, but it appears the Python in the CentOS6 VM is only 2.6.6 (although I thought 2.6.6 would support the "except XXX, eee" syntax.
(python2)$ vagrant ssh -- python --version ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead. Running with ansible-skip-tags: ["sensors"] Python 2.6.6 (python2)$ python --version Python 2.7.15 (python2)$ tail -10 ansible.log 2019-02-01 09:25:06,515 p=7462 u=user | changed: [node1] 2019-02-01 09:25:06,537 p=7462 u=user | TASK [ambari_config : Wait for Ambari to start; http://node1:8080] ************* 2019-02-01 09:25:07,191 p=7462 u=user | ok: [node1] 2019-02-01 09:25:07,216 p=7462 u=user | TASK [ambari_config : Deploy cluster with Ambari; http://node1:8080] *********** 2019-02-01 09:25:07,446 p=7462 u=user | An exception occurred during task execution. To see the full traceback, use -vvv. The error was: SyntaxError: invalid syntax 2019-02-01 09:25:07,447 p=7462 u=user | fatal: [node1]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""} 2019-02-01 09:25:07,450 p=7462 u=user | to retry, use: --limit @/Users/user/github/metron/metron-deployment/development/centos6/ansible/playbook.retry 2019-02-01 09:25:07,450 p=7462 u=user | PLAY RECAP ********************************************************************* 2019-02-01 09:25:07,450 p=7462 u=user | node1 : ok=77 changed=43 unreachable=0 failed=1 (python2)$ ------- On Fri, Feb 1, 2019 at 6:26 AM Otto Fowler <ottobackwa...@gmail.com> wrote: > I think you should have python 2.7.11 at a minimum on the machine running > ansible maybe. > > > On February 1, 2019 at 07:55:59, Ryan Sommers (ry...@rpsommers.com) wrote: > > When attempting to build the single-vm I am getting an error in what > appears to be command-line python. I added 'ansible.verbose = "vvv"' to get > the verbose output. Any suggestions on remedies would be appreciated! > > R > > ================ > TASK [ambari_config : Deploy cluster with Ambari; http://node1:8080] > *********** > task path: > /Users/user/github/metron/metron-deployment/ansible/roles/ambari_config/tasks/main.yml:28 > <node1> ESTABLISH SSH CONNECTION FOR USER: vagrant > <node1> SSH: EXEC ssh -o UserKnownHostsFile=/dev/null -o > IdentitiesOnly=yes -o > IdentityFile=/Users/user/github/metron/metron-deployment/development/centos6/.vagrant/machines/node1/virtualbox/private_key > -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o > KbdInteractiveAuthentication=no -o > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey > -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o > ControlPath=/Users/user/.ansible/cp/%h-%p-%r node1 '/bin/sh -c '"'"'echo > ~vagrant && sleep 0'"'"'' > <node1> (0, b'/home/vagrant\n', b'') > <node1> ESTABLISH SSH CONNECTION FOR USER: vagrant > <node1> SSH: EXEC ssh -o UserKnownHostsFile=/dev/null -o > IdentitiesOnly=yes -o > IdentityFile=/Users/user/github/metron/metron-deployment/development/centos6/.vagrant/machines/node1/virtualbox/private_key > -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o > KbdInteractiveAuthentication=no -o > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey > -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o > ControlPath=/Users/user/.ansible/cp/%h-%p-%r node1 '/bin/sh -c '"'"'( umask > 77 && mkdir -p "` echo > /home/vagrant/.ansible/tmp/ansible-tmp-1548991736.285941-79805437559679 `" > && echo ansible-tmp-1548991736.285941-79805437559679="` echo > /home/vagrant/.ansible/tmp/ansible-tmp-1548991736.285941-79805437559679 `" > ) && sleep 0'"'"'' > <node1> (0, > b'ansible-tmp-1548991736.285941-79805437559679=/home/vagrant/.ansible/tmp/ansible-tmp-1548991736.285941-79805437559679\n', > b'') > The full traceback is: > Traceback (most recent call last): > File > "/usr/local/Cellar/ansible/2.7.6/libexec/lib/python3.7/site-packages/ansible/executor/task_executor.py", > line 140, in run > res = self._execute() > File > "/usr/local/Cellar/ansible/2.7.6/libexec/lib/python3.7/site-packages/ansible/executor/task_executor.py", > line 612, in _execute > result = self._handler.run(task_vars=variables) > File > "/usr/local/Cellar/ansible/2.7.6/libexec/lib/python3.7/site-packages/ansible/plugins/action/normal.py", > line 46, in run > result = merge_hash(result, self._execute_module(task_vars=task_vars, > wrap_async=wrap_async)) > File > "/usr/local/Cellar/ansible/2.7.6/libexec/lib/python3.7/site-packages/ansible/plugins/action/__init__.py", > line 739, in _execute_module > (module_style, shebang, module_data, module_path) = > self._configure_module(module_name=module_name, module_args=module_args, > task_vars=task_vars) > File > "/usr/local/Cellar/ansible/2.7.6/libexec/lib/python3.7/site-packages/ansible/plugins/action/__init__.py", > line 178, in _configure_module > environment=final_environment) > File > "/usr/local/Cellar/ansible/2.7.6/libexec/lib/python3.7/site-packages/ansible/executor/module_common.py", > line 973, in modify_module > environment=environment) > File > "/usr/local/Cellar/ansible/2.7.6/libexec/lib/python3.7/site-packages/ansible/executor/module_common.py", > line 791, in _find_module_utils > recursive_finder(module_name, b_module_data, py_module_names, > py_module_cache, zf) > File > "/usr/local/Cellar/ansible/2.7.6/libexec/lib/python3.7/site-packages/ansible/executor/module_common.py", > line 538, in recursive_finder > tree = ast.parse(data) > File > "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", > line 35, in parse > return compile(source, filename, mode, PyCF_ONLY_AST) > File "<unknown>", line 230 > except requests.ConnectionError, e: > ^ > SyntaxError: invalid syntax > > fatal: [node1]: FAILED! => { > "msg": "Unexpected failure during module execution.", > "stdout": "" > } > ==================== > > -- > Ryan P Sommers > ry...@rpsommers.com > > -- Ryan P Sommers ry...@rpsommers.com