Bug 1734902 - An embedded Ansible playbook cannot find the shipped manageiq-core.manageiq-automate role
Summary: An embedded Ansible playbook cannot find the shipped manageiq-core.manageiq-a...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.11.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.11.0
Assignee: Nick Carboni
QA Contact: Satyajit Bulage
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On: 1738542
Blocks: 1677548
TreeView+ depends on / blocked
 
Reported: 2019-07-31 16:16 UTC by Peter McGowan
Modified: 2020-02-13 22:26 UTC (History)
10 users (show)

Fixed In Version: 5.11.0.18
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-12-13 14:57:11 UTC
Category: Bug
Cloudforms Team: Ansible
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Playbook to reproduce the problem (814 bytes, text/plain)
2019-07-31 16:16 UTC, Peter McGowan
no flags Details

Description Peter McGowan 2019-07-31 16:16:59 UTC
Created attachment 1595273 [details]
Playbook to reproduce the problem

Description of problem:
The manageiq-core.manageiq-automate role is not shipped with CloudForms (in /var/www/miq/vmdb/content/ansible_consolidated/roles/manageiq-core.manageiq-automate), however Embedded Ansible does not find it.

Running a playbook with the following yaml:

  roles:
  - manageiq-core.manageiq-automate

Results in the following being written to evm.log:

