# Ansible playbook not working 

**URL:** <https://forum.ansible.com/t/ansible-playbook-not-working/43571>\
**Category:** Get Help\
**Created:** [June 26, 2025, 2:23pm UTC](https://forum.ansible.com/t/ansible-playbook-not-working/43571 "2025-06-26T14:23:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kingshuk\_Sen](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kingshuk_sen/32/8922_2.png) [@Kingshuk\_Sen](https://forum.ansible.com/u/Kingshuk_Sen)\
**Post date:** [June 26, 2025, 2:23pm UTC](https://forum.ansible.com/t/ansible-playbook-not-working/43571/1 "2025-06-26T14:23:41Z")

</div>

Hello Team, I have written an ansible play book for creating oracle restore point and I am running from ansible tower and GitHub and hasivolt.

My logic is

1. Provide bellow variable in template  
Db name  
Pdb name  
Create/drop  
Restore point name
2. Resister the output of select count(\*) from v$restorepoint where restorepoint={{Restore point name}};
3. If rc value of above query is 0 and restore point action is create then create restore point or else
4. If rc value of above query is not equal to 0 and restorepoint action is drop then run drop restore point.
5. Display the register value of create or drop register value.

But the issue is bellow task is getting skipped when executing

- name create restore point  
when:
  - restorepoint\_action = “create”
  - restorepoint\_exist == 0  
shell |  
. oraenv \<\< {{db\_name}}  
sqlplus “/as sysdba” \> EOF  
create restore point for {{pdb}};  
EOF  
register created\_restore  
change\_when

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [June 26, 2025, 4:12pm UTC](https://forum.ansible.com/t/ansible-playbook-not-working/43571/2 "2025-06-26T16:12:16Z")

</div>

Have you looked to see if there’s a module that supports this instead of using shell tasks? It would probably be more convenient.

Using conditionals with shell, it could look like this:

```auto
- shell: "{{ create_cmd }}"
  when:
    - restorepoint_action == "create"
    - restorepoint_exist == 0
  register: created_restore
  
- shell: "{{ drop_cmd }}"
  when:
    - created_restore is skipped
    - restorepoint_action == "drop"
    - restorepoint_exist != 0

```

Also, please use ``` on to the line below and above playbook snippets to make them easier to read.

---

<div class="post-metadata">

**Author:** ![Kingshuk\_Sen](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kingshuk_sen/32/8922_2.png) [@Kingshuk\_Sen](https://forum.ansible.com/u/Kingshuk_Sen)\
**Post date:** [June 27, 2025, 4:57am UTC](https://forum.ansible.com/t/ansible-playbook-not-working/43571/3 "2025-06-27T04:57:42Z")

</div>

Thank you very much .

Our main motive behind this automation is to reduce the direct login of server and debase login using password so can use “community.oracle.oracle\_sql” as it will require password as variable . Also I need to use .oraenv
