I've got as far as working out that /etc/pve is a fuse mount and that I should use the gui to replace the certs (although it would be nice to automate this)
So, more for my leaning, is there a better way to copy these into place through ansible that I'm missing please?
Or what am I missing here about why it's not copying please?
Some interesting behaviour...
1) it doesn't seem to be an immutable switch but interesting that I'm not getting back information on the files.
2) trying to delete- Ansible looks like it's deleting the previous files ok, should it?
I only ask as I thought it report they were deleted but it wasn't doing it until I manuall deleted them- but I may be misremembering
3) Copying them directly with ansible.builtin.copy with doesn't work, either directly, or by copying them locally and them using
copy:
remote_src: yes
4) but you can run a command
So, more for my leaning, is there a better way to copy these into place through ansible that I'm missing please?
Or what am I missing here about why it's not copying please?
Some interesting behaviour...
1) it doesn't seem to be an immutable switch but interesting that I'm not getting back information on the files.
Code:
lsattr: Function not implemented While reading flags on ./pve-ssl.pem
lsattr: Function not implemented While reading flags on ./pve-ssl.key
2) trying to delete- Ansible looks like it's deleting the previous files ok, should it?
I only ask as I thought it report they were deleted but it wasn't doing it until I manuall deleted them- but I may be misremembering
Code:
- name:
file:
path: "{{item}}"
state: absent
loop:
- /etc/pve/nodes/{{node}}/pveproxy-ssl.pem
- /etc/pve/nodes/{{node}}/pveproxy-ssl.key
Code:
TASK [file] ******************************************************************************
changed: [rmlprox] => (item=/etc/pve/nodes/rmlprox/pveproxy-ssl.pem)
changed: [proxrml] => (item=/etc/pve/nodes/pve/pveproxy-ssl.pem)
changed: [rmlprox] => (item=/etc/pve/nodes/rmlprox/pveproxy-ssl.key)
changed: [proxrml] => (item=/etc/pve/nodes/pve/pveproxy-ssl.key)
3) Copying them directly with ansible.builtin.copy with doesn't work, either directly, or by copying them locally and them using
copy:
remote_src: yes
Code:
- name: move the files
ansible.builtin.copy:
src: "{{item}}"
dest: "/etc/pve/nodes/{{node}}/"
remote_src: yes
owner: root
group: www-data
mode: 0640
become: yes
loop:
- /root/certs/pveproxy-ssl.pem
- /root/certs/pveproxy-ssl.key
Code:
failed: [rmlprox] (item=/root/certs/pveproxy-ssl.pem) => {"ansible_loop_var": "item", "changed": false, "item": "/root/certs/pveproxy-ssl.pem", "msg": "failed to copy: /root/certs/pveproxy-ssl.pem to /etc/pve/nodes/rmlprox/pveproxy-ssl.pem", "traceback": "Traceback (most recent call last):\n File \"/tmp/ansible_ansible.legacy.copy_payload_j8q7eurp/ansible_ansible.legacy.copy_payload.zip/ansible/modules/copy.py\", line 684, in main\n File \"/tmp/ansible_ansible.legacy.copy_payload_j8q7eurp/ansible_ansible.legacy.copy_payload.zip/ansible/module_utils/basic.py\", line 2468, in atomic_move\n os.chmod(b_dest, DEFAULT_PERM & ~umask)\nPermissionError: [Errno 1] Operation not permitted: b'/etc/pve/nodes/rmlprox/pveproxy-ssl.pem'\n"}
4) but you can run a command
- name: sudo move files
ansible.builtin.command:
cmd: "cp {{item}} /etc/pve/nodes/{{node}}/"
loop:
- /root/certs/pveproxy-ssl.pem
- /root/certs/pveproxy-ssl.key
become: yes