如何在清单文件中添加服务器路径-Ansible

时间:2018-08-27 12:23:59

标签: ansible

我可以访问特定的公用共享点文件夹路径(Windows计算机)。从那里,我需要将文件放入Ansible控制Linux机器中。我使用了下面的剧本,但出现错误。

    - hosts: hosts
      tasks:
      - name: Copy Remote-To-Local (from NAS to ansible)
        synchronize: 
          src=\\xxx.dns.name\files\Q\Global\_ApplicationData\hello.txt 
          dest= /tmp/ansible

请注意:我有权访问此文件夹路径\\xxx.dns.name\files\Q\Global\_ApplicationData\

Inventory file
[hosts]
\\xxx.dns.name\files\Q\Global\_ApplicationData\
[hosts:vars]
ansible_user=<myID>
ansible_pass=<mypwd>
ansible_port=5986
ansible_connection=winrm
ansible_winrm_transport=credssp
ansible_winrm_server_cert_validation=ignore

错误

  -bash-4.2$ ansible-playbook -i hosts newplaybook.yml


PLAY [hosts] ************************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************
fatal: [\xxx.dns.namefilesQGlobal_ApplicationData]: UNREACHABLE! => {"changed": false, "msg": "credssp: auth method credssp requires a password", "unreachable": true}

1 个答案:

答案 0 :(得分:0)

我假设您已经按照here中的说明对Windows支持进行了所有必需的配置。库存文件似乎有问题的一件事是,您使用import React, {Component} from 'react'; import { View, Text } from 'react-native'; import axios from 'axios'; class AlbumList extends Component { state= {albums: [] }; componentWillMount() { axios .get("https://rallycoding.herokuapp.com/api/music_albums") .catch(error => { console.log(error); }) .then(response => { //console.log(response); this.setState({ albums: response.data }); }); } render() { return( <View> {this.state.albums.map((album, key) => { return <Text key={key}>{album.title}</Text>; })} </View> ); } } export default AlbumList;作为主机名,但应使用要从控制计算机连接到的计算机的可解析名称(就像\\xxx.dns.name\files\Q\Global\_ApplicationData\)。 documentation中也对此有所说明。