ansible-galaxy 指令

  1. ansible-galaxy 可以管理 collection 及 role 兩種類型。
    [deyu1@kvm19 ~]$ ansible-galaxy -h
    usage: ansible-galaxy [-h] [--version] [-v] TYPE ...
    
    Perform various Role and Collection related operations.
    
    positional arguments:
      TYPE
        collection   Manage an Ansible Galaxy collection.
        role         Manage an Ansible Galaxy role.
    
    optional arguments:
      --version      show program's version number, config file location,
                     configured module search path, module location, executable
                     location and exit
      -h, --help     show this help message and exit
      -v, --verbose  Causes Ansible to print more debug messages. Adding multiple
                     -v will increase the verbosity, the builtin plugins currently
                     evaluate up to -vvvvvv. A reasonable level to start is -vvv,
                     connection debugging might require -vvvv.
    
  2. ansible-galaxy collection 工具可以 download, init, build, build, publish, install, list 內容集。
    [deyu1@kvm19 ~]$ ansible-galaxy collection -h
    usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
    
    positional arguments:
      COLLECTION_ACTION
        download         Download collections and their dependencies as a tarball
                         for an offline install.
        init             Initialize new collection with the base structure of a
                         collection.
        build            Build an Ansible collection artifact that can be published
                         to Ansible Galaxy.
        publish          Publish a collection artifact to Ansible Galaxy.
        install          Install collection(s) from file(s), URL(s) or Ansible
                         Galaxy
        list             Show the name and version of each collection installed in
                         the collections_path.
        verify           Compare checksums with the collection(s) found on the
                         server and the installed copy. This does not verify
                         dependencies.
    
    optional arguments:
      -h, --help         show this help message and exit
    
  3. ansible-galaxy collection 工具的每個子命令都有輔助說明,例如以下查詢子命令 install 的輔助說明。
    [deyu1@kvm19 ansible]$ ansible-galaxy collection install -h
    usage: ansible-galaxy collection install [-h] [-s API_SERVER] [--token API_KEY]
                                             [-c] [-v] [-f]
                                             [--clear-response-cache] [--no-cache]
                                             [-i] [-n | --force-with-deps]
                                             [-p COLLECTIONS_PATH]
                                             [-r REQUIREMENTS] [--pre] [-U]
                                             [--keyring KEYRING]
                                             [--disable-gpg-verify]
                                             [--signature SIGNATURES]
                                             [--required-valid-signature-count REQUIRED_VALID_SIGNATURE_COUNT]
                                             [--ignore-signature-status-code {EXPSIG,EXPKEYSIG,REVKEYSIG,BADSIG,ERRSIG,NO_PUBKEY,MISSING_PASSPHRASE,BAD_PASSPHRASE,NODATA,UNEXPECTED,ERROR,FAILURE,BADARMOR,KEYEXPIRED,KEYREVOKED,NO_SECKEY}]
                                             [collection_name ...]
    
    positional arguments:
      collection_name       The collection(s) name or path/url to a tar.gz
                            collection artifact. This is mutually exclusive with
                            --requirements-file.
    
    optional arguments:
      -h, --help            show this help message and exit
      -s API_SERVER, --server API_SERVER
                            The Galaxy API server URL
      --token API_KEY, --api-key API_KEY
                            The Ansible Galaxy API key which can be found at
                            https://galaxy.ansible.com/me/preferences.
      -c, --ignore-certs    Ignore SSL certificate validation errors.
      -v, --verbose         Causes Ansible to print more debug messages. Adding
                            multiple -v will increase the verbosity, the builtin
                            plugins currently evaluate up to -vvvvvv. A reasonable
                            level to start is -vvv, connection debugging might
                            require -vvvv.
      -f, --force           Force overwriting an existing role or collection
      --clear-response-cache
                            Clear the existing server response cache.
      --no-cache            Do not use the server response cache.
      -i, --ignore-errors   Ignore errors during installation and continue with the
                            next specified collection. This will not ignore
                            dependency conflict errors.
      -n, --no-deps         Don't download collections listed as dependencies.
      --force-with-deps     Force overwriting an existing collection and its
                            dependencies.
      -p COLLECTIONS_PATH, --collections-path COLLECTIONS_PATH
                            The path to the directory containing your collections.
      -r REQUIREMENTS, --requirements-file REQUIREMENTS
                            A file containing a list of collections to be
                            installed.
      --pre                 Include pre-release versions. Semantic versioning pre-
                            releases are ignored by default
      -U, --upgrade         Upgrade installed collection artifacts. This will also
                            update dependencies unless --no-deps is provided
      --keyring KEYRING     The keyring used during signature verification
      --disable-gpg-verify  Disable GPG signature verification when installing
                            collections from a Galaxy server
      --signature SIGNATURES
                            An additional signature source to verify the
                            authenticity of the MANIFEST.json before installing the
                            collection from a Galaxy server. Use in conjunction
                            with a positional collection name (mutually exclusive
                            with --requirements-file).
      --required-valid-signature-count REQUIRED_VALID_SIGNATURE_COUNT
                            The number of signatures that must successfully verify
                            the collection. This should be a positive integer or -1
                            to signify that all signatures must be used to verify
                            the collection. Prepend the value with + to fail if no
                            valid signatures are found for the collection (e.g.
                            +all).
      --ignore-signature-status-code {EXPSIG,EXPKEYSIG,REVKEYSIG,BADSIG,ERRSIG,NO_PUBKEY,MISSING_PASSPHRASE,BAD_PASSPHRASE,NODATA,UNEXPECTED,ERROR,FAILURE,BADARMOR,KEYEXPIRED,KEYREVOKED,NO_SECKEY}
                            A status code to ignore during signature verification
                            (for example, NO_PUBKEY). Provide this option multiple
                            times to ignore a list of status codes. Descriptions
                            for the choices can be seen at L(https://github.com/gpg
                            /gnupg/blob/master/doc/DETAILS#general-status-codes).