Install the following collection artifacts available from http://example.classroom.com/materials to workstation as the user student
redhat-rhel_system_roles-1.16.2.tar.gz
ansible-posix-1.4.0.tar.gz
community-general-4.3.0.tar.gz
The collections should be installed into the default collections directory /home/student/ansible/mycollections
【題前說明】
這題在RHCE8是沒有的,以前的roles和collections只要用指令yum install rhel-system-roles就幫我都安裝好了,但RHCE9就等要全部手動處理,如果這題做不出來的話,後面許多題目也就沒法繼續進下去,roles和collections裡面包含著很多後面解題要用到的function,而且這是一個新課程內容,記得去年以前都還沒有上過,不過其實也沒有很困難,只是要很注意每一步驟不要做錯了。
這題在RHCE8是沒有的,以前的roles和collections只要用指令yum install rhel-system-roles就幫我都安裝好了,但RHCE9就等要全部手動處理,如果這題做不出來的話,後面許多題目也就沒法繼續進下去,roles和collections裡面包含著很多後面解題要用到的function,而且這是一個新課程內容,記得去年以前都還沒有上過,不過其實也沒有很困難,只是要很注意每一步驟不要做錯了。
一.解題過程:
1.建立requirements.yml檔並直接編輯
[student@workstation mycollections]$ cd ~/ansible/mycollections
[student@workstation mycollections]$ touch requirements.yml
[student@workstation mycollections]$ vim requirements.yml
---collections: - name: http://example.classroom.com/materials/ansible-posix-1.5.4.tar.gz - name: http://example.classroom.com/materials/community-general-7.3.0.tar.gz - name: http://example.classroom.com/materials/fedora-linux_system_roles-1.53.4.tar.gz
2.執行並安裝裡面所有的roles
[student@workstation ansible]$ ansible-galaxy collection install -r mycollections/requirements.yml
\\執行ansible-galaxy collection
[student@workstation mycollections]$ ll ansible_collections \\驗證collections是否安裝完畢
二.恢復解題前的環境
刪除掉mycollections和裡面所有roles,回復解題前環境。
[student@workstation ansible]$ vim 03-lab-collection-stop.yml
---- name: remove mycollections hosts: 127.0.0.1 tasks: - name: remove mycollections file: path: /home/student/ansible/mycollections state: absent
[student@workstation ansible]$ ansbile-playbook 03-lab-collection-stop.yml
沒有留言:
張貼留言