附註:

升級 Oracle Linux Automation Manager

簡介

現有的 Oracle Linux Automation Manager 管理員熟悉其全方位單一執行處理部署。

Oracle Linux Automation Manager 可讓管理員升級現有的部署,之後再將升級的執行處理移轉至叢集部署。升級時,執行處理會轉換成單一主機部署,並將其設定為混合節點。

跟隨此自學課程後,您將瞭解如何從舊版升級 Oracle Linux Automation Manager。

目標

在本教學課程中,您將瞭解如何:

必要條件

部署 Oracle Linux Automation Manager

注意:如果在您自己的租用戶中執行,請先閱讀 linux-virt-labs GitHub 專案 README.md 並完成先決條件,再部署實驗室環境。

  1. 在 Luna 桌面上開啟終端機。

  2. 複製 linux-virt-labs GitHub 專案。

    git clone https://github.com/oracle-devrel/linux-virt-labs.git
    
  3. 變更至工作目錄。

    cd linux-virt-labs/olam
    
  4. 安裝所需的集合。

    ansible-galaxy collection install -r requirements.yml
    
  5. 更新 Oracle Linux 執行處理組態。

    cat << EOF | tee instances.yml > /dev/null
    compute_instances:
      1:
        instance_name: "olam-node"
        type: "control"
    passwordless_ssh: true
    olam_type: v1
    EOF
    
  6. 部署實驗室環境。

    ansible-playbook create_instance.yml -e ansible_python_interpreter="/usr/bin/python3.6" -e "@instances.yml"
    

    免費實驗室環境需要額外的變數 ansible_python_interpreter,因為它會安裝適用於 Oracle Cloud Infrastructure SDK for Python 的 RPM 套裝程式。此套裝軟體的安裝位置在 python3.6 模組下。

    預設部署資源配置使用 AMD CPU 和 Oracle Linux 8。若要使用 Intel CPU 或 Oracle Linux 9,請在部署命令中新增 -e instance_shape="VM.Standard3.Flex"-e os_version="9"

    重要事項:等待手冊順利執行並到達暫停工作。Oracle Linux Automation Manager 安裝已在手冊的這個階段完成,且執行處理已就緒。記下先前的播放,此播放會列印所部署節點的公用和專用 IP 位址。

登入 WebUI

  1. 開啟終端機並設定 Oracle Linux Automation Manager 的 SSH 通道。

    ssh -L 8444:localhost:443 oracle@<hostname_or_ip_address>
    

    在免費的實驗室環境中,使用 olam 節點執行處理的外部 IP 位址。

  2. 開啟 Web 瀏覽器並輸入 URL。

    https://localhost:8444
    

    注意:根據使用的瀏覽器來核准安全警告。按一下 Chrome 的 **Advanced 按鈕,然後按一下繼續 localhost (不安全) 連結。

  3. 使用 USERNAME admin 與自動部署期間建立的 PASSWORD admin 登入 Oracle Linux Automation Manager。

    乳膠登入

  4. 登入之後,會顯示 WebUI。

    繁體中文 (香港)

