> On 07/29/2022 11:24 AM CEST Dick Visser <[email protected]> wrote:
> 
>  
> On Fri, 29 Jul 2022 at 11:09, dulhaver via Ansible Project
> <[email protected]> wrote:
> 
> >         "mv: cannot stat '{'\\''changed'\\'': False, '\\''stat'\\'': 
> > {'\\''exists'\\'': True, '\\''path'\\'': 
> > '\\''/opt/db/data/postgres/data'\\'', '\\''mode'\\'': '\\''0750'\\'', 
> > '\\''isdir'\\'': True, '\\''ischr'\\'': False, '\\''isblk'\\'': False, 
> > '\\''isreg'\\'': False, '\\''isfifo'\\'': False, '\\''islnk'\\'': False, 
> > '\\''issock'\\'': False, '\\''uid'\\'': 1001, '\\''gid'\\'': 1001, 
> > '\\''size'\\'': 4096, '\\''inode'\\'': 65664, '\\''dev'\\'': 64779, 
> > '\\''nlink'\\'': 20, '\\''atime'\\'': 1659080065.949395, '\\''mtime'\\'': 
> > 1659017614.6222425, '\\''ctime'\\'': 1659080076.9242337, '\\''wusr'\\'': 
> > True, '\\''rusr'\\'': True, '\\''xusr'\\'': True, '\\''wgrp'\\'': False, 
> > '\\''rgrp'\\'': True, '\\''xgrp'\\'': True, '\\''woth'\\'': False, 
> > '\\''roth'\\'': False, '\\''xoth'\\'': False, '\\''isuid'\\'': False, 
> > '\\''isgid'\\'': False, '\\''blocks'\\'': 8, '\\''block_size'\\'': 4096, 
> > '\\''device_type'\\'': 0, '\\''readable'\\'': False, '\\''writeable'\\'': 
> > False, '\\''executable'\\'': False,
> >   '\\''pw_name'\\'': '\\''postgres'\\'', '\\''gr_name'\\'': 
> > '\\''postgres'\\'', '\\''mimetype'\\'': '\\''inode/directory'\\'', 
> > '\\''charset'\\'': '\\''binary'\\'', '\\''version'\\'': None, 
> > '\\''attributes'\\'': [], '\\''attr_flags'\\'': '\\'''\\''}, 
> > '\\''failed'\\'': False}': No such file or directory"
> 
> You are trying to move a directory called '{'\\''changed'\\'': False,
> '\\''stat'\\'': {'\\''exists'\\'': True, '\\''path'\\'':
> '\\''/opt/db/data/postgres/data'\\'', '\\''mode'\\'': '\\''0750'\\'',
> '\\''isdir'\\'': True, '\\''ischr'\\'': False, '\\''isblk'\\'': False,
> '\\''isreg'\\'': False, '\\''isfifo'\\'': False, '\\''islnk'\\'':
> False, '\\''issock'\\'': False, '\\''uid'\\'': 1001, '\\''gid'\\'':
> 1001, '\\''size'\\'': 4096, '\\''inode'\\'': 65664, '\\''dev'\\'':
> 64779, '\\''nlink'\\'': 20, '\\''atime'\\'': 1659080065.949395,
> '\\''mtime'\\'': 1659017614.6222425, '\\''ctime'\\'':
> 1659080076.9242337, '\\''wusr'\\'': True, '\\''rusr'\\'': True,
> '\\''xusr'\\'': True, '\\''wgrp'\\'': False, '\\''rgrp'\\'': True,
> '\\''xgrp'\\'': True, '\\''woth'\\'': False, '\\''roth'\\'': False,
> '\\''xoth'\\'': False, '\\''isuid'\\'': False, '\\''isgid'\\'': False,
> '\\''blocks'\\'': 8, '\\''block_size'\\'': 4096,
> '\\''device_type'\\'': 0, '\\''readable'\\'': False,
> '\\''writeable'\\'': False, '\\''executable'\\'': False,
> >   '\\''pw_name'\\'': '\\''postgres'\\'', '\\''gr_name'\\'': 
> > '\\''postgres'\\'', '\\''mimetype'\\'': '\\''inode/directory'\\'', 
> > '\\''charset'\\'': '\\''binary'\\'', '\\''version'\\'': None, 
> > '\\''attributes'\\'': [], '\\''attr_flags'\\'': '\\'''\\''}, 
> > '\\''failed'\\'': False}', which does not exist.
> 
> The variable you register with stat is not just a string, but a dict.
> You should use the correct key from that dict (i.e. 'postgres_data.path')
> 
it seems neither

´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´
- name: move legacy postgres - stat postgres_data
  stat: path="{{ postgres_data }}"
  register: postgres_data

- name: move legacy postgres - rename $PGDATA to 
/opt/db/data/postgres/data_legacy
  command: mv "{{ postgres_data }}" "{{ postgres_data_legacy }}"  #  
  when: postgres_data.stat.path
  become: true
´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´
nor

´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´
- name: move legacy postgres - stat postgres_data
  stat: path="{{ postgres_data }}"
  register: postgres_data

- name: move legacy postgres - rename $PGDATA to 
/opt/db/data/postgres/data_legacy
  command: mv "{{ postgres_data }}" "{{ postgres_data_legacy }}"  #  
  when: postgres_data.path
  become: true
´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´

seems to make any difference. When I put harcoded locations the dir is renamed, 
when I use the variables from the defaults/main.yml it isn't

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/659960991.517578.1659088923524%40office.mailbox.org.

Reply via email to