Last active
April 28, 2022 22:52
-
-
Save patrickmslatteryvt/d9ef798a44e598cf682cd978d4fe6474 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This works: | |
- include_role: | |
name: mwg.svn | |
tasks_from: create-repo | |
vars: | |
svn_instance: svn | |
svn_repo: subversion | |
# This does not: | |
- include_role: | |
name: mwg.svn | |
tasks_from: create-repo | |
with_items: | |
- { svn_instance: 'svn', svn_repo: 'subversion' } | |
- { svn_instance: 'svn', svn_repo: 'Development' } | |
- { svn_instance: 'svn', svn_repo: 'Retail' } | |
- { svn_instance: 'svn', svn_repo: 'Sitecore' } | |
- { svn_instance: 'svn', svn_repo: '_template' } | |
- { svn_instance: 'svn', svn_repo: 'perftest' } | |
loop_control: | |
loop_var: roleinputvar | |
# It gives the error: | |
TASK [mwg.svn] ***************************************************************** | |
task path: /xxxxx/ansible-playbooks/playbooks/corp-install-svn.yaml:17 | |
Monday 24 October 2016 19:34:39 -0400 (0:00:00.030) 0:00:04.062 ******** | |
An exception occurred during task execution. The full traceback is: | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/executor/task_executor.py", line 94, in run | |
item_results = self._run_loop(items) | |
File "/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/executor/task_executor.py", line 268, in _run_loop | |
res = self._execute(variables=task_vars) | |
File "/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/executor/task_executor.py", line 423, in _execute | |
role = templar.template(self._task._role_name) | |
AttributeError: 'IncludeRole' object has no attribute '_role_name' | |
fatal: [svn.devdmz.mywebgrocer.com]: FAILED! => { | |
"failed": true, | |
"msg": "Unexpected failure during module execution.", | |
"stdout": "" | |
} | |
ERROR! Unexpected Exception: 'results' | |
the full traceback was: | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/EGG-INFO/scripts/ansible-playbook", line 103, in <module> | |
exit_code = cli.run() | |
File "/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/cli/playbook.py", line 159, in run | |
results = pbex.run() | |
File "/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/executor/playbook_executor.py", line 154, in run | |
result = self._tqm.run(play=play) | |
File "/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/executor/task_queue_manager.py", line 282, in run | |
play_return = strategy.run(iterator, play_context) | |
File "/usr/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/plugins/strategy/linear.py", line 290, in run | |
include_results = hr._result['results'] | |
KeyError: 'results' | |
# installed latest Ansible | |
[root@pslattery990 /] # rm -rf /home/pslattery/ansible | |
[root@pslattery990 /] # git clone --depth=1 --branch=devel --recursive https://github.com/ansible/ansible.git /home/pslattery/ansible | |
Cloning into '/home/pslattery/ansible'... | |
remote: Counting objects: 2174, done. | |
remote: Compressing objects: 100% (1573/1573), done. | |
remote: Total 2174 (delta 179), reused 1489 (delta 90), pack-reused 0 | |
Receiving objects: 100% (2174/2174), 1.99 MiB | 0 bytes/s, done. | |
Resolving deltas: 100% (179/179), done. | |
Checking connectivity... done. | |
Submodule 'lib/ansible/modules/core' (https://github.com/ansible/ansible-modules-core) registered for path 'lib/ansible/modules/core' | |
Submodule 'lib/ansible/modules/extras' (https://github.com/ansible/ansible-modules-extras) registered for path 'lib/ansible/modules/extras' | |
Cloning into '/home/pslattery/ansible/lib/ansible/modules/core'... | |
Cloning into '/home/pslattery/ansible/lib/ansible/modules/extras'... | |
Submodule path 'lib/ansible/modules/core': checked out '124bb9241694aa5492a85e7abfabd3720ae2b682' | |
Submodule path 'lib/ansible/modules/extras': checked out '8ffe314ea55798c3af8b8a2e74782c190a19ef55' | |
[root@pslattery990 /] # cd /home/pslattery/ansible | |
[root@pslattery990 ansible] # git pull --rebase | |
Current branch devel is up to date. | |
[root@pslattery990 ansible] # git submodule update --init --recursive | |
[root@pslattery990 ansible] # ansible all -m ping --ask-pass | |
SSH password: [ERROR]: User interrupted execution | |
[root@pslattery990 ansible] # ansible --version | |
ansible 2.2.0 | |
config file = | |
configured module search path = Default w/o overrides | |
# After doing "make clean" it works, the old compiled Python bits were obstructing the latest bits: | |
# Below is the working code: | |
- name: "Create the bare SVN repos" | |
include_role: | |
name: mwg.svn | |
tasks_from: create-repo | |
vars: | |
svn_instance: "{{ item.svn_instance }}" | |
svn_repo: "{{ item.svn_repo }}" | |
with_items: | |
- { svn_instance: 'svn', svn_repo: 'Development' } | |
- { svn_instance: 'svn', svn_repo: 'Retail' } | |
- { svn_instance: 'svn', svn_repo: 'Sitecore' } | |
- { svn_instance: 'svn', svn_repo: '_template' } | |
- { svn_instance: 'svn', svn_repo: 'perftest' } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment