9 Oracle Linux Automation Managerのアップグレード
次の章では、Oracle Linux Automation Managerをアップグレードする手順について説明します。
リリース1.0.Xからリリース2.0単一ホスト・デプロイメントへのアップグレード
Oracle Linux Automation Managerリリース1.0.xの単一ホスト・インスタンスをOracle Linux Automation Managerリリース2.0の単一ホスト・インスタンスにアップグレードするには、次を実行します:
- アップグレードするOracle Linux Automation Managerリリース1.0.xバージョンの端末にログインします。
/etc/tower/SECRET_KEYファイルを安全なロケーションにバックアップします。 たとえば、ファイルをホーム・ディレクトリにコピーできます:sudo cp /etc/tower/SECRET_KEY ~- Oracle Linux Automation Managerを停止します。
sudo systemctl stop ol-automation-manager - データベースを制御するユーザー・アカウントにログインします。
sudo su - postgres - データベースをリストアするために必要なすべてのSQLコマンドおよび入力データを含むスクリプト・ファイルを作成する次のコマンドを使用して、データベースをエクスポートします。 たとえば、このコマンドは、データベース・ホーム・ディレクトリに
olam1.dumpファイルを作成します。pg_dumpall > olamv1.dump - データベースを制御するユーザー・アカウントを終了します。
exit - データベース・サーバーを停止します。
sudo systemctl stop postgresql - 既存のデータベース・データ・ディレクトリを削除(およびオプションでバックアップ)します。 たとえば、次のコマンドは、ホーム・ディレクトリ内のバックアップ・ファイルを削除して作成します。
sudo mv /var/lib/pgsql/data/ ~/data.old - データベースの現在のバージョンを削除します。
sudo dnf remove postgresql postgresql 12またはpostgresql 13モジュール・ストリームを有効にします。sudo dnf module reset postgresql sudo dnf module enable postgresql:12または
sudo dnf module reset postgresql sudo dnf module enable postgresql:13ノート:
Postgresql 12および13のライフサイクルの詳細については、「Oracle Linux: Oracle Linuxでのソフトウェアの管理」にあるストリーム・モジュールのアプリケーション・ライフ・サイクルに関する付録を参照してください。- 「Oracle Linux Automation Managerパッケージへのアクセスの有効化」の説明に従って、リリース2のOracle Linux Automation Manager Yumリポジトリを有効にします。
- Oracle Linux Automation Managerを更新します。
sudo dnf update ol-automation-manager注意:
別のリポジトリからansibleパッケージをインストールした場合(たとえば、EPEL)、インストールおよびアップグレード・プロセスによって、このパッケージがansible-coreパッケージで上書きされます。ノート:
アップグレード・プロセス中に確認された次のメッセージは、障害を示していないため無視しても問題ありません:
ValueError: File context for /var/run/tower(/.*)? already defined - データベースをインストールします。
sudo dnf install postgresql-server - 更新が完了したら、データベースを設定します。
sudo postgresql-setup --initdb sudo systemctl start postgresql sudo su - postgres psql -d postgres -f olamv1.dump exit - 次のコマンドを実行して、データベースが使用可能かどうかを確認します:
sudo su - postgres -c "psql -l |grep awx"出力は次のようになります:awx | awx | UTF8 | en_US.UTF-8 | en_US.UTF-8 | /etc/tower/settings.pyを/etc/tower/settings.py.rpmnewに置き換えます。 たとえば:sudo mv /etc/tower/settings.py /etc/tower/settingsold.py sudo mv /etc/tower/settings.py.rpmnew /etc/tower/settings.py/etc/tower/settings.pyファイルで、CLUSTER_HOST_IDを次のように設定します:CLUSTER_HOST_ID = "hostname or ip address"前の例では、「ホスト名またはIPアドレス」は、Oracle Linux Automation Managerを実行しているシステムのホスト名またはIPアドレスです。 ホスト名を使用する場合は、ホストが解決可能である必要があります。/etc/nginx/nginx.confで、既存の構成をすべて削除し、次のテキストに置き換えます: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; }/etc/nginx/conf.d/ol-automation-manager-nginx.confで、既存の構成をすべて削除し、次のテキストに置き換えます:upstream uwsgi { server unix:/var/run/tower/uwsgi.sock; } upstream daphne { server unix:/var/run/tower/daphne.sock; } server { listen 443 default_server ssl; listen 127.0.0.1:80 default_server; listen [::]:443 default_server ssl; listen [::1]:80 default_server; # If you have a domain name, this is where to add it server_name _; keepalive_timeout 65; ssl_certificate /etc/tower/tower.crt; ssl_certificate_key /etc/tower/tower.key; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; # intermediate configuration. tweak to your needs. ssl_protocols TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; ssl_prefer_server_ciphers on; # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) add_header Strict-Transport-Security max-age=15768000; # add_header Content-Security-Policy "default-src 'self'; connect-src 'self' ws: wss:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' *.pendo.io; img-src 'self' *.pendo.io data:; report-uri /csp-violation/"; # add_header X-Content-Security-Policy "default-src 'self'; connect-src 'self' ws: wss:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' *.pendo.io; img-src 'self' *.pendo.io data:; report-uri /csp-violation/"; location /favicon.ico { alias /var/lib/awx/venv/awx/lib/python3.8/site-packages/awx/ui/build/static/media/favicon.ico; } location /static/ { alias /var/lib/awx/venv/awx/lib/python3.8/site-packages/awx/ui/build/static/; } location /websocket { # Pass request to the upstream alias proxy_pass http://daphne; # Require http version 1.1 to allow for upgrade requests proxy_http_version 1.1; # We want proxy_buffering off for proxying to websockets. proxy_buffering off; # http://en.wikipedia.org/wiki/X-Forwarded-For proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # enable this if you use HTTPS: proxy_set_header X-Forwarded-Proto https; # pass the Host: header from the client for the sake of redirects proxy_set_header Host $http_host; # We've set the Host header, so we don't need Nginx to muddle # about with redirects proxy_redirect off; # Depending on the request value, set the Upgrade and # connection headers proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection $connection_upgrade; proxy_set_header Connection upgrade; } location / { # Add trailing / if missing rewrite ^(.*[^/])$ $1/ permanent; uwsgi_read_timeout 120s; uwsgi_pass uwsgi; include /etc/nginx/uwsgi_params; } }-
Receptorのデフォルト構成をすべて削除します。
/etc/receptor/receptor.confを編集して、次の構成を含めます:--- - node: id: <hostname or ip address> - log-level: debug - tcp-listener: port: 27199 #- work-signing: # privatekey: /etc/receptor/work_private_key.pem # tokenexpiration: 1m #- work-verification: # publickey: /etc/receptor/work_public_key.pem #- tcp-peer: # address: 100.100.253.53:27199 # redial: true #- tls-server: # name: mutual-tls # cert: /etc/receptor/certs/awx.crt # key: /etc/receptor/certs/awx.key # requireclientcert: true # clientcas: /etc/receptor/certs/ca.crt - control-service: service: control filename: /var/run/receptor/receptor.sock - work-command: worktype: local command: /var/lib/ol-automation-manager/venv/awx/bin/ansible-runner params: worker allowruntimeparams: true # verifysignature: true前の例では、「ホスト名またはIPアドレス」は、Oracle Linux Automation Managerを実行しているシステムのホスト名またはIPアドレスです。 ホスト名を使用する場合は、ホストが解決可能である必要があります。
-
awxユーザーとしてOracle Linux Automation Managerデプロイメントを準備します。 次を実行します。
-
次のコマンドを実行します。
sudo su -l awx -s /bin/bash podman system migrate podman pull container-registry.oracle.com/oracle_linux_automation_manager/olam-ee:latest awx-manage makemigrations --merge awx-manage migrate awx-manage register_default_execution_environments
ノート:
Oracle Linux Automation Managerのアップグレードが終了したら、実行環境でプレイブックの実行時に常に最新のolam-eeコンテナ・イメージをプルするか、他のオプションを使用するかを構成できます。 これらのオプションの詳細は、「Oracle Linux Automation Manager 2.1: ユーザーズ・ガイド」を参照してください。 -
awxシェル環境を終了します。
exit
-
- /etc/tower/SECRET_KEYファイルをリストアします。 たとえば:
sudo cp ~/SECRET_KEY /etc/tower/SECRET_KEY /etc/tower/settings.pyファイルに、次の行を追加します:DEFAULT_EXECUTION_QUEUE_NAME = 'tower' DEFAULT_CONTROL_PLANE_QUEUE_NAME = 'tower'
- NGINXを再起動します。
sudo systemctl restart nginx - Oracle Linux Automation Managerを起動します。
sudo systemctl start ol-automation-manager
リリース2.0からリリース2.1へのアップグレード
- すべてのOracle Linux Automation Manager 2.0ノードで、端末にログインします。
- 更新の実行:
sudo dnf clean all sudo dnf update oraclelinux-automation-manager-release-el8 sudo dnf update ol-automation-manager ol-automation-manager-cli uwsgi - 最新のolam-eeイメージをプルします。
sudo su -l awx -s /bin/bash podman pull container-registry.oracle.com/oracle_linux_automation_manager/olam-ee:latest exit - 次のパラメータを
/etc/tower/settings.pyファイルに追加します:# OLAM Reaper Job Status Tracking REAPER_TIMEOUT_SEC = 60REAPER_TIMEOUT_SECパラメータは、「実行中」または「待機中」状態のジョブがスタックしているとみなされ、リーパーによって「失敗」状態に遷移する時間を秒単位で指定します。 このパラメータは、60秒より長く実行されるプレイブックがある場合に変更できます。 このパラメータの詳細は、「Oracle Linux Automation Manager 2.1: インストレーション・ガイド」を参照してください。 - すべてのノードで次のサービスを再起動します:
sudo systemctl restart ol-automation-manager sudo systemctl restart nginx sudo systemctl restart receptor-awx - 必要に応じて、新しいカスタム実行環境インスタンスのデフォルトの実行環境のロケーションをプライベート自動化ハブ・インスタンスに変更できます。 また、
olam-eeをcontainer-registry.oracle.comからダウンロードしてPrivate Automation Hubでホストし、コントロール・プレーン・インスタンスに使用できます。 これらのデフォルト設定を設定するには、次を実行します:/etc/tower/settings.pyファイルを次のように編集します:GLOBAL_JOB_EXECUTION_ENVIRONMENTS = [{'name': '<customer_execution_environment>)', 'image': '<private_automation_hub_hostname_or_ip_address>/<customer_execution_environment>:latest'}] CONTROL_PLANE_EXECUTION_ENVIRONMENT = '<private_automation_hub_hostname_or_ip_address>/olam-ee:latest'- 次のコマンドを使用して、新しいデフォルト環境を登録します:
sudo su -l awx -s /bin/bash awx-manage register_default_execution_environments exit -
すべてのノードでOracle Linux Automation Managerを再起動します。
sudo systemctl restart ol-automation-manager
クラスタ化されたデプロイメントへの単一インスタンス・デプロイメントの移行
Oracle Linux Automation Managerの単一ホスト・インスタンス・デプロイメントをクラスタ化されたデプロイメントに移行するには、次を実行します:
- 単一インスタンス・ホストをリリース2.0にアップグレードする必要がある場合は、「リリース1.0.Xからリリース2.0単一ホスト・デプロイメントへのアップグレード」のアップグレード手順を完了してください。
- アップグレードされたインスタンスが動作していることを確認します。
- 端末で、Oracle Linux Automation Managerを停止します。
sudo systemctl stop ol-automation-manager - データベース・ダンプ・ファイルを作成します。
sudo su - postgres pg_dumpall > olamv2upg.dump - 「ファイアウォール・ルールの設定」の説明に従って、リモート・データベースでファイアウォール・ポートを開きます。
- 次の例外を除いて、「ローカルまたはリモート・データベースの設定」でリモート・データベースを設定する手順を実行します:
- 手順を開始する前に、ダンプ・ファイルをリモート・データベースにコピーします。 たとえば、scpを使用します。
- ステップ7でデータベースを起動した後、ダンプ・ファイルをインポートします:
sudo su - postgres psql -d postgres -f /dirwithbackup/olamv2upg.dump exit - データベース・ユーザー・アカウントの作成とデータベースの作成のステップ8から10は、すでにダンプ・ファイルに含まれているためスキップします。
- ステップ11でステップを続行します。
- リモート・データベースで、パスワードをデータベース・ユーザー・アカウントに再適用します:
sudo -u postgres psql \password awx - awxユーザーのパスワードを入力して確認します。
Enter new password for user "awx": Enter it again: exit - データベースを再起動します。
sudo systemctl restart postgresql - アップグレードされたインスタンスに戻り、
/etc/tower/settings.pyファイルで、既存のDATABASESフィールドを次のフィールドに置き換えます:DATABASES = { 'default': { 'ATOMIC_REQUESTS': True, 'ENGINE': 'awx.main.db.profiled_pg', 'NAME': 'awx', 'USER': 'awx', 'PASSWORD': 'password', 'HOST': 'database hostname or ip address', 'PORT': '5432', } }前の例では、「データベースのホスト名またはIPアドレス」はリモート・データベースのホスト名またはIPアドレスです。 ホスト名を使用する場合は、ホストを解決可能である必要があります。「パスワード」は、リモート・データベースを構成した場合のパスワードです。 - ローカル・データベースを停止します。
sudo systemctl stop postgresql - サービス・メッシュに使用されるポートを開きます。
sudo firewall-cmd --add-port=27199/tcp --permanent sudo firewall-cmd --reload - Oracle Linux Automation Managerを起動します。
sudo systemctl start ol-automation-manager - ローカル・データベースは不要になったため削除します。
sudo dnf remove postgresql - 次のコマンドを実行します。
sudo su -l awx -s /bin/bash - Oracle Linux Automation Managerリリース2では使用されないため、
towerインスタンス・グループ(キュー名)を削除します。awx-manage remove_from_queue --queuename tower --hostname <hostname or IP address>前の例では、「ホスト名またはIPアドレス」は、Oracle Linux Automation Managerを実行しているシステムのホスト名またはIPアドレスです。
- 次のコマンドを実行します
awx-manage provision_instance --hostname=<hostname or IP address> --node_type=control awx-manage register_queue --queuename=controlplane --hostnames=<hostname or IP address> exit前の例では、「ホスト名またはIPアドレス」は、Oracle Linux Automation Managerを実行しているシステムのホスト名またはIPアドレスです。 ホスト名またはIPアドレスの選択は、
/etc/receptor/receptor.confファイル・ノードIDを構成したときに使用したホスト名またはIPアドレスと一致する必要があります(「コントロール・プレーン・サービス・メッシュの構成および起動」を参照)。 ホスト名を使用する場合は、ホストが解決可能である必要があります。 /etc/tower/settings.pyファイルで、次の行を置き換えます。DEFAULT_EXECUTION_QUEUE_NAME = 'tower' DEFAULT_CONTROL_PLANE_QUEUE_NAME = 'tower'これらの行とともに。
DEFAULT_EXECUTION_QUEUE_NAME = 'execution' DEFAULT_CONTROL_PLANE_QUEUE_NAME = 'controlplane'- Oracle Linux Automation Managerを再起動します。
sudo systemctl restart ol-automation-manager.service - アップグレードした元のノードが制御ノードに変換されます。 アップグレードしたクラスタが完全に機能するには、実行ノードをもう1つ追加する必要があります。 クラスタの他のすべてのメンバーについては、「データベースおよびホストの準備」で説明されている手順に従いますが、リモート・データベースの設定は完了しているためです。 次に、「クラスタ化されたデプロイメントへのOracle Linux Automation Managerのインストール」の説明に従って、他のすべてのホストをクラスタの一部としてインストールおよび構成する手順に従います。