> On 07/27/2022 11:09 AM CEST Stefan Hornburg (Racke) <[email protected]> wrote:
> 
>  
> On 27/07/2022 10:33, dulhaver via Ansible Project wrote:
> > I am trying to rename/move a folder on a remote host and try to do this 
> > based on whether it exists
> 
> That doesn't look like a proper path: "path": " 
> /opt/db/backup/postgres/backups ".
> 
> Also it doesn't coincide with your playbook.

sorry, my bad. I have several identical actions and mixed up the TASK of one 
with the return of another. So in reality they match up. The installation path 
/opt/db/postgres is what we do here in my context (despite the standard 
/var/lib/pgsql/...).

#### my TASK 
###########################################################################################
        
- name: move legacy postgres - stat postgres_base
  stat: path=/opt/db/postgres
  register: postgres_base_stat

- name: move legacy postgres - move postgres_base to postgres_base_legacy
  command: mv /opt/db/postgres /opt/db/postgres/legacy"
  when: postgres_base_stat.stat.exists


#### feedback  
#########################################################################################

TASK [postgres_disable : move legacy postgres - stat postgres_base] 
**************************************************************************************************************
task path: 
/home/gwagner/repos/ansible/open_source/postgres_upgrade/roles/postgres_disable/tasks/main.yml:16
<rhel8-vm.local> ESTABLISH SSH CONNECTION FOR USER: None
<rhel8-vm.local> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s 
-o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
'ControlPath="/home/gwagner/.ansible/cp/8ca9f05e1f"' rhel8-vm.local '/bin/sh -c 
'"'"'echo ~ && sleep 0'"'"''
<rhel8-vm.local> (0, b'/home/gwagner\n', b'')
<rhel8-vm.local> ESTABLISH SSH CONNECTION FOR USER: None
<rhel8-vm.local> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s 
-o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
'ControlPath="/home/gwagner/.ansible/cp/8ca9f05e1f"' rhel8-vm.local '/bin/sh -c 
'"'"'( umask 77 && mkdir -p "` echo /home/gwagner/.ansible/tmp `"&& mkdir "` 
echo 
/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718 
`" && echo ansible-tmp-1658919873.2246733-63503-154421168863718="` echo 
/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718 
`" ) && sleep 0'"'"''
<rhel8-vm.local> (0, 
b'ansible-tmp-1658919873.2246733-63503-154421168863718=/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718\n',
 b'')
Using module file /usr/lib/python3.8/site-packages/ansible/modules/stat.py
<rhel8-vm.local> PUT 
/home/gwagner/.ansible/tmp/ansible-local-63470u1tpvd24/tmp5yf_h4ad TO 
/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718/AnsiballZ_stat.py
<rhel8-vm.local> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o 
ControlPersist=60s -o StrictHostKeyChecking=no -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
'ControlPath="/home/gwagner/.ansible/cp/8ca9f05e1f"' '[rhel8-vm.local]'
<rhel8-vm.local> (0, b'sftp> put 
/home/gwagner/.ansible/tmp/ansible-local-63470u1tpvd24/tmp5yf_h4ad 
/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718/AnsiballZ_stat.py\n',
 b'')
<rhel8-vm.local> ESTABLISH SSH CONNECTION FOR USER: None
<rhel8-vm.local> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s 
-o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
'ControlPath="/home/gwagner/.ansible/cp/8ca9f05e1f"' rhel8-vm.local '/bin/sh -c 
'"'"'chmod u+x 
/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718/
 
/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718/AnsiballZ_stat.py
 && sleep 0'"'"''
<rhel8-vm.local> (0, b'', b'')
<rhel8-vm.local> ESTABLISH SSH CONNECTION FOR USER: None
<rhel8-vm.local> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s 
-o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
'ControlPath="/home/gwagner/.ansible/cp/8ca9f05e1f"' -tt rhel8-vm.local 
'/bin/sh -c '"'"'/usr/libexec/platform-python 
/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718/AnsiballZ_stat.py
 && sleep 0'"'"''
<rhel8-vm.local> (0, b'\r\n{"changed": false, "stat": {"exists": false}, 
"invocation": {"module_args": {"path": " /opt/db/postgres ", "follow": false, 
"get_md5": false, "get_checksum": true, "get_mime": true, "get_attributes": 
true, "checksum_algorithm": "sha1"}}}\r\n', b'Shared connection to 
rhel8-vm.local closed.\r\n')
<rhel8-vm.local> ESTABLISH SSH CONNECTION FOR USER: None
<rhel8-vm.local> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s 
-o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
'ControlPath="/home/gwagner/.ansible/cp/8ca9f05e1f"' rhel8-vm.local '/bin/sh -c 
'"'"'rm -f -r 
/home/gwagner/.ansible/tmp/ansible-tmp-1658919873.2246733-63503-154421168863718/
 > /dev/null 2>&1 && sleep 0'"'"''
<rhel8-vm.local> (0, b'', b'')
ok: [rhel8-vm.local] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "checksum_algorithm": "sha1",
            "follow": false,
            "get_attributes": true,
            "get_checksum": true,
            "get_md5": false,
            "get_mime": true,
            "path": " /opt/db/postgres "
        }
    },
    "stat": {
        "exists": false
    }
}


TASK [postgres_disable : move legacy postgres - rename "postgres_back" to 
"postgres_user_home/back/legacy"] 
**********************************************************************
task path: 
/home/gwagner/repos/ansible/open_source/postgres_upgrade/roles/postgres_disable/tasks/main.yml:38
skipping: [rhel8-vm.local] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}

########################################################################################################

-- 
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/1541870653.399453.1658920293465%40office.mailbox.org.

Reply via email to