Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback from the manager and possible problem not templating vars_file filenames #13398

Closed
abadger opened this issue Dec 2, 2015 · 0 comments
Milestone

Comments

@abadger
Copy link
Contributor

abadger commented Dec 2, 2015

Playbook:

$ cat noc-narrow.yml
- name: deploy service-specific config
  hosts: batcave
  user: root
  gather_facts: True

  vars_files: 
   - "/home/fedora/toshio/global.yml"
   - "/home/fedora/toshio/nagios.{{ inventory_hostname_short }}.yml"
  tasks:
    - debug: var=inventory_hostname_short
    - debug: var=bigfiles
    - debug: var=tester
    - name: fill up the tftpboot directory
      synchronize: src="{{ bigfiles }}/tftpboot/" dest=/var/tmp/tftpboot/

Vars files:

$ cat ~/global.yml

---
bigfiles: /srv/web/infra/bigfiles
$ cat ~/batcave01.yml 

---
tester: "is a test"

Output:

# ansible-playbook noc-narrow.yml  -vvvv
Using /etc/ansible/ansible.cfg as config file
1 plays in noc-narrow.yml
skipping vars_file '/home/fedora/toshio/nagios.{{ inventory_hostname_short }}.yml' due to an undefined variable
Loaded callback default of type stdout, v2.0
skipping vars_file '/home/fedora/toshio/nagios.{{ inventory_hostname_short }}.yml' due to an undefined variable

PLAY [deploy service-specific config] ******************************************

TASK [setup] *******************************************************************
<batcave01.phx2.fedoraproject.org> ESTABLISH SSH CONNECTION FOR USER: root
<batcave01.phx2.fedoraproject.org> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=90 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r batcave01.phx2.fedoraproject.org LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python
ok: [batcave01.phx2.fedoraproject.org]

TASK [debug var=inventory_hostname_short] **************************************
task path: /home/fedora/toshio/ansible/playbooks/groups/noc-narrow.yml:10
ok: [batcave01.phx2.fedoraproject.org] => {
    "changed": false, 
    "inventory_hostname_short": "batcave01", 
    "invocation": {
        "module_args": {
            "var": "inventory_hostname_short"
        }, 
        "module_name": "debug"
    }
}

TASK [debug var=bigfiles] ******************************************************
task path: /home/fedora/toshio/ansible/playbooks/groups/noc-narrow.yml:11
ok: [batcave01.phx2.fedoraproject.org] => {
    "bigfiles": "/srv/web/infra/bigfiles", 
    "changed": false, 
    "invocation": {
        "module_args": {
            "var": "bigfiles"
        }, 
        "module_name": "debug"
    }
}

TASK [debug var=tester] ********************************************************
task path: /home/fedora/toshio/ansible/playbooks/groups/noc-narrow.yml:12
ok: [batcave01.phx2.fedoraproject.org] => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "var": "tester"
        }, 
        "module_name": "debug"
    }, 
    "tester": "VARIABLE IS NOT DEFINED!"
}

TASK [fill up the tftpboot directory] ******************************************
task path: /home/fedora/toshio/ansible/playbooks/groups/noc-narrow.yml:13
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/home/fedora/toshio/ansible-upstream/lib/ansible/executor/process/worker.py", line 135, in run
    shared_loader_obj,
  File "/home/fedora/toshio/ansible-upstream/lib/ansible/executor/task_executor.py", line 119, in run
    res = self._execute()
  File "/home/fedora/toshio/ansible-upstream/lib/ansible/executor/task_executor.py", line 402, in _execute
    result = self._handler.run(task_vars=variables)
  File "/home/fedora/toshio/ansible-upstream/lib/ansible/plugins/action/synchronize.py", line 171, in run
    self._override_module_replaced_vars(task_vars)
  File "/home/fedora/toshio/ansible-upstream/lib/ansible/plugins/action/synchronize.py", line 96, in _override_module_replaced_vars
    localhost = task_vars['hostvars'][host]
  File "<string>", line 2, in __getitem__
  File "/usr/lib64/python2.7/multiprocessing/managers.py", line 759, in _callmethod
    kind, result = conn.recv()
TypeError: ('__init__() takes at least 2 arguments (1 given)', <class 'ansible.errors.AnsibleFileNotFound'>, ())

fatal: [batcave01.phx2.fedoraproject.org]: FAILED! => {"failed": true, "stdout": ""}

PLAY RECAP *********************************************************************
batcave01.phx2.fedoraproject.org : ok=4    changed=0    unreachable=0    failed=1 

Problems:

  • Traceback is hard to understand... Probably there's an error being raised in the worker but it's being obfuscated by a second traceback being raised in the manager
  • tester is not defined... That probably means that the vars_file with inventory_hostname_short isn't being resolved. Change from 1.9... is it intentional?
@abadger abadger added this to the v2 milestone Dec 2, 2015
jimi-c added a commit that referenced this issue Dec 2, 2015
@jimi-c jimi-c closed this as completed in a183972 Dec 2, 2015
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant