将文件从本地机器复制到 AWS EC2 实例

时间:2021-03-09 10:03:57

标签: amazon-web-services amazon-ec2 ansible

我正在使用 mqperf 存储库对使用 AWS 的消息传递队列进行基准测试。我试图告诉 ansible 改为从消息队列的链接下载,它应该只是从我的机器复制特定 MQ 的构建包。

安装 Artemis 时的示例:

- name: Create artemis user
  user:
    name: "{{ artemis_username }}"
    shell: /bin/bash

- name: Download artemis
  get_url:
    dest: "{{ artemis_download_dest }}"
    url:  "{{ artemis_download_url }}"
    
- name: Unpack archive
  unarchive:
    copy:    no
    dest:    /opt
    src:     "{{ artemis_download_dest }}"
    creates: /opt/{{ artemis_name }}
    owner:   "{{ artemis_username }}"

- name: Create user-friendly link
  file:
    state: link
    src: /opt/{{ artemis_name }}
    dest: /opt/artemis

我不想从特定 URL 下载,我想告诉它从我机器上的位置下载。

这有可能吗?

1 个答案:

答案 0 :(得分:2)

您想在 Ansible 中使用复制模块,https://docs.ansible.com/ansible/2.9/modules/copy_module.html

- name: Copy file onto remote machine
  copy:
    src: /srv/myfiles/foo.conf
    dest: /etc/foo.conf
相关问题