I added the same

---
[atlanta]​ 
​[europe]​

in #Inventories/production

and when i run playbook # ansible-playbook -i Inventories/production, it 
doesn't picks the inventory details.

Currently my inventory is 

|----Inventories
|         |-----group_vars
|         |           |---production
|         |-----Inventory1
|         |-----Production
|----Playbooks
|         |-----test.yml
|-----roles
|         |-----copy_template
|                     |-----tasks/main.yml
                      |-----templates/copy.js.j2


#Inventories/group_vars/production
---

url: 'jnp://mqendpoint.company.com:1099'
env: 'Production'


#Inventories/inventory1
[smtp]

server1 ansible_ssh_host=server1.cloudapp.net  ansible_ssh_port=22
server2 ansible_ssh_host=server1.cloudapp.net  ansible_ssh_port=23

[smtp:vars]
ansible_ssh_user=testuser
ansible_ssh_private_key_file=/home/testuser/smtp-key.pem


#Inventories/production
---
[smtp]



#Playbooks/test.yml
---
- hosts: "{{ hosts }}"
  remote_user: testuser
  sudo: yes
  roles:
      - copy_template

#roles/copy_template/tasks/main.yml
---

- name: Upload config file
  template: src=copy.js.j2  dest=/home/testuser/test.js owner=root mode=0664
  sudo: true


#roles/copy_template/templates/copy.js.j2
// Configuration parameters
var environment = '{{env}}';
var url = '{{url}}';


I run the playbook using # ansible-playbook -i Inventories/production 
Playbooks/test.yml --extra-vars "hosts=smtp"

But no hosts matched in my case. Can you please help


-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cbec320c-4bd7-4548-88f7-23fd3fa6cc68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to