預設路徑安裝內容集

  1. 設定 Collections 路徑:修改工作目錄下的 ansible.cfg,設定內容集的路徑為 /home/ceuser/ansible_pb/collections。
    ceuser@deyu:~/ansible_pb$ grep collections_path= ansible.cfg
    collections_path=/home/ceuser/ansible_pb/collections
    
  2. 不指定路徑安裝 mynmspace.mycollect:1.0.0。
    ceuser@deyu:~/ansible_pb$ ansible-galaxy collection install http://dy.csie.cyut.edu.tw/materials/mynmspace-mycollect-1.0.0.tar.gz
    Downloading http://dy.csie.cyut.edu.tw/materials/mynmspace-mycollect-1.0.0.tar.gz to /home/ceuser/.ansible/tmp/ansible-local-182235pynh7qf2/tmpljon00ig/mynmspace-mycollect-1.0.0-s7thcr7d
    Starting galaxy collection install process
    Process install dependency map
    Starting collection install process
    Installing 'mynmspace.mycollect:1.0.0' to '/home/ceuser/ansible_pb/collections/ansible_collections/mynmspace/mycollect'
    mynmspace.mycollect:1.0.0 was installed successfully
    
  3. 安裝時沒指定安裝路徑,預設安裝在 ansible.cfg 設定的路徑 ~/ansible/collections/,不用先建目錄 ~/ansible/collections,安裝時會自動產生。
    ceuser@deyu:~/ansible_pb$ ansible-galaxy collection list
    
    # /home/ceuser/ansible_pb/collections/ansible_collections
    Collection          Version
    ------------------- -------
    mynmspace.mycollect 1.0.0
    
  4. 查看目錄 ~/ansible/collections 下安裝的內容集檔案。
    ceuser@deyu:~/ansible_pb$ tree collections/
    collections/
    └── ansible_collections
        └── mynmspace
            └── mycollect
                ├── docs
                ├── FILES.json
                ├── MANIFEST.json
                ├── plugins
                │   └── README.md
                ├── README.md
                └── roles
    
    7 directories, 4 files