diff --git a/.gitignore b/.gitignore index 029519e..fe044d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ +# python stuff __pycache__/ -*.py[cod] \ No newline at end of file +*.py[cod] + +# ansible-test stuff +/tests/output/ + +# antsibull-changelog stuff +/changelogs/.plugin-cache.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..6d4f63f --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,15 @@ +=============================== +Community.Libvirt Release Notes +=============================== + +.. contents:: Topics + + +v1.0.0 +====== + +Major Changes +------------- + +- added generic libvirt inventory plugin +- removed libvirt_lxc inventory script diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml new file mode 100644 index 0000000..94ddca7 --- /dev/null +++ b/changelogs/changelog.yaml @@ -0,0 +1,10 @@ +ancestor: null +releases: + 1.0.0: + changes: + major_changes: + - added generic libvirt inventory plugin + - removed libvirt_lxc inventory script + fragments: + - 23-inventory.yml + release_date: '2020-08-18' diff --git a/changelogs/config.yaml b/changelogs/config.yaml new file mode 100644 index 0000000..83e48d0 --- /dev/null +++ b/changelogs/config.yaml @@ -0,0 +1,31 @@ +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: Community.Libvirt +trivial_section_name: trivial +use_fqcn: true diff --git a/changelogs/fragments/23-inventory.yml b/changelogs/fragments/23-inventory.yml deleted file mode 100644 index 89364e4..0000000 --- a/changelogs/fragments/23-inventory.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -major_changes: - - removed libvirt_lxc inventory script - - added generic libvirt inventory plugin diff --git a/galaxy.yml b/galaxy.yml index 4bff825..317a806 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,6 +1,6 @@ namespace: community name: libvirt -version: 0.1.0 +version: 1.0.0 readme: README.md authors: - Ansible (https://github.com/ansible) diff --git a/meta/runtime.yml b/meta/runtime.yml new file mode 100644 index 0000000..2ee3c9f --- /dev/null +++ b/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +requires_ansible: '>=2.9.10' diff --git a/plugins/connection/libvirt_lxc.py b/plugins/connection/libvirt_lxc.py index 4f80299..947be7b 100644 --- a/plugins/connection/libvirt_lxc.py +++ b/plugins/connection/libvirt_lxc.py @@ -10,7 +10,7 @@ DOCUMENTATION = ''' author: Michael Scherer - connection: libvirt_lxc + connection: community.libvirt.libvirt_lxc short_description: Run tasks in lxc containers via libvirt description: - Run commands or put/fetch files to an existing lxc container using libvirt diff --git a/plugins/modules/virt.py b/plugins/modules/virt.py index 7370197..deb03a4 100644 --- a/plugins/modules/virt.py +++ b/plugins/modules/virt.py @@ -9,9 +9,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -67,7 +64,7 @@ EXAMPLES = ''' # a playbook task line: -- virt: +- community.libvirt.virt: name: alpha state: running @@ -78,37 +75,37 @@ # defining and launching an LXC guest - name: define vm - virt: + community.libvirt.virt: command: define xml: "{{ lookup('template', 'container-template.xml.j2') }}" uri: 'lxc:///' - name: start vm - virt: + community.libvirt.virt: name: foo state: running uri: 'lxc:///' # setting autostart on a qemu VM (default uri) - name: set autostart for a VM - virt: + community.libvirt.virt: name: foo autostart: yes # Defining a VM and making is autostart with host. VM will be off after this task - name: define vm from xml and set autostart - virt: + community.libvirt.virt: command: define xml: "{{ lookup('template', 'vm_template.xml.j2') }}" autostart: yes # Listing VMs - name: list all VMs - virt: + community.libvirt.virt: command: list_vms register: all_vms - name: list only running VMs - virt: + community.libvirt.virt: command: list_vms state: running register: running_vms diff --git a/plugins/modules/virt_net.py b/plugins/modules/virt_net.py index f6b451c..3101988 100644 --- a/plugins/modules/virt_net.py +++ b/plugins/modules/virt_net.py @@ -8,11 +8,6 @@ __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - - DOCUMENTATION = ''' --- module: virt_net @@ -73,69 +68,69 @@ EXAMPLES = ''' # Define a new network -- virt_net: +- community.libvirt.virt_net: command: define name: br_nat xml: '{{ lookup("template", "network/bridge.xml.j2") }}' # Start a network -- virt_net: +- community.libvirt.virt_net: command: create name: br_nat # List available networks -- virt_net: +- community.libvirt.virt_net: command: list_nets # Get XML data of a specified network -- virt_net: +- community.libvirt.virt_net: command: get_xml name: br_nat # Stop a network -- virt_net: +- community.libvirt.virt_net: command: destroy name: br_nat # Undefine a network -- virt_net: +- community.libvirt.virt_net: command: undefine name: br_nat # Gather facts about networks # Facts will be available as 'ansible_libvirt_networks' -- virt_net: +- community.libvirt.virt_net: command: facts # Gather information about network managed by 'libvirt' remotely using uri -- virt_net: +- community.libvirt.virt_net: command: info uri: '{{ item }}' with_items: '{{ libvirt_uris }}' register: networks # Ensure that a network is active (needs to be defined and built first) -- virt_net: +- community.libvirt.virt_net: state: active name: br_nat # Ensure that a network is inactive -- virt_net: +- community.libvirt.virt_net: state: inactive name: br_nat # Ensure that a given network will be started at boot -- virt_net: +- community.libvirt.virt_net: autostart: yes name: br_nat # Disable autostart for a given network -- virt_net: +- community.libvirt.virt_net: autostart: no name: br_nat # Add a new host in the dhcp pool -- virt_net: +- community.libvirt.virt_net: name: br_nat command: modify xml: "" diff --git a/plugins/modules/virt_pool.py b/plugins/modules/virt_pool.py index 85e8c3c..ce8da46 100644 --- a/plugins/modules/virt_pool.py +++ b/plugins/modules/virt_pool.py @@ -8,11 +8,6 @@ __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - - DOCUMENTATION = ''' --- module: virt_pool @@ -79,74 +74,74 @@ EXAMPLES = ''' # Define a new storage pool -- virt_pool: +- community.libvirt.virt_pool: command: define name: vms xml: '{{ lookup("template", "pool/dir.xml.j2") }}' # Build a storage pool if it does not exist -- virt_pool: +- community.libvirt.virt_pool: command: build name: vms # Start a storage pool -- virt_pool: +- community.libvirt.virt_pool: command: create name: vms # List available pools -- virt_pool: +- community.libvirt.virt_pool: command: list_pools # Get XML data of a specified pool -- virt_pool: +- community.libvirt.virt_pool: command: get_xml name: vms # Stop a storage pool -- virt_pool: +- community.libvirt.virt_pool: command: destroy name: vms # Delete a storage pool (destroys contents) -- virt_pool: +- community.libvirt.virt_pool: command: delete name: vms # Undefine a storage pool -- virt_pool: +- community.libvirt.virt_pool: command: undefine name: vms # Gather facts about storage pools # Facts will be available as 'ansible_libvirt_pools' -- virt_pool: +- community.libvirt.virt_pool: command: facts # Gather information about pools managed by 'libvirt' remotely using uri -- virt_pool: +- community.libvirt.virt_pool: command: info uri: '{{ item }}' with_items: '{{ libvirt_uris }}' register: storage_pools # Ensure that a pool is active (needs to be defined and built first) -- virt_pool: +- community.libvirt.virt_pool: state: active name: vms # Ensure that a pool is inactive -- virt_pool: +- community.libvirt.virt_pool: state: inactive name: vms # Ensure that a given pool will be started at boot -- virt_pool: +- community.libvirt.virt_pool: autostart: yes name: vms # Disable autostart for a given pool -- virt_pool: +- community.libvirt.virt_pool: autostart: no name: vms ''' diff --git a/shippable.yml b/shippable.yml index 3069fc9..c0b5154 100644 --- a/shippable.yml +++ b/shippable.yml @@ -24,15 +24,15 @@ matrix: # - env: T=aix/7.2/1 # - env: T=osx/10.11/1 - - env: T=rhel/7.6/1 - - env: T=rhel/8.1/1 + - env: T=rhel/7.8/1 + - env: T=rhel/8.2/1 - env: T=freebsd/11.1/1 - env: T=freebsd/12.1/1 - env: T=linux/centos6/1 - env: T=linux/centos7/1 - env: T=linux/centos8/1 - - env: T=linux/fedora30/1 - env: T=linux/fedora31/1 + - env: T=linux/fedora32/1 - env: T=linux/opensuse15py2/1 - env: T=linux/opensuse15/1 - env: T=linux/ubuntu1604/1 diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt deleted file mode 100644 index 8d5eb32..0000000 --- a/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/unit/mock/path.py future-import-boilerplate -tests/unit/mock/path.py metaclass-boilerplate -tests/unit/mock/yaml_helper.py future-import-boilerplate -tests/unit/mock/yaml_helper.py metaclass-boilerplate -tests/unit/modules/cloud/misc/virt_net/conftest.py future-import-boilerplate -tests/unit/modules/cloud/misc/virt_net/conftest.py metaclass-boilerplate -tests/unit/modules/cloud/misc/virt_net/test_virt_net.py future-import-boilerplate -tests/unit/modules/cloud/misc/virt_net/test_virt_net.py metaclass-boilerplate -tests/utils/shippable/timing.py shebang diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt new file mode 120000 index 0000000..f749b40 --- /dev/null +++ b/tests/sanity/ignore-2.10.txt @@ -0,0 +1 @@ +ignore.txt \ No newline at end of file diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt new file mode 120000 index 0000000..f749b40 --- /dev/null +++ b/tests/sanity/ignore-2.11.txt @@ -0,0 +1 @@ +ignore.txt \ No newline at end of file diff --git a/tests/sanity/ignore.txt b/tests/sanity/ignore.txt new file mode 100644 index 0000000..8d5eb32 --- /dev/null +++ b/tests/sanity/ignore.txt @@ -0,0 +1,9 @@ +tests/unit/mock/path.py future-import-boilerplate +tests/unit/mock/path.py metaclass-boilerplate +tests/unit/mock/yaml_helper.py future-import-boilerplate +tests/unit/mock/yaml_helper.py metaclass-boilerplate +tests/unit/modules/cloud/misc/virt_net/conftest.py future-import-boilerplate +tests/unit/modules/cloud/misc/virt_net/conftest.py metaclass-boilerplate +tests/unit/modules/cloud/misc/virt_net/test_virt_net.py future-import-boilerplate +tests/unit/modules/cloud/misc/virt_net/test_virt_net.py metaclass-boilerplate +tests/utils/shippable/timing.py shebang diff --git a/tests/utils/shippable/cloud.sh b/tests/utils/shippable/cloud.sh index da037e0..d76c322 100755 --- a/tests/utils/shippable/cloud.sh +++ b/tests/utils/shippable/cloud.sh @@ -13,22 +13,7 @@ target="shippable/${cloud}/group${group}/" stage="${S:-prod}" -changed_all_target="shippable/${cloud}/smoketest/" - -if ! ansible-test integration "${changed_all_target}" --list-targets > /dev/null 2>&1; then - # no smoketest tests are available for this cloud - changed_all_target="none" -fi - -if [ "${group}" == "1" ]; then - # only run smoketest tests for group1 - changed_all_mode="include" -else - # smoketest tests already covered by group1 - changed_all_mode="exclude" -fi - # shellcheck disable=SC2086 ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \ --remote-terminate always --remote-stage "${stage}" \ - --docker --python "${python}" --changed-all-target "${changed_all_target}" --changed-all-mode "${changed_all_mode}" + --docker --python "${python}" diff --git a/tests/utils/shippable/shippable.sh b/tests/utils/shippable/shippable.sh index eb967d8..49ab106 100755 --- a/tests/utils/shippable/shippable.sh +++ b/tests/utils/shippable/shippable.sh @@ -127,27 +127,6 @@ else timeout=45 fi -# STAR: HACK install dependencies - -#ansible-galaxy collection install ansible.windows -p "${COLLECTION_DIR}" -ansible-galaxy collection install ansible.posix -p "${COLLECTION_DIR}" -ansible-galaxy collection install community.crypto -p "${COLLECTION_DIR}" -ansible-galaxy collection install ansible.netcommon -p "${COLLECTION_DIR}" - -# unit tests -ansible-galaxy collection install community.kubernetes -p "${COLLECTION_DIR}" -ansible-galaxy collection install netbox.netbox -p "${COLLECTION_DIR}" -ansible-galaxy collection install netapp.ontap -p "${COLLECTION_DIR}" -ansible-galaxy collection install cisco.meraki -p "${COLLECTION_DIR}" -ansible-galaxy collection install fortinet.fortios -p "${COLLECTION_DIR}" -ansible-galaxy collection install junipernetworks.junos -p "${COLLECTION_DIR}" -ansible-galaxy collection install cisco.aci -p "${COLLECTION_DIR}" -ansible-galaxy collection install google.cloud -p "${COLLECTION_DIR}" -ansible-galaxy collection install community.kubernetes -p "${COLLECTION_DIR}" -ansible-galaxy collection install f5networks.f5_modules -p "${COLLECTION_DIR}" - -# END: HACK - ansible-test env --dump --show --timeout "${timeout}" --color -v "tests/utils/shippable/check_matrix.py"