〇Gravの画面
ブラウザからhttp://<対象ホスト>/grav/にアクセスします。
〇Gravの管理者画面
ブラウザからhttp://<対象ホスト>/grav/admin/にアクセスします。ユーザ/パスワードはadmin/Admin123です。
〇インストール方法
1.下準備
~/.ansible.cfgに以下の内容を設定します
[ssh_connection]
pipelining=True
[defaults]
host_key_checking = False
2. インストール対象ホストのユーザやパスワードを環境に合わせてinventoryファイルに記入します
inventory例
[grav]
192.168.1.107
[all:vars]
ansible_ssh_port=22
ansible_ssh_user=vagrant
ansible_ssh_pass=vagrant
ansible_sudo_pass=vagrant
3.inventory、grav.ymlを準備し、以下のコマンドを実行します。
ansible-playbook -i inventory grav.yml
grav.yml
- hosts: grav
tasks:
- name: install remi repository
yum: name=http://ftp.riken.jp/Linux/remi/enterprise/remi-release-7.rpm
become: true
- name: Install apache and php modules
yum: name={{ item }} state=present enablerepo=remi-php71
with_items:
- httpd
- php
- php-gd
- php-json
- php-curl
- php-mbstring
- php-xml
- php-simplexml
- php-zip
- unzip
become: true
- name: download grav
get_url:
url: https://getgrav.org/download/core/grav-admin/1.4.8
dest: /tmp/grav.zip
become: true
- name: extract grav
unarchive:
remote_src: yes
src: /tmp/grav.zip
dest: /opt/
become: true
- name: download skelton
get_url:
url: https://getgrav.org/download/skeletons/soraarticle-blog/1.1.2
dest: /tmp/grav-skeleton-soraarticle-blog-v1.1.2.zip
become: true
- name: extract skelton
unarchive:
remote_src: yes
src: /tmp/grav-skeleton-soraarticle-blog-v1.1.2.zip
dest: /opt/grav-admin
become: true
- name: place skelton
shell: cp -R /opt/grav-admin/grav-skeleton-soraarticle-blog/* /opt/grav-admin
become: true
- name: create a user
command: ./bin/plugin login newuser --user=admin --password=Admin123 --email=admin@localhost.localdomain --permissions=b --fullname=administrator --title=admin
args:
chdir: /opt/grav-admin
become: true
- name: setup systemd
blockinfile:
dest: /etc/httpd/conf.d/grav.conf
create: yes
block: |
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
become: true
- name: change owner
file:
path: /opt/grav-admin
owner: apache
group: apache
recurse: yes
become: true
- name: symlink
file:
path: /var/www/html/grav
state: link
src: /opt/grav-admin
become: true
- name: clean up
file:
state: absent
path: /tmp/grav.zip
become: yes
- name: clean up skelton
file:
state: absent
path: /tmp/grav-skeleton-soraarticle-blog-v1.1.2.zip
become: yes
- name: start httpd.service
systemd:
name: httpd
state: restarted
become: yes
○関連情報
・Gravに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