실습 Playbook 작성 실습 - Ansible로 OpenJDK 11 설치
페이지 정보
본문
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
2. Java 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | --- - hosts: localhost gather_facts: no tasks: - name: Install OpenJDK 11 yum: name: java-11-openjdk-devel.x86_64 state: present - name: Correct java version selected alternatives: name: java path: /usr/lib/jvm/java-11-openjdk-11.0.11.0.9-2.el8_4.x86_64/bin/java - name: Get Java Version shell: java --version register: javaVersion - name: Set Java Version Fact set_fact: java_version: "{{ javaVersion.stdout_lines[0] }}" - name: debug debug: var=java_version | cs |
3. Playbook 결과
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] **********************************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************
ok: [localhost]
TASK [Install OpenJDK 11] *************************************************************************************************************
ok: [localhost]
TASK [Correct java version selected] **************************************************************************************************
ok: [localhost]
TASK [Get Java Version] ***************************************************************************************************************
changed: [localhost]
TASK [Set Java Version Fact] ********************************************************************************************
ok: [localhost]
TASK [debug] **************************************************************************************************************************
ok: [localhost] => {
"java_version": "openjdk 11.0.11 2021-04-20 LTS"
}
PLAY RECAP ****************************************************************************************************************************
localhost : ok=6 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- 이전글Ansible-Vault 21.07.16
- 다음글Ansible Galaxy 21.06.14
댓글목록
등록된 댓글이 없습니다.