ansible-role-mysqlを使ってdatabaseとuserを追加したいのですが、方法が分かりません。
https://github.com/geerlingguy/ansible-role-mysql/blob/master/defaults/main.yml
こちらの
# Databases. mysql_databases: [] # - name: example # collation: utf8_general_ci # encoding: utf8 # replicate: 1 # Users. mysql_users: [] # - name: example # host: 127.0.0.1 # password: secret # priv: *.*:USAGE
この辺りのコメントを外して
# Databases. mysql_databases: [] - name: example collation: utf8_general_ci encoding: utf8 replicate: 1 # Users. mysql_users: [] - name: example host: 127.0.0.1 password: secret priv: *.*:USAGE
みたのですがエラーが出てダメでした。
エラーの内容は以下です。
ERROR! Syntax Error while loading YAML. The error appears to have been in 'ここはrootパス/roles/geerlingguy.mysql/defaults/main.yml': line 101, column 4, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: mysql_databases: [] - name: takeoec ^ here
そこで以下のようにしてみたところ
# Databases. mysql_databases: - name: example collation: utf8_general_ci encoding: utf8 replicate: 1 # Users. mysql_users: - name: example host: 127.0.0.1 password: secret priv: *.*:USAGE
以下のようなエラーが出ました。
The error appears to have been in 'ここはrootパス/roles/geerlingguy.mysql/defaults/main.yml': line 111, column 13, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: password: secret priv: *.*:USAGE ^ here
そこで
# Databases. mysql_databases: - name: example collation: utf8_general_ci encoding: utf8 replicate: 1 # Users. mysql_users: - name: example host: 127.0.0.1 password: secret priv: "example.*:ALL"
以下のようなエラーが出ました。
TASK [geerlingguy.mysql : Disallow root login remotely] ************************ failed: [default] (item=DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')) => {"changed": false, "cmd": ["mysql", "-NBe", "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')"], "delta": "0:00:00.008562", "end": "2017-03-09 01:21:59.108040", "failed": true, "item": "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')", "rc": 1, "start": "2017-03-09 01:21:59.099478", "stderr": "ERROR 1146 (42S02) at line 1: Table 'mysql.user' doesn't exist", "stdout": "", "stdout_lines": [], "warnings": []} to retry, use: --limit @ここはrootパス/lamp.retry
ここで手詰まりでどうしたら良いか分かりません。
ご教授願います。
環境は
vgrantで実装していて
centos6.7を使っています。
https://github.com/CommanderK5/packer-centos-template/releases/download/0.6.7/vagrant-centos-6.7.box
roleは他に
https://galaxy.ansible.com/geerlingguy/php/
https://galaxy.ansible.com/geerlingguy/apache/
を入れています。
今回のソースは以下です。
https://github.com/geerlingguy/ansible-role-mysql
https://galaxy.ansible.com/geerlingguy/mysql/
よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。