ansible 与 solidfire for netapp
ansible with solidfire for netapp
我有一个示例 netapp 剧本
---
- hosts: all
gather_facts: False
become: yes
become_user: root
become_method: sudo
tasks:
- name: Start restore
na_elementsw_snapshot_restore:
hostname: "{{ip_adr}}"
username: "{{username}}"
password: ""
account_id: ansible-1
src_snapshot_id: snapshot_20171021
src_volume_id: volume-playarea
dest_volume_name: dest-volume-area
和这个清单文件
snaptest ansible_host=192.168.1.10 ansible_connection=ssh ansible_user=centos ansible_ssh_private_key_file=/home/slenz/.ssh/id_vm_sync ansible_python_interpreter=/usr/bin/python2.7
[snap]
snaptest
当我 运行 我得到剧本时
fatal: [snaptest]: FAILED! => {"changed": false, "msg": "the python SolidFire SDK module is required"}
但是我确实通过 pip 安装了 solidfire
Requirement already satisfied: solidfire-sdk-python in /usr/lib/python2.7/site-packages (1.5.0.87)
Requirement already satisfied: setuptools>=19.2 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (41.0.1)
Requirement already satisfied: future>=0.15.2 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (0.17.1)
Requirement already satisfied: enum34>=1.1.6 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (1.1.6)
Requirement already satisfied: requests>=2.9.1 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (2.22.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (1.25.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (2019.3.9)
现在我的问题是为什么 ansible 找不到 solidfire。我可以打开一个 python cli 并执行 "import solidfire.common" 就可以了。
我正在使用 ansible 2.8.0、centos7 和 python 2.7.5
感谢您的帮助。
只有一个模块 returns the python SolidFire SDK module is required
消息。
这是 ansible/module_utils/netapp.py 模块。
returns这个错误信息(如果为假)的条件是:
if HAS_SF_SDK and hostname and username and password:
因此,如果您的 password
字段为空(""
被 Python 视为错误),您将收到此错误。
您需要修正 tasks
之前的部分。
localsf
是我在 /etc/ansible/hosts 中的本地 SolidFire MVIP。您无需 sudo 即可使用 SolidFire Python SDK 并连接到 MVIP。
- name: NetApp Element Software Snapshot-to-Volume
hosts: localsf
gather_facts: no
connection: local
接下来,account_id: ansible-1
:没有这样的账号。
ID 是整数,而不是字符串。你的意思可能是 account_id: 1
.
最后但同样重要的是,空密码值。
我有一个示例 netapp 剧本
---
- hosts: all
gather_facts: False
become: yes
become_user: root
become_method: sudo
tasks:
- name: Start restore
na_elementsw_snapshot_restore:
hostname: "{{ip_adr}}"
username: "{{username}}"
password: ""
account_id: ansible-1
src_snapshot_id: snapshot_20171021
src_volume_id: volume-playarea
dest_volume_name: dest-volume-area
和这个清单文件
snaptest ansible_host=192.168.1.10 ansible_connection=ssh ansible_user=centos ansible_ssh_private_key_file=/home/slenz/.ssh/id_vm_sync ansible_python_interpreter=/usr/bin/python2.7
[snap]
snaptest
当我 运行 我得到剧本时
fatal: [snaptest]: FAILED! => {"changed": false, "msg": "the python SolidFire SDK module is required"}
但是我确实通过 pip 安装了 solidfire
Requirement already satisfied: solidfire-sdk-python in /usr/lib/python2.7/site-packages (1.5.0.87)
Requirement already satisfied: setuptools>=19.2 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (41.0.1)
Requirement already satisfied: future>=0.15.2 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (0.17.1)
Requirement already satisfied: enum34>=1.1.6 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (1.1.6)
Requirement already satisfied: requests>=2.9.1 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (2.22.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (1.25.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (2019.3.9)
现在我的问题是为什么 ansible 找不到 solidfire。我可以打开一个 python cli 并执行 "import solidfire.common" 就可以了。
我正在使用 ansible 2.8.0、centos7 和 python 2.7.5
感谢您的帮助。
只有一个模块 returns the python SolidFire SDK module is required
消息。
这是 ansible/module_utils/netapp.py 模块。
returns这个错误信息(如果为假)的条件是:
if HAS_SF_SDK and hostname and username and password:
因此,如果您的 password
字段为空(""
被 Python 视为错误),您将收到此错误。
您需要修正 tasks
之前的部分。
localsf
是我在 /etc/ansible/hosts 中的本地 SolidFire MVIP。您无需 sudo 即可使用 SolidFire Python SDK 并连接到 MVIP。
- name: NetApp Element Software Snapshot-to-Volume
hosts: localsf
gather_facts: no
connection: local
接下来,account_id: ansible-1
:没有这样的账号。
ID 是整数,而不是字符串。你的意思可能是 account_id: 1
.
最后但同样重要的是,空密码值。