[----] W, [2019-07-31T16:55:07.677512 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at 'ERROR! the role 'manageiq-core.manageiq-automate' was not found in /tmp/ansible-playbook-repo20190731-8940-r7jwcf/roles:/root/.ansible/roles:/usr/sha
re/ansible/roles:/etc/ansible/roles:/tmp/ansible-playbook-repo20190731-8940-r7jwcf
'
[----] W, [2019-07-31T16:55:07.677713 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at ''
[----] W, [2019-07-31T16:55:07.677767 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at 'The error appears to be in '/tmp/ansible-playbook-repo20190731-8940-r7jwcf/manageiq_automate_role_examples.yml': line 11, column 5, but may
'
[----] W, [2019-07-31T16:55:07.677815 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at 'be elsewhere in the file depending on the exact syntax problem.
'
[----] W, [2019-07-31T16:55:07.677864 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at ''
[----] W, [2019-07-31T16:55:07.677908 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at 'The offending line appears to be:
'
[----] W, [2019-07-31T16:55:07.677953 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at ''
[----] W, [2019-07-31T16:55:07.677999 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at 'roles:
'
[----] W, [2019-07-31T16:55:07.678043 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at '- manageiq-core.manageiq-automate
'
[----] W, [2019-07-31T16:55:07.678085 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(Ansible::Runner::Response#parse_stdout) Couldn't parse JSON from: 765: unexpected token at '^ here
'
[----] W, [2019-07-31T16:55:07.816800 #8931:2ac23e5fe5bc]  WARN -- : Q-task_id([90f5a65e-6bf2-465a-a530-cf1cb59a28ad]) MIQ(ManageIQ::Providers::AnsiblePlaybookWorkflow#poll_runner) Playbook failed:

Version-Release number of selected component (if applicable):
5.11.0.17

How reproducible:
Every time

Steps to Reproduce:
1. Create a playbook that references the built-in manageiq-core.manageiq-automate role
2. Run the playbook from Embedded Ansible

Actual results:
The playbook will fail to locate the role

Expected results:
The playbook should locate and run the role

Additional info:
The attached playbook illustrates the problem

Comment 2 Nick Carboni 2019-07-31 19:55:15 UTC
Peter, I made some changes and I'm now seeing the playbook make an attempt to run something that looks like it's coming from the role, but it's still failing. I'm not sure if this is intended (or some bug in the role). What do you think?

Here's the output I'm getting with my changes:

[----] I, [2019-07-31T15:53:07.528940 #13951:2b098d0725bc]  INFO -- : Q-task_id([r5_service_template_provision_task_5]) MIQ(ManageIQ::Providers::EmbeddedAnsible::AutomationManager::PlaybookRunner#log_stdout) Stdout from playbook manageiq-automate_role_bug_example.yml: 

PLAY [manageiq-automate role bug example] **************************************

TASK [manageiq-core.manageiq-automate : Initialize the Workspace] **************

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'dict' object has no attribute 'iteritems'
fatal: [localhost]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/libexec/platform-python"}, "changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1564602748.1169078-260481528705529/AnsiballZ_manageiq_automate.py\", line 114, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1564602748.1169078-260481528705529/AnsiballZ_manageiq_automate.py\", line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1564602748.1169078-260481528705529/AnsiballZ_manageiq_automate.py\", line 49, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/usr/lib64/python3.6/imp.py\", line 235, in load_module\n    return load_source(name, filename, file)\n  File \"/usr/lib64/python3.6/imp.py\", line 170, in load_source\n    module = _exec(spec, sys.modules[name])\n  File \"<frozen importlib._bootstrap>\", line 618, in _exec\n  File \"<frozen importlib._bootstrap_external>\", line 678, in exec_module\n  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n  File \"/tmp/ansible_manageiq_automate_payload_mwfakkab/__main__.py\", line 503, in <module>\n  File \"/tmp/ansible_manageiq_automate_payload_mwfakkab/__main__.py\", line 489, in main\nAttributeError: 'dict' object has no attribute 'iteritems'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Comment 3 Peter McGowan 2019-08-01 07:22:06 UTC
It looks like we're now using Python3 and iteritems has been removed (https://www.python.org/dev/peps/pep-0469/).  This would indeed seem to be a bug with the manageiq-core.manageiq-automate role, but may also have implications with other roles.

Comment 4 Nick Carboni 2019-08-01 13:37:08 UTC
Indeed, python 3 is now the default version in RHEL 8 https://developers.redhat.com/blog/2018/11/14/python-in-rhel-8/

Comment 5 Peter McGowan 2019-08-01 13:41:22 UTC
I've just noticed that the original description should read:

The manageiq-core.manageiq-automate role is now shipped with CloudForms
                                              ^

Comment 6 CFME Bot 2019-08-01 20:11:28 UTC
New commit detected on ManageIQ/manageiq-appliance/master:

https://github.com/ManageIQ/manageiq-appliance/commit/2ea7fe4d184bf381e9c08f4bae19ddd84b4da92f
commit 2ea7fe4d184bf381e9c08f4bae19ddd84b4da92f
Author:     Nick Carboni <ncarboni>
AuthorDate: Thu Aug  1 15:57:52 2019 -0400
Commit:     Nick Carboni <ncarboni>
CommitDate: Thu Aug  1 15:57:52 2019 -0400

    Correct the ansible config section name

    The ini file section name is "defaults" not "default"

    This is why the roles path change was being ignored.
    ref: https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-roles-path

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1734902

 LINK/root/.ansible.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 7 CFME Bot 2019-08-01 22:40:59 UTC
New commit detected on ManageIQ/manageiq-appliance/ivanchuk:

https://github.com/ManageIQ/manageiq-appliance/commit/10e7d53685ef0677c0f0b158f02aa80fc5ab2a86
commit 10e7d53685ef0677c0f0b158f02aa80fc5ab2a86
Author:     Jason Frey <jfrey>
AuthorDate: Thu Aug  1 16:10:01 2019 -0400
Commit:     Jason Frey <jfrey>
CommitDate: Thu Aug  1 16:10:01 2019 -0400

    Merge pull request #249 from carbonin/use_correct_section_header

    Correct the ansible config section name

    (cherry picked from commit 086bddb1d9c6be9e0c03c509fd0f661458523be5)

    https://bugzilla.redhat.com/show_bug.cgi?id=1734902

 LINK/root/.ansible.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 10 Satyajit Bulage 2019-08-12 07:12:01 UTC
Error in this BZ has been fixed in --> https://bugzilla.redhat.com/show_bug.cgi?id=1738542

Comment 12 Satyajit Bulage 2019-08-20 15:03:42 UTC
After running attached playbook in simulation, able to see it is using added role without any error.
Also, the BZ causing error(see comment 2) has been fixed.

Verified Version: 5.11.0.19.20190813184334_ed72c9f


Note You need to log in before you can comment on or make changes to this bug.