執行升級

  1. 切換至連接至執行 Oracle Linux Automation Manager 例項之 olam-node 例項的終端機。

  2. 停止 Oracle Linux Automation Manager 服務。

    sudo systemctl stop ol-automation-manager
    
  3. 建立 Oracle Linux Automation Manager 使用之加密密碼金鑰的備份,以加密資料庫中的自動化加密密碼。

    sudo cp /etc/tower/SECRET_KEY ~/SECRET_KEY.olamv1
    
  4. 建立資料庫備份。

    此命令會將資料庫的內容傾印至包含所有必要 SQL 命令和資料的檔案,以回復資料庫。

    sudo su - postgres -c pg_dumpall > /tmp/olamv1_db_dump
    
  5. 停止資料庫服務。

    sudo systemctl stop postgresql
    
  6. 移除現有的資料庫資料檔。

    sudo rm -rf /var/lib/pgsql/data
    

    此命令會移除現有的資料庫資料檔。稍後會使用傾印檔重新建立資料庫。

  7. 解除安裝目前的資料庫套件 。

    sudo dnf -y remove postgresql
    
  8. 啟用新資料庫版本的模組串流。

    升級時,Oracle Linux Automation Manager 允許使用 PostgreSQL 12 和 13。此實驗室使用版本 13。

    sudo dnf -y module reset postgresql
    sudo dnf -y module enable postgresql:13
    
  9. 更新 Oracle Linux Automation Manager 儲存區域套裝程式。

    sudo dnf -y update oraclelinux-automation-manager-release-el8
    

    注意:此步驟會報告免費實驗室環境中沒有什麼需要執行的動作,因為初始部署已經安裝 Oracle Linux Automation Manager 的最新儲存區域套裝程式。

  10. 停用所有 Oracle Linux Automation Manager 儲存庫。

    sudo dnf config-manager --disable ol8_automation ol8_automation2 ol8_automation2.2
    
  11. 將 Oracle Linux Automation Manager 套件升級至版本 2。

    sudo dnf -y install ol-automation-manager --enablerepo ol8_automation2
    
  12. 啟用目前的儲存區域。

    sudo dnf config-manager --enable ol8_automation2.2
    
  13. 更新 Oracle Linux Automation Manager 套裝程式。

    sudo dnf -y update ol-automation-manager
    

    注意:升級期間輸出中會顯示下列預期訊息。

      Upgrading        : ol-automation-manager-2.1.0-10.el8.x86_64            26/28 
    warning: /etc/tower/settings.py created as /etc/tower/settings.py.rpmnew
    
      Running scriptlet: ol-automation-manager-2.1.0-10.el8.x86_64            26/28 
    ValueError: File context for /var/run/tower(/.*)? already defined
    
  14. 安裝資料庫伺服器。

    sudo dnf -y install postgresql-server
    
  15. 初始化,然後啟動和回復資料庫。

    sudo postgresql-setup --initdb
    sudo systemctl start postgresql
    sudo su - postgres -c 'psql -d postgres -f /tmp/olamv1_db_dump'
    
  16. 確認資料庫可供使用。

    sudo su - postgres -c 'psql -l | grep awx'
    

    範例輸出:

    [oracle@control-node ~]$ sudo su - postgres -c 'psql -l | grep awx'
     awx       | awx      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
    

    輸出顯示使用傾印檔執行回復之後,在資料庫中建立的 awx 帳戶。

  17. 取代預設的 Oracle Linux Automation Manager 全域設定值檔案。

    升級 Oracle Linux Automation Manager 套裝程式之後,新的 rpm 會建立副檔名為 .rpmnew 的預設組態檔。此程序可讓系統管理員檢查組態差異,並手動移轉必要的變更。

    sudo mv /etc/tower/settings.py /etc/tower/settings.py.save
    sudo mv /etc/tower/settings.py.rpmnew /etc/tower/settings.py
    
    
  18. 檢視新的與舊的全域設定檔之間的差異 。

    sudo diff /etc/tower/settings.py /etc/tower/settings.py.save
    

    注意:任何先前新增至 settings.py 檔案的自訂設定值,都必須在 WebUI 中設定,或移至 /etc/tower/conf.d 下的檔案。

  19. 建立包含所需設定的自訂設定檔案。

    cat << EOF | sudo tee /etc/tower/conf.d/olamv2.py > /dev/null
    CLUSTER_HOST_ID = '$(hostname -i)'
    DEFAULT_EXECUTION_QUEUE_NAME = 'tower'
    DEFAULT_CONTROL_PLANE_QUEUE_NAME = 'tower' 
    EOF
    

    此指令會將 CLUSTER_HOST_ID 設定設為系統的 IP 位址,並將預設佇列名稱設為預先升級版本的預設名稱 tower。在組態檔中輸入的值必須遵循 Python 語法格式。

    注意:升級 Oracle Linux Automation Manager 時,CLUSTER_HOST_ID 值必須符合先前安裝的值,以避免工作在升級後停滯在擱置中狀態。版本 1 中的預設佇列名稱為 tower,而在版本 2 中,則為 default

  20. 更新「接收器」組態檔。

    接收器網格是一種覆蓋網路,可在控制器與執行器之間建立點對點連線,以處理工作分配。

    sudo sed -i "s/0.0.0.0/$(hostname -i)/" /etc/receptor/receptor.conf
    
  21. 請檢查「接收端」組態檔。

    sudo cat /etc/receptor/receptor.conf
    
    • id: 是 Oracle Linux Automation Manager 系統的主機名稱或 IP 位址。
    • port: 是 Receptor 網格的 TCP 監聽連接埠,預設為 TCP 連接埠 27199。
  22. 部署 Oracle Linux Automation Manager。

    1. awx 使用者身分開啟 Shell。

      sudo su -l awx -s /bin/bash
      
    2. 將任何現有容器移轉至最新的 podman 版本,同時維持無權限的命名空間。

      podman system migrate
      
    3. 提取 Oracle Linux Automation Manager 的 Oracle Linux Automation Engine 執行環境。

      podman pull container-registry.oracle.com/oracle_linux_automation_manager/olam-ee:2.2
      
    4. 使用 awx-manage 公用程式來設定 Oracle Linux Automation Manager 執行處理。

      awx-manage makemigrations --merge
      awx-manage migrate
      awx-manage register_default_execution_environments
      exit
      
      
  23. 回復秘密金鑰檔案的備份 。

    sudo cp ~/SECRET_KEY.olamv1 /etc/tower/SECRET_KEY
    
  24. 將下列參數附加至 Oracle Linux Automation Manager 設定值檔案。

    cat << EOF | sudo tee -a /etc/tower/conf.d/olamv2.py > /dev/null
    
    # OLAM Reaper Job Status Tracking
    REAPER_TIMEOUT_SEC = 60
    EOF
    
  25. 取代 NGINX 的預設組態。

    cat << EOF | sudo tee /etc/nginx/nginx.conf > /dev/null
    user nginx;
    worker_processes auto;
    error_log /var/log/nginx/error.log;
    pid /run/nginx.pid;
    
    # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
    include /usr/share/nginx/modules/*.conf;
    
    events {
    worker_connections 1024;
    }
    
    http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    
    access_log  /var/log/nginx/access.log  main;
    
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    
    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;
    }
    EOF   
    
  26. 更新資料庫調整參數。

    sudo sed -i 's/max_connections = [0-9]\+/max_connections = 1024/' /var/lib/pgsql/data/postgresql.conf
    
    sudo sed -i 's/shared_buffers = [0-9]\+MB/shared_buffers = 5400MB/' /var/lib/pgsql/data/postgresql.conf
    
    sudo sed -i 's/#\(work_mem = \)[0-9]\+MB/\1'540MB/ /var/lib/pgsql/data/postgresql.conf
    
    sudo sed -i 's/#\(maintenance_work_mem = \)[0-9]\+MB/\1'720MB/ /var/lib/pgsql/data/postgresql.conf
    
  27. 重新啟動資料庫。

    sudo systemctl restart postgresql
    
  28. 重新啟動 NGINX。

    sudo systemctl restart nginx
    
  29. 啟動 Oracle Linux Automation Manager。

    sudo systemctl start ol-automation-manager
    

驗證升級

  1. 重新整理用來顯示上一個 WebUI 的 Web 瀏覽器視窗,或開啟新的 Web 瀏覽器視窗並輸入 URL。

    https://localhost:8444
    

    URL 中使用的連接埠必須與 SSH 通道的本機連接埠相同。

  2. 使用使用者名稱 admin密碼 admin 再次登入 Oracle Linux Automation Manager。

    olam2- 登入

  3. 登入之後,會顯示 WebUI。

    olam2- 烏布

接下來的步驟

升級已完成,工作已可供執行。若要深入瞭解 Oracle Linux Automation Manager,請查看文件並繼續透過查看我們在 Oracle Linux Training Station 上的其他 Oracle Linux Automation Manager 訓練來建立您的技能。

Oracle Linux Automation Manager 文件
Oracle Linux Automation Manager 訓練
Oracle Linux 訓練站

其他學習資源

探索 docs.oracle.com/learn 上的其他實驗室,或存取 Oracle Learning YouTube 頻道上的更多免費學習內容。此外,請造訪 education.oracle.com/learning-explorer 以成為 Oracle Learning Explorer。

如需產品文件,請造訪 Oracle Help Center