LoginSignup
1
2

More than 5 years have passed since last update.

Rundeck セットアップ

Posted at

tl;dr

  • cronのようなジョブを管理しやすくしてくれるという rundeck のサーバをセットアップ。
  • 内部dbは選択可能とのことだったので、 postgresql を使用。

環境

  • CentOS Linux release 7.2.1511 (Core)
  • rundeck 2.7.2
  • PostgreSQL 9.6.3

postgres9.6 インストール


wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
  
rpm -ivh pgdg-centos96-9.6-3.noarch.rpm
yum install postgresql96-server postgresql96-devel postgresql96-contrib

/usr/pgsql-9.6/bin/postgresql96-setup initdb
systemctl enable postgresql-9.6
systemctl stop postgresql-9.6

postgres9.6 設定調整


vi /var/lib/pgsql/9.6/data/pg_hba.conf
※ジョブ実行対象のサーバと通信可能なようにする。

cp -pr /var/lib/pgsql/9.6/data /var/lib/pgsql/9.6/data_org
mount -t xfs /dev/sdb /var/lib/pgsql/9.6/data

cp -pr /var/lib/pgsql/9.6/data_org/* /var/lib/pgsql/9.6/data
chown -R postgres:postgres /var/lib/pgsql/9.6/data
chmod 700 /var/lib/pgsql/9.6/data

systemctl start postgresql-9.6

firewall開放


systemctl status firewalld
firewall-cmd --add-port=4440/tcp --permanent
systemctl restart firewalld

vi /etc/fstab


/dev/sdb                                  /var/lib/pgsql/9.6/data xfs     defaults        0 0

rundeck インストール


rpm -Uvh http://repo.rundeck.org/latest.rpm
yum install -y rundeck

rundeck 設定

vi /etc/rundeck/rundeck-config.properties


#loglevel.default is the default log level for jobs: ERROR,WARN,INFO,VERBOSE,DEBUG
loglevel.default=INFO
rdeck.base=/var/lib/rundeck

#rss.enabled if set to true enables RSS feeds that are public (non-authenticated)
rss.enabled=false
# change hostname here
grails.serverURL=http://172.21.XX.XXX:4440

# dataSource.dbCreate = update
# dataSource.url = jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;MVCC=true
dataSource.driverClassName = org.postgresql.Driver
dataSource.url = jdbc:postgresql://localhost/rundeck
dataSource.username=rundeckuser
dataSource.password=hogehoge

vi /etc/rundeck/framework.properties


「loaclhost」を「172.21.XX.XXX」に変更

rundeck プラグイン(※ここは必須ではありません)


cd /var/lib/rundeck/libext

wget https://github.com/higanworks/rundeck-slack-incoming-webhook-plugin/releases/download/v0.6.dev/rundeck-slack-incoming-webhook-plugin-0.6.jar

chown rundeck:rundeck rundeck-slack-incoming-webhook-plugin-0.6.jar

DBへrundeck db/userを追加


sudo su postgres -c 'psql postgres'
CREATE ROLE rundeckuser WITH LOGIN PASSWORD 'hogehoge';

create database rundeck;
grant ALL privileges on database rundeck to rundeckuser;

vi /var/lib/pgsql/9.6/data/pg_hba.conf


local   all             all                                     trust     #peer

systemctl restart postgresql-9.6

rundeck 再起動


systemctl stop rundeckd

動作確認

セットアップ手順は以上です。
運用時は、この後ユーザー作成、SSL鍵作成等あります。


トラブルシューティング

ブラウザでエラー画面になる場合…


HTTP ERROR: 503
Problem accessing /user/login. Reason:

    Service Unavailable

→エラーログを確認

less /var/log/rundeck/service.log

観点

  • DBドライバの設定ファイル(/etc/rundeck/rundeck-config.properties)の内容は正しい?
  • rundeckuser ユーザーとrundeck dbは作成されている?
  • 4440ポート空いている?

その他参照

・公式
http://rundeck.org/docs/administration/setting-up-an-rdb-datasource.html
・用法
http://swfz.hatenablog.com/entry/2015/11/06/235658

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2