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

Use ansible-runner in EmbeddedAnsible #18687

Merged
merged 11 commits into from
Jun 11, 2019

Commits on Jun 11, 2019

  1. Remove EmbeddedAnsible

    Fryguy authored and NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    e574cf6 View commit details
    Browse the repository at this point in the history
  2. Remove dependency of EmbeddedAnsible on AnsibleTower::Shared

    NickL Note:  Commenting out specs here that will fail, and
    re-implementing them as the logic is added in future commits.  Most pull
    in specs from the ansible_tower provider repo, so they are no longer
    valid anyway, but can't be tested at this stage since the new model code
    doesn't exist yet.
    
    Also, removed the shared specs for credential.rb for the moment.
    This will be revisited in the future, but for now doesn't have enough
    merit to be included with the current implementation.
    
    Worth noting, however, is the mthods `notify_on_provider_interaction?`
    and `.native_ref` have been added to the credential model, since that is
    currently the functionality of the AnsibleTower provider (and
    EmbeddedAnsible by virtue of the shared code between the two), so I
    mirrored that here.  This also fixes some test cases that were relying
    on the type casting of `native_ref` to work properly.
    
    The credential logic will be re-implemented and used in the future.
    Fryguy authored and NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    63be848 View commit details
    Browse the repository at this point in the history
  3. Add EmbeddedAnsible seeding

    NickL Note: Added the specs for fixing the embedded_ansible/provider.rb
    since it seems to be first edited an used here.  Most of the specs
    provided via `'ansible provider'` were not relevant for this current
    model, since most were surrounding the url parsing and normalizing that
    is done for the `default_endpoint.url`, which isn't valid for
    `ansible_runner` since it is run locally.
    
    Also, the factory needed to be changed to allow the provider_spec.rb to
    pass, which will possibly cause issues else where, but will be addressed
    in subsequent commits.
    Fryguy authored and NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    31a2f32 View commit details
    Browse the repository at this point in the history
  4. Add EmbeddedAnsible repository CRUD

    NickL Note: Used HIGH_PRIORITY here since that was what was used
    previously in the ansible_tower provider.  Arguably the wrong priority,
    but for now this allows the specs to work as they did.
    
    Also, with this one we trade what used to check for proper refresh logic
    and do some light confirming of `git` logic being done properly under
    the hood.  This is far from exhaustive tests on the subject, but I think
    it is a nice start without getting too into the weeds with the guts for
    the git logic that will most likely be removed before too long.
    Fryguy authored and NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    78c9290 View commit details
    Browse the repository at this point in the history
  5. Add synchronization of playbooks

    Fryguy authored and NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    edadbed View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5856659 View commit details
    Browse the repository at this point in the history
  7. Add EmbeddedAnsible ServiceTemplate (ConfigurationScript) CRUD

    NickL Note: The specs mostly represent the previous spec definitions
    pulled in from `it_behaves_like 'ansible configuration_script'`, but
    updates those to properly handle the code that doesn't inherit from the
    ansible_tower provider code any more.  That said, some behaviour has
    been dropped since it no longer makes sense.
    
    One change specifically that couldn't be supported as part of this
    change is the validations, since we would need to add those on the
    model side in ManageIQ (previously handled via tower), and am unsure if
    that is functionality we want to keep or not.  The test is left there as
    a note (commented out).
    Fryguy authored and NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    4a26163 View commit details
    Browse the repository at this point in the history
  8. Add end to end lauching of Embedded Ansible via ansible-runner

    NickL Note: Pulls in specs from the manageiq-providers-ansible_tower repo for
    the job/status.rb, but makes them relevant for the new ansible_runner code.
    
    The job/status.rb model also is a bit odd in it's implementation.
    Mostly trying to keep things as close to how they worked previously,
    though as mentioned in the comments, `OrchestrationStack::Status` and
    `MiqTask` don't have a 1-to-1 status comparison, so some "fudging" was
    necessary to keep things as DRY as possible and be able to use some of
    the inherited methods from `OrchestrationStack::Status`.
    
    Also worth noting is the change of #merge_extra_vars compared to what is
    done in manageiq-providers-ansible_tower.  Here, we don't return a hash
    of `{:extra_vars => my_merged_vars}` since we would end up just
    accessing the `:extra_vars` key directly anyway and only that in the
    only caller `#run`.
    
    Also also:  The specs added to this commit are from yours truely (NickL), and
    there is a decent amount here that we still need to implement, but some that my
    stupid head can't figure out how to test properly currently so I think this is
    "good enough for government work" for the time being.  Left a lot of notes in
    this one since there are clearly some spots that need to be implemented if we
    are going to try and keep a parity with the existing functionality.
    Fryguy authored and NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    ce8a76f View commit details
    Browse the repository at this point in the history
  9. s/tower/runner/ in service_ansible_playbook_spec

    Using the "Tower" nomenclature is no longer valid when referring to
    EmbeddedAnsible.
    
    ... and yes, "nomenclature" is in my vernacular thanks to "The Big
    Lebowski"
    
    deal with it
    NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    9feb3a5 View commit details
    Browse the repository at this point in the history
  10. Use proper class method notation

    This was pedantic and just was bugging me... move along...
    NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    9dac412 View commit details
    Browse the repository at this point in the history
  11. Allow playbooks to run using ansible-runner from automate

    We need the parent playbook id in order to find the filesystem
    path for the playbook later on.
    carbonin authored and NickLaMuro committed Jun 11, 2019
    Configuration menu
    Copy the full SHA
    93eb27a View commit details
    Browse the repository at this point in the history