From c3f2b3e44dee4dfb02394b015cbe7d5467402e47 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Thu, 26 Mar 2020 08:14:53 -0400 Subject: [PATCH] bump versions of Galaxy collection requirements Implement 2.9 version policy Update ec2 collection name Enable ovirt, refresh test files Put in upstream forks to get it running for now pick up openstack.cloud fix --- awx/main/models/inventory.py | 14 +- .../inventory/plugins/ec2/files/aws_ec2.yml | 2 +- .../tests/data/inventory/plugins/rhv/env.json | 7 + .../plugins/rhv/files/file_reference | 5 + .../inventory/plugins/rhv/files/ovirt.yml | 1 + .../plugins/satellite6/files/foreman.yml | 19 ++ .../data/inventory/plugins/vmware/env.json | 7 + .../vmware/files/vmware_vm_inventory.yml | 215 ++++++++++++++++++ .../scripts/ec2/files/file_reference | 1 + requirements/collections_requirements.yml | 20 +- 10 files changed, 275 insertions(+), 16 deletions(-) create mode 100644 awx/main/tests/data/inventory/plugins/rhv/env.json create mode 100644 awx/main/tests/data/inventory/plugins/rhv/files/file_reference create mode 100644 awx/main/tests/data/inventory/plugins/rhv/files/ovirt.yml create mode 100644 awx/main/tests/data/inventory/plugins/vmware/env.json create mode 100644 awx/main/tests/data/inventory/plugins/vmware/files/vmware_vm_inventory.yml diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index 1c66c2eddc..b5c2f4f0d6 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -1616,7 +1616,7 @@ class PluginFileInjector(object): # so that a source without a collection will have null values namespace = None collection = None - collection_migration = '2.10' # In this version, content moved to collections + collection_migration = '2.9' # Starting with this version, we use collections def __init__(self, ansible_version): # This is InventoryOptions instance, could be source or inventory update @@ -1886,8 +1886,8 @@ class ec2(PluginFileInjector): initial_version = '2.9' # Driven by unsafe group names issue, parent_group templating, hostvars ini_env_reference = 'EC2_INI_PATH' base_injector = 'managed' - namespace = 'ansible' - collection = 'amazon' + namespace = 'amazon' + collection = 'aws' def get_plugin_env(self, *args, **kwargs): ret = super(ec2, self).get_plugin_env(*args, **kwargs) @@ -2230,10 +2230,10 @@ class gce(PluginFileInjector): class vmware(PluginFileInjector): plugin_name = 'vmware_vm_inventory' # FIXME: implement me - initial_version = '2.10' # Only tested with collection version, TODO: test 2.9 as candidate + initial_version = '2.9' # Only tested with collection version ini_env_reference = 'VMWARE_INI_PATH' base_injector = 'managed' - namespace = 'community' + namespace = 'alancoding' # FIXME collection = 'vmware' @property @@ -2584,7 +2584,7 @@ class openstack(PluginFileInjector): class rhv(PluginFileInjector): """ovirt uses the custom credential templating, and that is all """ - # plugin_name = 'FIXME' # contribute inventory plugin to Ansible + plugin_name = 'ovirt' base_injector = 'template' namespace = 'ovirt' collection = 'ovirt_collection' @@ -2597,7 +2597,7 @@ class rhv(PluginFileInjector): class satellite6(PluginFileInjector): plugin_name = 'foreman' ini_env_reference = 'FOREMAN_INI_PATH' - initial_version = '2.10' + initial_version = '2.9' # No base injector, because this does not work in playbooks. Bug?? namespace = 'theforeman' collection = 'foreman' diff --git a/awx/main/tests/data/inventory/plugins/ec2/files/aws_ec2.yml b/awx/main/tests/data/inventory/plugins/ec2/files/aws_ec2.yml index 257da7d611..fc7f9c2421 100644 --- a/awx/main/tests/data/inventory/plugins/ec2/files/aws_ec2.yml +++ b/awx/main/tests/data/inventory/plugins/ec2/files/aws_ec2.yml @@ -76,7 +76,7 @@ keyed_groups: parent_group: '{{ placement.region }}' prefix: '' separator: '' -plugin: ansible.amazon.aws_ec2 +plugin: amazon.aws.aws_ec2 regions: - us-east-2 - ap-south-1 diff --git a/awx/main/tests/data/inventory/plugins/rhv/env.json b/awx/main/tests/data/inventory/plugins/rhv/env.json new file mode 100644 index 0000000000..08477df169 --- /dev/null +++ b/awx/main/tests/data/inventory/plugins/rhv/env.json @@ -0,0 +1,7 @@ +{ + "ANSIBLE_TRANSFORM_INVALID_GROUP_CHARS": "never", + "OVIRT_INI_PATH": "{{ file_reference }}", + "OVIRT_PASSWORD": "fooo", + "OVIRT_URL": "https://foo.invalid", + "OVIRT_USERNAME": "fooo" +} \ No newline at end of file diff --git a/awx/main/tests/data/inventory/plugins/rhv/files/file_reference b/awx/main/tests/data/inventory/plugins/rhv/files/file_reference new file mode 100644 index 0000000000..06c2180789 --- /dev/null +++ b/awx/main/tests/data/inventory/plugins/rhv/files/file_reference @@ -0,0 +1,5 @@ +[ovirt] +ovirt_url=https://foo.invalid +ovirt_username=fooo +ovirt_password=fooo +ovirt_ca_file=fooo \ No newline at end of file diff --git a/awx/main/tests/data/inventory/plugins/rhv/files/ovirt.yml b/awx/main/tests/data/inventory/plugins/rhv/files/ovirt.yml new file mode 100644 index 0000000000..a2aacf5656 --- /dev/null +++ b/awx/main/tests/data/inventory/plugins/rhv/files/ovirt.yml @@ -0,0 +1 @@ +plugin: ovirt.ovirt_collection.ovirt diff --git a/awx/main/tests/data/inventory/plugins/satellite6/files/foreman.yml b/awx/main/tests/data/inventory/plugins/satellite6/files/foreman.yml index 4b950202b6..20d868137a 100644 --- a/awx/main/tests/data/inventory/plugins/satellite6/files/foreman.yml +++ b/awx/main/tests/data/inventory/plugins/satellite6/files/foreman.yml @@ -1 +1,20 @@ +keyed_groups: +- key: foreman['environment_name'] | lower | regex_replace(' ', '') | regex_replace('[^A-Za-z0-9\_]', '_') | regex_replace('none', '') + prefix: foreman_environment_ + separator: '' +- key: foreman['location_name'] | lower | regex_replace(' ', '') | regex_replace('[^A-Za-z0-9\_]', '_') + prefix: foreman_location_ + separator: '' +- key: foreman['organization_name'] | lower | regex_replace(' ', '') | regex_replace('[^A-Za-z0-9\_]', '_') + prefix: foreman_organization_ + separator: '' +- key: foreman['content_facet_attributes']['lifecycle_environment_name'] | lower | regex_replace(' ', '') | regex_replace('[^A-Za-z0-9\_]', '_') + prefix: foreman_lifecycle_environment_ + separator: '' +- key: foreman['content_facet_attributes']['content_view_name'] | lower | regex_replace(' ', '') | regex_replace('[^A-Za-z0-9\_]', '_') + prefix: foreman_content_view_ + separator: '' +legacy_hostvars: true plugin: theforeman.foreman.foreman +want_facts: true +want_params: true diff --git a/awx/main/tests/data/inventory/plugins/vmware/env.json b/awx/main/tests/data/inventory/plugins/vmware/env.json new file mode 100644 index 0000000000..97563377c0 --- /dev/null +++ b/awx/main/tests/data/inventory/plugins/vmware/env.json @@ -0,0 +1,7 @@ +{ + "ANSIBLE_TRANSFORM_INVALID_GROUP_CHARS": "never", + "VMWARE_HOST": "https://foo.invalid", + "VMWARE_PASSWORD": "fooo", + "VMWARE_USER": "fooo", + "VMWARE_VALIDATE_CERTS": "False" +} \ No newline at end of file diff --git a/awx/main/tests/data/inventory/plugins/vmware/files/vmware_vm_inventory.yml b/awx/main/tests/data/inventory/plugins/vmware/files/vmware_vm_inventory.yml new file mode 100644 index 0000000000..b83f8a77f7 --- /dev/null +++ b/awx/main/tests/data/inventory/plugins/vmware/files/vmware_vm_inventory.yml @@ -0,0 +1,215 @@ +plugin: community.vmware.vmware_vm_inventory +properties: +- name +- config.cpuHotAddEnabled +- config.cpuHotRemoveEnabled +- config.instanceUuid +- config.hardware.numCPU +- config.template +- config.name +- guest.hostName +- guest.ipAddress +- guest.guestId +- guest.guestState +- runtime.maxMemoryUsage +- customValue +- vpmcsupported +- vpmcenabled +- vmxconfigchecksum +- vmstorageobjectid +- vmnpivwwnupdatesupported +- vmnpivwwnsupported +- vmnpivwwndisablesupported +- vmfsnativesnapshotsupported +- vm +- virtualmmuusagesupported +- virtualmmuusageignored +- virtualexecusageignored +- vflashcachereservation +- vflashcacheallocation +- version +- vassertsenabled +- vappconfig +- value +- uuid +- triggeredalarmstate +- toolsversionstatus2 +- toolsversionstatus +- toolsversion +- toolsupdatestatus +- toolssynctimesupported +- toolsstatus +- toolsrunningstatus +- toolsrebootpredictsupported +- toolsinstalltype +- toolsinstallermounted +- toolsautoupdatesupported +- tools +- timestamp +- template +- tag +- swapstorageobjectid +- swapplacementsupported +- swapplacement +- suspendtime +- suspendinterval +- summary +- storage +- snapshotoperationssupported +- snapshotinbackground +- snapshotconfigsupported +- snapshot +- settingvideoramsizesupported +- settingscreenresolutionsupported +- settingdisplaytopologysupported +- settingdisplaytopologymodessupported +- sesparsedisksupported +- securebootsupported +- screen +- scheduledhardwareupgradeinfo +- s1acpimanagementsupported +- runtime +- rootsnapshot +- reverttosnapshotsupported +- resourcepool +- repconfig +- recordreplaysupported +- recordreplaystate +- recenttask +- quiescedsnapshotssupported +- quiescedforkparent +- quickstats +- question +- powerstate +- powerpolicy +- poweredonmonitortypechangesupported +- poweredoffsnapshotssupported +- pervmevcsupported +- permission +- perdatastoreusage +- paused +- parentvapp +- overallstatus +- onlinestandby +- offlinefeaturerequirement +- nummksconnections +- npivwwnonnonrdmvmsupported +- npivworldwidenametype +- npivtemporarydisabled +- npivportworldwidename +- npivonnonrdmdisks +- npivnodeworldwidename +- npivdesiredportwwns +- npivdesirednodewwns +- networkshaper +- network +- net +- nestedhvsupported +- nestedhvenabled +- needsecondaryreason +- name +- multiplesnapshotssupported +- multiplecorespersocketsupported +- modified +- minrequiredevcmodekey +- migrateencryption +- messagebustunnelenabled +- messagebussupported +- memorysnapshotssupported +- memoryreservationlocksupported +- memoryreservationlockedtomax +- memoryoverhead +- memoryhotaddenabled +- memoryallocation +- memoryaffinity +- maxmksconnections +- maxmemoryusage +- maxcpuusage +- managedby +- locksnapshotssupported +- locationid +- layoutex +- layout +- latencysensitivity +- keyid +- ipstack +- ipaddress +- interactiveguestoperationsready +- instantclonefrozen +- instanceuuid +- initialoverhead +- hotplugmemorylimit +- hotplugmemoryincrementsize +- hostname +- hostbasedreplicationsupported +- host +- hardware +- gueststatechangesupported +- gueststate +- guestoperationsready +- guestkernelcrashed +- guestintegrityinfo +- guestid +- guestheartbeatstatus +- guestfullname +- guestfamily +- guestautolocksupported +- guestautolockenabled +- guest +- generationinfo +- ftinfo +- forkconfiginfo +- flags +- firmware +- files +- featurerequirementsupported +- featurerequirement +- featuremask +- faulttolerancestate +- extraconfig +- effectiverole +- dynamictype +- dynamicproperty +- disksharessupported +- diskonlysnapshotonsuspendedvmsupported +- disk +- disablesnapshotssupported +- device +- defaultpowerops +- datastoreurl +- datastore +- dasvmprotection +- customvalue +- cryptostate +- createdate +- cpuhotremoveenabled +- cpuhotaddenabled +- cpufeaturemasksupported +- cpufeaturemask +- cpuallocation +- cpuaffinity +- runtime.consolidationneeded +- consolepreferencessupported +- consolepreferences +- connectionstate +- configstatus +- configissue +- config +- cleanpoweroff +- changeversion +- changetrackingsupported +- changetrackingenabled +- capability +- canconnectusbdevices +- boottime +- bootretryoptionssupported +- bootoptionssupported +- bootoptions +- availablefield +- appstate +- appheartbeatstatus +- ansible_uuid +- ansible_ssh_host +- ansible_host +- annotation +- alternateguestname diff --git a/awx/main/tests/data/inventory/scripts/ec2/files/file_reference b/awx/main/tests/data/inventory/scripts/ec2/files/file_reference index aef5c1441c..564e631ba0 100644 --- a/awx/main/tests/data/inventory/scripts/ec2/files/file_reference +++ b/awx/main/tests/data/inventory/scripts/ec2/files/file_reference @@ -1,6 +1,7 @@ [ec2] base_source_var = value_of_var boto_profile = /tmp/my_boto_stuff +iam_role_arn = arn:aws:iam::123456789012:role/test-role regions = us-east-2,ap-south-1 regions_exclude = us-gov-west-1,cn-north-1 destination_variable = public_dns_name diff --git a/requirements/collections_requirements.yml b/requirements/collections_requirements.yml index 4fe18f8a33..3f1b5bfe9b 100644 --- a/requirements/collections_requirements.yml +++ b/requirements/collections_requirements.yml @@ -2,12 +2,16 @@ collections: - name: awx.awx version: 9.3.0 - source: https://galaxy.ansible.com - name: azure.azcollection - version: 0.1.1 # https://github.com/ansible-collections/azure/issues/55 - # - name: ansible.amazon # needs to be published - - name: theforeman.foreman # needs inventory plugin published - - name: google.cloud # https://github.com/ansible-collections/ansible_collections_google/pull/167 - # - name: openstack.cloud # needs to be published - - name: community.vmware # needs patch https://github.com/ansible-collections/vmware/pull/58 - - name: ovirt.ovirt_collection # new fix published + version: 0.1.1 # questionable https://github.com/ansible-collections/azure/issues/55 + - name: amazon.aws + version: 0.1.0 + - name: theforeman.foreman + version: 0.7.0 # contains the inventory plugin, but more patches are needed + - name: google.cloud + version: 0.0.9 # contains PR 167, should be good to go + - name: openstack.cloud + version: 0.0.1-dev85 # earlier had checksum mismatch + - name: alancoding.vmware # FIXME needs patch https://github.com/ansible-collections/vmware/pull/58 + - name: ovirt.ovirt_collection + version: 1.0.1 # new fix published, should be good to go