Ansibleを使用してAlfrescoをインストールする方法 (Amazon Linux 2)

はじめに

Ansibleを使用してAlfrescoをインストールします。
AlfrescoはAWS EC2に作成しました。
スペックは下記の通りです。
– OS:Amazon Linux 2
– インスタンスタイプ:t2.medium
– rootデバイスサイズ:20GB
[参考情報]
Ansible Install

1.AnsibleサーバにYAMLを作成する

1.1.PlayBookを作成する

# cat site.yml
---
- name: Install alfresco
  hosts: tag_srv_alfresco
  gather_facts: false
  become: true
  tasks:
    - import_role:
       name: alfresco

1.2.ロールを作成する

# cat roles/alfresco/tasks/main.yml
---
- name: yum update
  yum:
    name: '*'
    state: latest
    update_cache: yes

- name: install yum
  yum:
    name: "{{ item }}"
  with_items:
    - wget
    - libSM
    - libICE
    - libXrender
    - libXext
    - libGLU
    - mesa-libGL
    - cairo
    - cups

- name: create temporary build directory
  tempfile:
    state: directory
    suffix: build
  register: tmpdir

- name: copy alfresco response file
  copy:
    src: install_ops.txt
    dest: "{{ tmpdir.path }}"

- name: wget alfresco binary
  get_url:
    url: http://eu.dl.alfresco.com.s3.amazonaws.com/release/community/201707-build-00028/alfresco-community-installer-201707-linux-x64.bin
    dest: "{{ tmpdir.path }}"
    mode: +x

- name: install alfresco
  shell: cd "{{ tmpdir.path }}" && ./alfresco-community-installer-201707-linux-x64.bin --optionfile install_ops.txt

- name: start alfresco
  systemd:
    name: alfresco
    state: started

- name: enable alfresco
  systemd:
    name: alfresco
    enabled: yes

1.3.Alfrescoサイレントインストール用のファイルを作成する

# cat roles/alfresco/files/install_ops.txt
mode=unattended
installer-language=ja
jdbc_url=jdbc:postgresql://localhost/alfresco
jdbc_driver=org.postgresql.Driver
jdbc_database=alfresco
jdbc_username=alfresco
jdbc_password=alfresco
prefix=/opt/alfresco-community
alfresco_admin_password=admin
baseunixservice_install_as_service=1
alfrescocustomstack_services_startup=auto

2.Alfresco構築

2.1.AnsibleサーバからAlfrescoを構築する

# ansible-playbook -i inventory/aws site/alfresco/site.yml
PLAY [Install alfresco] ******************************************************************************************************

TASK [alfresco : yum update] *************************************************************************************************
ok: [13.230.185.171]

TASK [alfresco : install yum] ************************************************************************************************
changed: [13.230.185.171] => (item=[u'wget', u'libSM', u'libICE', u'libXrender', u'libXext', u'libGLU', u'mesa-libGL', u'cairo', u'cups'])

TASK [alfresco : create temporary build directory] ***************************************************************************
changed: [13.230.185.171]

TASK [alfresco : copy alfresco response file] ********************************************************************************
changed: [13.230.185.171]

TASK [alfresco : wget alfresco binary] ***************************************************************************************
changed: [13.230.185.171]

TASK [alfresco : install alfresco] *******************************************************************************************
changed: [13.230.185.171]

TASK [alfresco : start alfresco] *********************************************************************************************
changed: [13.230.185.171]

TASK [alfresco : enable alfresco] ********************************************************************************************
ok: [13.230.185.171]

PLAY RECAP *******************************************************************************************************************
13.230.185.171             : ok=8    changed=6    unreachable=0    failed=0

2.2.WebでAlfrescoの接続確認を行う

URL http://${IP Address}:8080/share
user / pass (admin / admin)

alfresco1

2.3.ログインできていることを確認する

alfresco2

まとめ

Ansibleに携わる方のお役に立てれば幸いです。

コメントを残す