Playbook 작성 실습 - Ansible로 Wildfly 20 설치 > Ansible 자료실

본문 바로가기
사이트 내 전체검색

Ansible 자료실

실습 Playbook 작성 실습 - Ansible로 Wildfly 20 설치

페이지 정보

profile_image
작성자 AnsibleM
댓글 0건 조회 147회 작성일 21-07-19 15:23

본문

1. SERVER SPEC

장비명 KVM - Virtual Machine
CPU Core 2
Memory 4096 MB
HDD 100 GB
OS Red Hat Enterprise Linux 7.7
Ansible 2.9.23
Java 11

2. Wildfly 20 설치

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
- hosts: localhost
  gather_facts: False
  tasks:
  - name: Download Wildfly 20
    get_url:
      url: https://download.jboss.org/wildfly/20.0.1.Final/wildfly-20.0.1.Final.zip
      dest: /root
 
  - name: Extract archive
    unarchive:
      src: /root/wildfly-20.0.1.Final.zip
      dest: /opt
 
  - name: Add Group "wildfly"
    group:
      name: wildfly
 
  - name: Add user "wildfly"
    user:
      name: wildfly
      group: wildfly
      home: /opt/wildfly-20.0.1.Final
 
  - name: Create symbolic link 
    file:
      src: /opt/wildfly-20.0.1.Final
      dest: /opt/wildfly
      state: link
 
  - name: Change ownership of Wildfly installation
    file:
      path: /opt/wildfly
      owner: wildfly
      group: wildfly
      state: directory
      recurse: yes
 
  - name: Change mode for add-user.sh
    file:
      path: /opt/wildfly/bin/add-user.sh
      mode: 755
 
  - name: Add Management User On Wildfly
    shell: /opt/wildfly-20.0.1.Final/bin/add-user.sh -u wildAdmin -p wildAdmin
 
  - name: Task name 2
    file:
      path: /etc/wildfly
      state: directory
 
  - name: Copy Wildfly Conf
    copy:
      src: /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf
      dest: /etc/wildfly/wildfly.conf
 
  - name: Modify Wildfly Conf
    lineinfile:
      path: /etc/wildfly/wildfly.conf
      line: "{{ item }}"
    with_items:
    - ""
    - "# The console address to bind to"
    - "WILDFLY_CONSOLE_BIND=0.0.0.0"
 
  - name: Copy Wildfly Conf2
    copy:
      src: /opt/wildfly/docs/contrib/scripts/systemd/launch.sh
      dest: /opt/wildfly/bin/launch.sh
 
  - name: Modify Wildfly Conf2
    lineinfile:
      path: /opt/wildfly/bin/launch.sh
      regexp: '{{item.From}}'
      line: '{{item.To}}'
    with_items:
         - { From: 'domain.sh', To: '    $WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4'}
         - { From: 'standalone.sh', To: '    $WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4'}
 
  - name: Copy Wildfly Conf3
    copy:
      src: /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service
      dest: /etc/systemd/system/wildfly.service
 
  - name: Modify Wildfly Conf3
    lineinfile:
      path: /etc/systemd/system/wildfly.service
      regexp: 'launch.sh'
      line: 'ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_CONSOLE_BIND'
 
  - name: Change mode for bin/*.sh
    shell: 'chmod +x /opt/wildfly/bin/*.sh'
 
  - name: restart service cron on centos, in all cases, also issue daemon-reload to pick up config changes
    systemd:
      state: started
      daemon_reload: yes
      name: wildfly
 
  - name: Ensure that firewalld is started
    systemd:
      name: firewalld
      state: started
 
  - name: deploy firewalld rules
    firewalld:
      immediate: yes
      port: "{{ item }}"
      state: enabled
      permanent: yes
    with_items:
    - "8080/tcp"
    - "8443/tcp"
    - "9990/tcp"
 
cs


3. Playbook 결과C

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [localhost] *****************************************************************************************************************************

TASK [Download Wildfly 20] *******************************************************************************************************************
changed: [localhost]

TASK [Extract archive] ***********************************************************************************************************************
changed: [localhost]

TASK [Add Group "wildfly"] *******************************************************************************************************************
changed: [localhost]

TASK [Add user "wildfly"] ********************************************************************************************************************
changed: [localhost]

TASK [Create symbolic link] ******************************************************************************************************************
changed: [localhost]

TASK [Change ownership of Wildfly installation] **********************************************************************************************
changed: [localhost]

TASK [Change mode for add-user.sh] ***********************************************************************************************************
changed: [localhost]

TASK [Add Management User On Wildfly] ********************************************************************************************************
changed: [localhost]

TASK [Task name 2] ***************************************************************************************************************************
changed: [localhost]

TASK [Copy Wildfly Conf] *********************************************************************************************************************
changed: [localhost]

TASK [Modify Wildfly Conf] *******************************************************************************************************************
ok: [localhost] => (item=)
changed: [localhost] => (item=# The console address to bind to)
changed: [localhost] => (item=WILDFLY_CONSOLE_BIND=0.0.0.0)

TASK [Copy Wildfly Conf2] ********************************************************************************************************************
changed: [localhost]

TASK [Modify Wildfly Conf2] ******************************************************************************************************************
changed: [localhost] => (item={'From': 'domain.sh', 'To': ' $WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4'})
changed: [localhost] => (item={'From': 'standalone.sh', 'To': ' $WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4'})

TASK [Copy Wildfly Conf3] ********************************************************************************************************************
changed: [localhost]

TASK [Modify Wildfly Conf3] ******************************************************************************************************************
changed: [localhost]

TASK [Change mode for bin/*.sh] **************************************************************************************************************
[WARNING]: Consider using the file module with mode rather than running 'chmod'. If you need to use command because file is insufficient you
can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid of this message.
changed: [localhost]

TASK [restart service cron on centos, in all cases, also issue daemon-reload to pick up config changes] **************************************
changed: [localhost]

TASK [Ensure that firewalld is started] ******************************************************************************************************
ok: [localhost]

TASK [deploy firewalld rules] ****************************************************************************************************************
changed: [localhost] => (item=8080/tcp)
changed: [localhost] => (item=8443/tcp)
changed: [localhost] => (item=9990/tcp)

PLAY RECAP ***********************************************************************************************************************************
localhost : ok=20 changed=19 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

회사명 : (주)리눅스데이타시스템 / 대표 : 정정모
서울본사 : 서울특별시 강남구 봉은사로 114길 40 홍선빌딩 2층 / tel : 02-6207-1160
대전지사 : 대전광역시 유성구 노은로174 도원프라자 5층 / tel : 042-331-1161

접속자집계

오늘
474
어제
331
최대
680
전체
82,219
Copyright © www.linuxdata.org All rights reserved.