Ansible 2.1.0, I used --limit to run a playbook and host file hostvars for the host didn't load

296 views
Skip to first unread message

Joanna Delaporte

unread,
Dec 16, 2015, 12:37:45 PM12/16/15
to Ansible Project
Last night, I ran a playbook that had a group specified for hosts. That group has a custom variable defined in my inventory. On the command line I used --limit=jupiter to test on a single host. The defined hostvar was not loaded, apparently, because my machine had patches installed from a 32-bit mounted repo rather than 64-bit. Just a few days ago, I ran this playbook for the whole group with no problems, so the hostvar was correctly read then. 

The command-line:
$ ansible-playbook slack_lab_update.yml --limit=jupiter

My hosts defined in the playbook:
- hosts: slackware-lab-64
  sudo: yes
  
  roles:
    - slack_lab

  post_tasks:
    
    - name: Reboot host(s)?

In the /etc/hosts file, I have the group, with a set variable, as follows:

[slackware-lab-64]
192.168.0.[30:53]
jupiter
linux1
linux2
linux3

[slackware-lab-64:vars]
lib_arch=64


Well, I did have this var defined, until last night. I ended up re-installing the machine. Now, I have replaced every lib_arch custom variable reference in every playbook with ansible_userspace_bits, since I figured out that is an option. However, Ansible should probably have read that variable for my one host, since it is a member of the group. 

$ ansible --version
ansible 2.1.0

Reply all
Reply to author
Forward
0 new messages