Atualmente, estou tentando automatizar o Oracle Database XE usando o ansioso playbook. Tudo com a instalação parece estar bem, exceto pela etapa em que as variáveis de ambiente para o Oracle estão definidas:
source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
O código no playbook ansible é assim:
- name: setup oracle environment
shell: source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
shell: reset
shell: /bin/echo 'source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh' >> /home/vagrant/.bash_profile
- name: create users and schemas on the oracle database
shell: sqlplus SYSTEM/root@XE @ create_schemas_users.sql
Então, quando eu executo o ansioso playbook, no final do processo, eu recebo algo assim:
TASK [create users and schemas on the oracle database] *******************************************************************************************************************************************************************************
fatal: [wemdbc01]: FAILED! => {"changed": true, "cmd": "sqlplus SYSTEM/root@XE @ create_schemas_users.sql", "delta": "0:00:00.002841", "end": "2017-05-30 08:40:50.652786", "failed": true, "rc": 127, "start": "2017-05-30 08:40:50.649945", "stderr": "/bin/sh: sqlplus: command not found", "stderr_lines": ["/bin/sh: sqlplus: command not found"], "stdout": "", "stdout_lines": []}
to retry, use: --limit @/var/wminst/ansible-config/playbooks/oracle-xe.retry
PLAY RECAP ***************************************************************************************************************************************************************************************************************************
wemdbc01 : ok=6 changed=2 unreachable=0 failed=1
Connection to 127.0.0.1 closed.
O que estou fazendo de errado? Por que depois de executar source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
e redefinir o terminal sqlplus
não está visível para o bash?