VictorMorenoJimenez / tfg2020

Final Degree Project ETSIIT Granada
GNU General Public License v3.0
2 stars 0 forks source link

On proxmox role, configure_ssl_letsencrypt task, ansible copy module not working as expected. #50

Closed VictorMorenoJimenez closed 4 years ago

VictorMorenoJimenez commented 4 years ago

When running a simple copy from src to dest, Permisson Error.

fatal: [tfg2.intelligenia.com]: FAILED! => {"changed": false, "msg": "failed to copy: /etc/letsencrypt/live/tfg2.intelligenia.com/fullchain.pem to /etc/pve/local/pve-ssl.pem", "traceback": "Traceback (most recent call last):\n File \"/tmp/ansible_copy_payload_4gcjahrs/ansible_copy_payload.zip/ansible/modules/files/copy.py\", line 659, in main\n File \"/usr/lib/python3.7/shutil.py\", line 207, in copystat\n lookup(\"chmod\")(dst, mode, follow_symlinks=follow)\nPermissionError: [Errno 1] Operation not permitted: b'/etc/pve/local/tmp_bi4rw8e'\n"}

Executed manual no errors

Code

- name: Copy fullchain.pem to proxmox folder
  copy:
    src: /etc/letsencrypt/archive/{{ servername }}/fullchain1.pem
    dest: /etc/pve/local/pve-ssl.pem
    local_follow: False
    remote_src: yes

Workaround:

Execute copy command with shell module.

- name: Copy fullchain.pem to proxmox folder
  shell: |
    cp /etc/letsencrypt/archive/"{{ servername }}"/fullchain1.pem /etc/pve/local/pve-ssl.pem
    cp /etc/letsencrypt/archive/"{{ servername }}"/privkey1.pem /etc/pve/local/pve-ssl.key
    cp /etc/letsencrypt/archive/"{{ servername }}"/chain1.pem /etc/pve/pve-root-ca.pem

Maybe can improve copy using Ansible module.

VictorMorenoJimenez commented 4 years ago

This is working properly, no need to use copy module.