簡體   English   中英

無法使用 Ansible 創建單個用戶

[英]Unable to create a single user using Ansible

我試圖運行最簡單的 Ansible 腳本。 但我不能,因為我有以下錯誤:

---
- hosts: all
  tasks:
      - name: Create single user
        user: name="matias" password="secret" shell="/bin/bash"

錯誤:

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
'all'

ERROR! unexpected parameter type in action: <class 'ansible.parsing.yaml.objects.AnsibleSequence'>

The error appears to be in 'matias/tasks/main.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

# Example playbook that shows how to create users from the generated ansible variable file
- hosts: all
  ^ here

我的命令:

ansible-playbook mainplaybook.yml

我在這里做錯了什么?

我猜你沒有提到 /etc/ansible/hosts 目錄中的任何主機名。 您可以將主機保存在 /etc/ansible/hosts 中。 Ansible 將那里視為默認位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM