Hi,
I started working with ansible and must admin that most times is working quite well. But resently I have issue which warried me in terms of gathering facts from hosts:
Details:
ansible 1.2.2
SysOP: CentOS 6.2 64b
Goal:
- Create basic TXT files with details from each hosts
- Files should write in /root/ansible_facts.txt-hostname
Expected:
- Have 8 result files with details about servers
Issue:
- From 8 hosts only 4 details are writting (always the same hosts)
Playbook: gather_facts.yml
—> START
Can I see your inventory file?
Hi,
This is inventory file:
—> START
[vm-dev]
192.168.77.20 ansible_ssh_user=vagrant ansible_ssh_pass=vagrant
[ter1]
srv1
srv2
[ter2]
srv3
srv4
[ter3]
srv5
srv6
[ter4]
srv7
srv8
[ter-all:children]
ter1
ter2
ter3
ter4
—> END
I’ve also noticed that fin host 192.168.77.20 as vagrant user (in vagrant VM) there is a file created: {{g_ansible_facts_file}}-{{inventory_hostname}} - with 8 records which much 8 hosts in inventory.
But records are exectly command with ansible_facts (see previous email printf). So content have strings: {{ ansible_hostname}} , etc - not valies from ansible facter.
Hope that helps.
I look forward to hearing from you.
Best regards,
Marcin Praczko
You are referencing a group named “srv-all” that is not in the inventory file above. I suspect you are doing something a bit differently and are using a different inventory file.
Hi,
Thanks for point this, inventory file should have line: [srv-all:children] instead of [ter-all:children].
In my inventory srv1…srv8 are real hostnames from production servers which I don’t want copy here. So I rewrote inventory file and results by using terr1…terr2 and srv1…srv8.
So my last email with inventory had typo.
If this details are not sufficient, I can create some github code for vagrant which will allow repeat steps.
Please let me know your thougths.
Best regards,
Marcin Praczko