CiscoDevNet / ansible-dcnm

Apache License 2.0
45 stars 36 forks source link

dcnm_image_policy #259

Closed dsx1123 closed 6 months ago

dsx1123 commented 1 year ago

Community Note

Description

New module to create image policy

New or Affected modules(s):

DCNM version

Potential ansible task config

# Copy-paste your ansible playbook
    - name: Create Image polices
      cisco.dcnm.dcnm_image_policy:
        state: merged                                                   # choose from merged, replaced, overridden, deleted, query
        config:
          - name: NR3F                                                  # mandatory, name of the policy
            description: image policy of 10.3(3)F                       # optional, description of the policy
            platform: N9K                                               # mandatory, no default, choose from N9K, N7K, N77, N6K, N5K
            release: 10.3.1_nxos64-cs_64bit                             # mandatory, no default, please see the API doc for example
            packages:                                                   # optional, list of rpm packages
              - mtx-openconfig-all-2.0.0.0-10.4.1.src.rpm
            epld_image: n9000-epld.10.3.2.F.img                         # optional, default is ""
            disabled_rpm: mtx-grpctunnel-2.1.0.0-10.4.1.lib32_64_n9000  # optional, default is ""
            agnostic: false                                             # optional, default is false, this indicates whether the packages provided are the same version as the release

References

https://www.cisco.com/c/en/us/td/docs/dcn/ndfc/1212/configuration/fabric-controller/cisco-ndfc-fabric-controller-configuration-guide-1212/image-management.html Additional context Add any other context or screenshots about the feature request here.

allenrobel commented 7 months ago

Hi all. My understanding is that packages relates to rpm packages that are to be installed, whereas rpmimages (from REST API) (referred to as disabled_rpm in the "Potential ansible task config" above, is a list of rpm packages to uninstall (or maybe disable?).

I'm implemented this as shown below. Please let me know if any concerns.

    tasks:
    -   name: Merge Image policies
        cisco.dcnm.dcnm_image_policy:
            state: merged
            config:
            -   name: KR5M
                agnostic: false
                description: KR5M
                epld_image: n9000-epld.10.2.5.M.img
                packages:
                   install:
                   - mtx-openconfig-all-2.0.0.0-10.4.1.src.rpm
                   uninstall:
                   - mtx-grpctunnel-2.1.0.0-10.4.1.lib32_64_n9000
                platform: N9K
                release: 10.2.5_nxos64-cs_64bit
                type: PLATFORM