〇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 apache and php modules
apt: name={{ item }} state=present
with_items:
- apache2
- libapache2-mod-php7.0
- php7.0-gd
- php7.0-json
- php7.0-curl
- php7.0-mbstring
- php7.0-xml
- php7.0-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/apache2/apache2.conf
create: yes
block: |
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
become: true
- name: change owner
file:
path: /opt/grav-admin
owner: www-data
group: www-data
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: enable mod_rewrite
apache2_module:
state: present
name: rewrite
become: yes
- name: start apache2.service
systemd:
name: apache2
state: restarted
become: yes
○関連情報
・Gravに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