5
6

More than 5 years have passed since last update.

ArchLinuxにAnsibleしたらInvalid syntax error

Last updated at Posted at 2014-08-25

参考: Invalid syntax error · Issue #30 · jlund/streisand

エラー

実行
$ sh run.sh
sudo password:

PLAY [myserver] *******************************************************************

GATHERING FACTS ***************************************************************
failed: [myserver] => {"failed": true, "parsed": false}
invalid output was:   File "/home/owner/.ansible/tmp/ansible-tmp-1408999276.05-85157681217062/setup", line 532
    except OSError, e:
                  ^
SyntaxError: invalid syntax


TASK: [利用者削除] **************************************************************
FATAL: no hosts matched or all hosts have already failed -- aborting


PLAY RECAP ********************************************************************
           to retry, use: --limit @/Users/owner/book.retry

myserver          : ok=0    changed=0    unreachable=0    failed=1

対処

Ansibleはpython2が必要。

pacman -Sy python2
main.yml
  ---
  - hosts: localhost
+   vars:
+     ansible_python_interpreter: python2
    sudo: yes
    tasks:
      - pacman: name=libvirt state=installed

再度実行して正常終了することを確認。

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6