I am getting the same error, and my playbook is as follows. I am trying to
run a sql script (record.sql) from the ansible control server to the DB
server.
---
- hosts: DBServer
- tasks:
- name: Execute table.sql using sqlplus
shell: |
export ORACLE_HOME={/u01/app/oracle/product/12.2.0.1/dbhome_1}}
$ORACLE_HOME/bin/sqlplus -s tstsch/tstsch@protegrity @record.sql
environment:
ORACLE_HOME: "{{/u01/app/oracle/product/12.2.0.1/dbhome_1}}"
PATH: "{{$PATH:$ORACLE_HOME/bin}}"
args:
chdir: "{{/home/ansible}}"
become: true
become_method: su
become_user: oracle
On Wednesday, March 30, 2016 at 3:40:56 PM UTC-4, John Buxton wrote:
>
> Your last line is wrong.
> "name" attribute must be within a tasks section.
>
> You've put "name" at the same level as "hosts"; ansible-playbook is
> complaining because it is expecting to see "hosts" at that level.
>
> P.S. This group is for Ansible Development discussions. I believe there's
> a separate group for Ansible usage issues.
>
>
> On Wednesday, 30 March 2016 04:05:46 UTC+1, anil kumar wrote:
>>
>>
>> When I try playbook I see below error
>>
>>
>> ok: [resoxapp-ch2f-01c.email.comcast.net]
>>
>> ERROR! the field 'hosts' is required but was not set
>>
>>
>> my inventory file
>>
>> [hosts]
>>
>> resoxapp-ch2f-01c.email.comcast.net
>>
>> resoxapp-ch2f-02c.email.comcast.net
>>
>> resoxui-ch2f-02c.email.comcast.net
>>
>> resoxui-ch2f-01c.email.comcast.net
>>
>> reshaproxy-ch2f-21c.email.comcast.net
>>
>>
>>
>>
>> Below is the playbook
>>
>> ######################################
>>
>>
>> ---
>>
>> # Please pass AUTOUSER (Automation user with ssh key access) and
>> BUILDNAME variables to this script.
>>
>> - hosts: resoxapp-ch2f-01c.email.comcast.net:r
>> esoxui-ch2f-02c.email.comcast.net
>>
>> user: "{{ AUTOUSER }}"
>>
>> sudo: yes
>>
>> # Disable Middlware-01 from UI-02 and UI-01 from haproxy
>>
>> tasks:
>>
>> - name : Disable the Middleware Host in UserInterface host
>>
>> shell: /var/tmp/en_dis_mw.sh resoxapp-ch2f-01c.email.comcast.net -d
>>
>> delegate_to: resoxui-ch2f-02c.email.comcast.net
>>
>>
>> - hosts: reshaproxy-ch2f-21c.email.comcast.net
>>
>> user: "{{ AUTOUSER }}"
>>
>> sudo: yes
>>
>> vars:
>>
>> dc: "{{ DC }}"
>>
>> tasks:
>>
>> - name : disable UI server from haproxy
>>
>> shell : echo "disable server ox_beta_{{dc}}/oxbetaui1" |socat stdio
>> /var/lib/haproxy/stats
>>
>> delegate_to : reshaproxy-ch2f-21c.email.comcast.net
>>
>>
>> # UPGRADE PLAY
>>
>> - hosts: resoxapp-ch2f-01c.email.comcast.net
>>
>> - name: Upgrade the BETA MIDDLEWARE environment to the specified release
>>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Development" 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-devel/89ad4be1-1a90-44ad-9499-c67dc3907968%40googlegroups.com.