buluma.supervisor
Ansible ロール supervisor
Linux用の Supervisor(プロセス状態管理者)。
GitHub | バージョン | 問題 | プルリクエスト | ダウンロード |
---|---|---|---|---|
例のプレイブック
この例は molecule/default/converge.yml
から取られており、各プッシュ、プルリクエスト、リリースでテストされています。
---
- name: Converge
hosts: all
become: true
environment:
PATH: "/usr/local/bin:{{ ansible_env.PATH }}"
vars:
supervisor_user: root
supervisor_password: fizzbuzz
pre_tasks:
- name: apt キャッシュを更新(Debian)。
apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian'
- name: テスト用に curl をインストール。
package: name=curl state=present
- block:
- name: Apache をインストール(RedHat)。
package: name=httpd state=present
- name: Apache が実行されていないことを確認(RedHat)。
service: name=httpd state=stopped enabled=no
when: ansible_os_family == 'RedHat'
- block:
- name: Apache をインストール(Debian)。
package: name=apache2 state=present
- name: Apache が実行されていないことを確認(Debian)。
service: name=apache2 state=stopped enabled=no
when: ansible_os_family == 'Debian'
- name: ロードするテスト HTML ファイルを作成。
ansible.builtin.copy:
content: "<html><head><title>Test</title></head><body>Test.</body></html>"
dest: /var/www/html/index.html
force: false
group: root
owner: root
mode: 0644
- name: Apache の起動コマンドを設定する(Debian)。
ansible.builtin.set_fact:
apache_start_command: apache2ctl -DFOREGROUND
when: ansible_os_family == 'Debian'
- name: Apache の起動コマンドを設定する(RedHat)。
ansible.builtin.set_fact:
apache_start_command: httpd -DFOREGROUND
when: ansible_os_family == 'RedHat'
- name: Apache を supervisor_programs に追加。
ansible.builtin.set_fact:
supervisor_programs:
- name: 'apache'
command: "{{ apache_start_command }}"
state: present
configuration: |
autostart=true
autorestart=true
startretries=1
startsecs=1
redirect_stderr=true
stderr_logfile=/var/log/apache-err.log
stdout_logfile=/var/log/apache-out.log
user=root
killasgroup=true
stopasgroup=true
roles:
- role: buluma.supervisor
tasks:
- name: ハンドラーをトリガーして、スーパーバイザーが必要なものを実行するようにします。
ansible.builtin.meta: flush_handlers
post_tasks:
- name: Apache が起動するのを待つ(起動する場合)。
ansible.builtin.wait_for:
port: 80
delay: 2
- name: ポート80でApacheが応答していることを確認。
ansible.builtin.uri:
url: http://127.0.0.1/
method: GET
status_code: 200
- name: supervisorctl が利用可能であることを確認。
command: supervisorctl --help
args:
warn: false
changed_when: false
- name: デフォルトのUNIXソケット経由で supervisorctl の動作を確認。
community.general.supervisorctl:
name: apache
state: restarted
username: "{{ supervisor_user }}"
password: "{{ supervisor_password }}"
changed_when: false
- name: unixソケットで supervisorctl の動作を確認。
command: supervisorctl status
args:
warn: false
changed_when: false
マシンを準備する必要があります。CIでは、これがmolecule/default/prepare.yml
を使用して行われます。
---
- name: 準備
hosts: all
gather_facts: no
become: yes
serial: 30%
roles:
- role: buluma.bootstrap
- role: buluma.pip
- role: buluma.core_dependencies
これらのロールの使用方法については、フル説明と例を参照してください。
ロール変数
変数のデフォルト値は defaults/main.yml
に設定されています。
---
# 指定されたバージョンのSupervisorをインストールする(例: '3.3.1')。
supervisor_version: ''
# Supervisorをインストールする際、および/またはシステム起動後に起動するために
# initスクリプトまたはsystemdユニット設定を使用するかどうかを選択します。
supervisor_started: true
supervisor_enabled: true
supervisor_config_path: /etc/supervisor
# Supervisor が制御するプログラムのリスト。例はコメントアウトされています。
supervisor_programs: []
# - name: 'apache'
# command: apache2ctl -c "ErrorLog /dev/stdout" -DFOREGROUND
# state: present
# configuration: |
# autostart=true
# autorestart=true
# startretries=1
# startsecs=1
# redirect_stderr=true
# stderr_logfile=/var/log/apache-err.log
# stdout_logfile=/var/log/apache-out.log
# user=root
# killasgroup=true
# stopasgroup=true
supervisor_nodaemon: false
supervisor_log_dir: /var/log/supervisor
supervisor_user: root
supervisor_password: 'my_secret_password'
supervisor_unix_http_server_enable: true
supervisor_unix_http_server_socket_path: /var/run/supervisor.sock
supervisor_unix_http_server_password_protect: true
supervisor_inet_http_server_enable: false
supervisor_inet_http_server_port: '*:9001'
supervisor_inet_http_server_password_protect: true
要件
- requirements.txt にリストされたpipパッケージ。
使用されるロールの状態
システムを準備するために以下のロールが使用されます。他の方法でシステムを準備することもできます。
要件 | GitHub | バージョン |
---|---|---|
buluma.bootstrap | ||
buluma.pip | ||
buluma.core_dependencies |
コンテキスト
このロールは、多くの互換性のあるロールの一部です。詳細については、これらのロールのドキュメントをご覧ください。
関連するロールの概要:
互換性
このロールは、これらの コンテナイメージ でテストされています。
コンテナ | タグ |
---|---|
EL | 8 |
Debian | all |
Ubuntu | all |
Kali | all |
必要なAnsibleの最小バージョンは2.12で、テストは以下が行われています:
- 前のバージョン。
- 現在のバージョン。
- 開発バージョン。
問題が見つかった場合は、GitHubに登録してください。
変更履歴
ライセンス
著者情報
プロジェクトについて
Supervisor (process state manager) for Linux.
インストール
ansible-galaxy install buluma.supervisor
ライセンス
apache-2.0
ダウンロード
4k
所有者
DevOps Engineer