본문 바로가기

LINUX/Redhat

RHCE v9 (Redhat 9) 기출 문제

반응형
728x90

 

 

기존 redhat 8버전의 덤프를 수정하였습니다.

 

ansible-navigator를 사용해도 됩니다. 

 

 

 

RHCE(Ansible)

 

시스템 IP 주소 Ansible Roles
control.domain1.example.com 172.24.1.11 ansible control node
utility.domain1.example.com 172.24.1.17 Utility node
node1.domain1.example.com 172.24.1.6 ansible managed node
node2.domain1.example.com 172.24.1.7 ansible managed node
node3.domain1.example.com 172.24.1.8 ansible managed node
node4.domain1.example.com 172.24.1.9 ansible managed node
node5.domain1.example.com 172.24.1.10 ansible managed node

 

 

시험 요건

 

○ 검토 ○             Install and configure Ansible (Ansible 설치 및 구성)

○ 검토 ○             Create yum repositories (yum 저장소 생성)

○ 검토 ○             Install a Collection (컬렉션 설치)

○ 검토 ○             Install packages (패키지 설치)

○ 검토 ○             Use a role  (ansible 역할 사용하기)

○ 검토 ○             Install roles using Ansible Galaxy (Ansible Galaxy를 사용하여 역할 설치하기)

○ 검토 ○             Create and use a role (역할 생성 및 사용하기)

○ 검토 ○             Use roles from Ansible Galaxy (Ansible Galaxy에서 역할 사용하기)

○ 검토 ○             Create and use a logical volume (Logical Volume (LV) 생성 및 사용하기)

○ 검토 ○             Generate a hosts file (Hosts 파일 생성하기)

○ 검토 ○             Modify file content (파일 내용 수정하기)

○ 검토 ○             Create a web content directory (web 컨텐츠 디렉토리 생성하기)

○ 검토 ○             Generate a hardware report (하드웨어 보고서 생성하기)

○ 검토 ○             Create a password vault (비밀번호 보관소 생성하기)

○ 검토 ○             Create user accounts (사용자 계정 생성하기)

○ 검토 ○             Rekey an Ansible vault (Ansible Vault 재키 생성하기)

○ 검토 ○             Configure a cron job  (크론작업 설정하기)

               

 

 

 

 

알아둬야될 사항

 

- 실제 시험에서는 control 서버, node1 ~ node5 총 6대서버로 구성되어 있음

 

- 시험시간은 총 4시간이다 (최소한 3시간안에 모든 문제를 다 풀도록 해야함)

 

- 문제지에서 지시한데로 진행하셔야 합니다.

 

- 특히 웹 서버를 통해서 받는 파일문제가 일부 있는데 엔서블 코드 작성시 반드시 get_url 코드가 반드시 들어가야 함

(시험 채점시 실습환경 초기화후 채점이 추가적으로 테스트들어감)

 

- 이 부분에 대해서 만점을 줄 것인가 부분점수 줄 것인가 오답이냐 유무가 결정됨

 

- 기본적으로 kiosk 계정에 ssh-keygen이 설정되어있으니 절대로 변경하지말것

 

- 문제는 랜덤으로 출시한다.

 

- selinux 적용된상태 또는 서비스가 제대로 재기동하는지 검토해야되므로 주기적으로 재부팅을 하면서 체크하도록한다. 서비스 영구 적용 등

 

 

 

 

 

1. Install and configure Ansible (Ansible 설치 및 구성)

 

문제) Install and configure Ansible on the control node control_domain1.example.com as follows:

제어 노드 control_domain1.example.com에 Ansible을 다음과 같이 구성하시오 

 

□  Install the required packages

□  Create a static inventory file called /home/admin/ansible/inventory so that:

     □  node1 is a member of the dev host group

     □  node2 is a member of the test host group

     □  node3 and node4 are members of the prod host group

     □  node5 is a member of the balancers host group

     □  The prod group is a member of the webservers host gorup

 

필요한 패키지 설치

□ /home/admin/ansible/inventory라는 정적 인벤토리 파일을 생성하고 다음과 같이 구성합니다:

□ node1 dev 호스트 그룹의 구성원입니다.

□ node2 test 호스트 그룹의 구성원입니다.

□ node3 node4 prod 호스트 그룹의 구성원입니다.

□ node5 balancers 호스트 그룹의 구성원입니다.

□ prod 그룹은 webservers 호스트 그룹의 구성원입니다.

 

 

 

□ Create a configuration file called /home/admin/ansible/ansible.cfg so that:

     □ The host inventory file is /home/admin/ansible/inventory

     □ The default content collections directory is /home/admin/ansible/mycollections

     □ The default roles directoty is /home/admin/ansible/roles

 

□ /home/admin/ansible/ansible.cfg라는 구성 파일을 생성하고 다음과 같이 구성합니다:

호스트 인벤토리 파일은 /home/admin/ansible/inventory입니다.

기본 컨텐츠 컬렉션 디렉토리는 /home/admin/ansible/mycollections입니다.

기본 역할 디렉토리는 /home/admin/ansible/roles입니다.

 

 

풀이)

 

방법 1)

sudo dnf –y install ansible-automation-platform-common.noarch

sudo dnf –y install ansible-navigator

 

방법2)

sudo dnf -y install ansible-*

 

 

mkdir ansible && cd ansible

vi inventory

[dev]
Node1
 
[test]
Node2
 
[prod]
Node3
Node4
 
[balancers]
Node5
 
[webservers:children]
prod
[dev]
Node1
 
[test]
Node2
 
[prod]
Node3
Node4
 
[balancers]
Node5
 
[webservers:children]
prod

cat /etc/ansible/ansible.cfg

ansible-config init --disabled >> ansible.cfg

 

 

1번쨰줄
[defaults]
 
54번째줄
collections_path=/home/admin/ansible/mycollections:~/.ansible/collections:/usr/share/ansible/collections
 
139번째줄
inventory = /home/admin/ansible/inventory
 
 
225줄
roles_path = /home/admin/ansible/roles:/usr/share/ansible/roles/
 
 
222줄
remote_user = admin
 
 
357줄
[privilege_escalation]
become=True
become_method=sudo
become_user=root
become_ask_pass=False
1번쨰줄
[defaults]
 
54번째줄
collections_path=/home/admin/ansible/mycollections:~/.ansible/collections:/usr/share/ansible/collections
 
139번째줄
inventory = /home/admin/ansible/inventory
 
 
225줄
roles_path = /home/admin/ansible/roles:/usr/share/ansible/roles/
 
 
222줄
remote_user = admin
 
 
357줄
[privilege_escalation]
become=True
become_method=sudo
become_user=root
become_ask_pass=False

ansible all -m ping

 

[참고] /etc/ansible/ansible.cfg

 

 

 

2. Create yum repositories (yum 저장소 생성)

문제) As a systemm adminstrator, you will need to install software on the managed nodes.

Create the playbook /home/admin/ansible/yum_repo.yml which creates the following yum repositories on each of the managend

시스템 관리자로서, 관리되는 노드에 소프트웨어를 설치해야합니다. 다음 작업을 수행하는 /home/admin/ansible/yum_repo.yml 플레이북을 생성하세요. 각 관리되는 노드에 다음 yum 저장소를 만듭니다.

 

Repository1:

□ The name of repository is EX294_BASE

□ The description is EX 294 base software

□ The base URL is https://rhgl.domain1.example.com/BaseOS

□ GPG signature checking is enabled

□ The GPG key url is https://rhgls.domain1.example.com/RHEL/RPM-GPG-KEY-redhat-release

□ The repository is enable

 

저장소 이름은 EX294_BASE입니다.

설명은 EX 294 기본 소프트웨어입니다.

기본 URL https://rhgl.domain1.example.com/BaseOS입니다.

□ GPG 서명 확인이 활성화되어 있습니다.

□GPG URL https://rhgls.domain1.example.com/RHEL/RPM-GPG-KEY-redhat-release입니다.

저장소가 활성화됩니다.

 

 

Repository2:

□ The name of repository is EX294_STREAM

□ The description is EX 294 stream software

□ The base URL is https://rhgl.domain1.example.com/AppStream

□ GPG signature checking is enabled

□ The GPG key url is https://rhgls.domain1.example.com/RHEL/RPM-GPG-KEY-redhat-release

□ The repository is enable

 

저장소 이름은 EX294_STREAM입니다.

설명은 EX 294 스트림 소프트웨어입니다.

기본 URL https://rhgl.domain1.example.com/AppStream입니다.

□ GPG 서명 확인이 활성화되어 있습니다.

□ GPG URL https://rhgls.domain1.example.com/RHEL/RPM-GPG-KEY-redhat-release입니다.

저장소가 활성화됩니다.

 

 

 

# vi /home/admin/ansible/yum_repo.yml
---
- name: create yum repository
  hosts: all
  tasks:
  - name: Add multiple repositories into the same file (1/2)
    ansible.builtin.yum_repository:
      name: EX294_BASE
      description: EX 294 base software
      file: external_repos
      baseurl: https://rhgl.domain1.example.com/BaseOS
      gpgcheck: yes
 gpgkey: https://rhgls.domain1.example.com/RHEL/RPM-GPG-KEY-redhat-release
      enabled: yes       
 
  - name: Add multiple repositories into the same file (2/2)
    ansible.builtin.yum_repository:
      name: EX294_STREAM
      description: EX 294 stream software
      file: external_repos
      baseurl: https://rhgl.domain1.example.com/AppStream
      gpgcheck: yes

      gpgcheck: yes gpgkey:https://rhgls.domain1.example.com/RHEL/RPM-GPG-KEY-redhat-release
      enabled: yes
# vi /home/admin/ansible/yum_repo.yml
---
- name: create yum repository
  hosts: all
  tasks:
  - name: Add multiple repositories into the same file (1/2)
    ansible.builtin.yum_repository:
      name: EX294_BASE
      description: EX 294 base software
      file: external_repos
      baseurl: https://rhgl.domain1.example.com/BaseOS
      gpgcheck: yes
      gpgkey: https://rhgls.domain1.example.com/RHEL/RPM-GPG-KEY-redhat-release
      enabled: yes       
 
  - name: Add multiple repositories into the same file (2/2)
    ansible.builtin.yum_repository:
      name: EX294_STREAM
      description: EX 294 stream software
      file: external_repos
      baseurl: https://rhgl.domain1.example.com/AppStream
      gpgcheck: yes
      gpgcheck: yes gpgkey:https://rhgls.domain1.example.com/RHEL/RPM-GPG-KEY-redhat-release
      enabled: yes

[참고] ansible-doc yum_repository(EXAMPLE)

 

 

3. Install a Collection (컬렉션 설치)

문제) Install the following collection artifacts available from http://rhgls.domain1.example.com/materials to control domain1.example.com as the user admin

 

사용자 admin으로 http://rhgls.domain1.example.com/materials에서 사용 가능한 다음 컬렉션 아티팩트를 control_domain1.example.com 설치합니다.

 

□ redhat-rhel_system_roles-1.16.2.tar.gz

□ ansible-posix-1.4.0.tar.gz

□ conmunity-general-4.3.0.tar.gz

 

The collections should be installed into the default collections directory /home/admin/ansible/mycollections

컬렉션들은 기본 컬렉션 디렉토리인 /home/admin/ansible/mycollections 설치되어야합니다.

 

# admin 사용자로 control_domain1.example.com 로그인합니다.
> su - admin
 
# /home/admin/ansible/mycollections 디렉토리를 만듭니다.
> mkdir –p /home/admin/ansible/mycollections
 
# 컬렉션 아티팩트를 다운로드하고 /home/admin/ansible/mycollections 디렉토리로 이동합니다.
> cd /home/admin/ansible/mycollections
> wget http://rhgls.domain1.example.com/materials/redhat-rhel_system_roles-1.16.2.tar.gz
> wget http://rhgls.domain1.example.com/materials/ansible-posix-1.4.0.tar.gz
> wget http://rhgls.domain1.example.com/materials/conmunity-general-4.3.0.tar.gz
 
 
방법 1
 
ansible-galaxy collection  install /home/admin/ansible/mycollections/redhat-rhel_system_roles-1.16.2.tar.gz -p /home/admin/ansible/mycollections
ansible-galaxy collection  install /home/admin/ansible/mycollections/ansible-posix-1.4.0.tar.gz -p /home/admin/ansible/mycollections
 
ansible-galaxy collection  install /home/admin/ansible/mycollections/conmunity-general-4.3.0.tar.gz -p /home/admin/ansible/mycollections
 
 
방법 2
 
vi requirements.yml
 
---
collections:
  - name: /home/admin/ansible/mycollections/redhat-rhel_system_roles-1.16.2.tar.gz
  - name: /home/admin/ansible/mycollections/ansible-posix-1.4.0.tar.gz
  - name: /home/admin/ansible/mycollections/conmunity-general-4.3.0.tar.gz
 
ansible-galaxy collection install -r requirements.yml -p /home/admin/ansible/mycollections
 

 

# admin 사용자로 control_domain1.example.com에 로그인합니다.
> su - admin
 
# /home/admin/ansible/mycollections 디렉토리를 만듭니다.
> mkdir –p /home/admin/ansible/mycollections
 
# 각 컬렉션 아티팩트를 다운로드하고 /home/admin/ansible/mycollections 디렉토리로 이동합니다.
> cd /home/admin/ansible/mycollections
> wget http://rhgls.domain1.example.com/materials/redhat-rhel_system_roles-1.16.2.tar.gz
> wget http://rhgls.domain1.example.com/materials/ansible-posix-1.4.0.tar.gz
> wget http://rhgls.domain1.example.com/materials/conmunity-general-4.3.0.tar.gz
 
 
방법 1
 
ansible-galaxy collection  install /home/admin/ansible/mycollections/redhat-rhel_system_roles-1.16.2.tar.gz -p /home/admin/ansible/mycollections
ansible-galaxy collection  install /home/admin/ansible/mycollections/ansible-posix-1.4.0.tar.gz -p /home/admin/ansible/mycollections
 
ansible-galaxy collection  install /home/admin/ansible/mycollections/conmunity-general-4.3.0.tar.gz -p /home/admin/ansible/mycollections
 
 
방법 2
 
vi requirements.yml
 
---
collections:
  - name: /home/admin/ansible/mycollections/redhat-rhel_system_roles-1.16.2.tar.gz
  - name: /home/admin/ansible/mycollections/ansible-posix-1.4.0.tar.gz
  - name: /home/admin/ansible/mycollections/conmunity-general-4.3.0.tar.gz
 
ansible-galaxy collection install -r requirements.yml -p /home/admin/ansible/mycollections

 

 

4. Install packages (패키지 설치)

문제) Create a playbook called /home/admin/ansible/packages.yml that:

 

 /home/admin/ansible/packages.yml이라는 플레이북을 만드세요. 플레이북은 다음을 수행합니다.

 

□ Installs the php and mariadb packages on hosts in the dev, test and prod host groups

□ Install the RPM develpment Tools packages group on hosts in the dev host group

□ Updates all packages to the latest version on hosts in the dev host group

 

□ dev, test prod 호스트 그룹의 호스트에 php mariadb 패키지를 설치합니다.

□ dev 호스트 그룹의 호스트에 RPM 개발 도구 패키지 그룹을 설치합니다.

□ dev 호스트 그룹의 호스트에서 모든 패키지를 최신 버전으로 업데이트합니다.

 

 

$ vi /home/admin/ansible/packages.yml

 

---
- name: 1. install packages
  hosts:
    - dev
    - test
    - prod

  become: true
  tasks:
  - name: SETP1-1. install php mariadb
    yum:
      name:
        - php
        - mariadb-server
      state: latest
 
- name: 2. install dev Packages
  hosts: dev
  become: true
  tasks:
  - name: STEP2-1. install dev packages
    yum:
      name: "@RPM Development Tools"
      state: latest
 
  - name: STEP2-2. update all Packages
    yum:
      name: '*'
      state: latest
---
- name: 1. install packages
  hosts:
    - dev
    - test
    - prod
  become: true
  tasks:
  - name: SETP1-1. install php mariadb
    yum:
      name:
        - php
        - mariadb-server
      state: latest
 
- name: 2. install dev Packages
  hosts: dev
  become: true
  tasks:
  - name: STEP2-1. install dev packages
    yum:
      name: "@RPM Development Tools"
      state: latest
 
  - name: STEP2-2. update all Packages
    yum:
      name: '*'
      state: latest

 

 

[참고] ansible-doc  yum(EXAMPLE)

 

 

 

 

5. Use a role  (ansible 역할 사용하기)

문제) Create a palybook called /home/admin/ansible/selinux.yml that:

 

 /home/admin/ansible/selinux.yml이라는 플레이북을 만드세요. 플레이북은 다음을 수행합니다

 

□ Runs on all managed nodes

□ Uses a selinux role

□ Configures SElinux policy as targeted

□ Sets SElinux state as enforcing

 

모든 관리 대상 노드에서 실행됩니다.

□ selinux 역할을 사용합니다.

□ SElinux 정책을 대상으로 구성합니다.

□ SElinux 상태를 강제로 설정합니다.

 

 

$ sudo dnf list | grep roles

$ sudo dnf install rhel-system-roles

$ vi ~/ansible/selinux.yml

 

---
- hosts: all
  become: true
  vars:
     - selinux_policy: targeted
     - selinux_state: enforcing
  roles:
     - rhel-system-roles.selinux
---
- hosts: all
  become: true
  vars:
     - selinux_policy: targeted
     - selinux_state: enforcing
  roles:
     - rhel-system-roles.selinux

 

6) Install roles using Ansible Galaxy (Ansible Galaxy를 사용하여 역할 설치하기)

문제) Use Ansible Galaxy with a requirements file called /home/admin/ansible/roles/requirements.yml to download and install roles to the default /home/admin/ansible/roles from the following URLs:

 

/home/admin/ansible/roles/requirements.yml이라는 요구사항 파일을 사용하여 Ansible Galaxy를 사용하여 다음 URL에서 역할을 다운로드하고 기본값인 /home/admin/ansible/roles에 설치하세요.

 

http://rhgls.domain1.example.com/materials/haproxy.tar

     The name of this role should be balancer

http://rhgls.domain1.example.com/materials/phpinfo.tar

     The name of this role should be phpinfo

 

http://rhgls.domain1.example.com/materials/haproxy.tar

역할의 이름은 balancer여야 합니다.

http://rhgls.domain1.example.com/materials/phpinfo.tar

이 역할의 이름은 phpinfo여야 합니다.

 

$ mkdir -p ~/ansible/roles && cd ansible

$ vi roles/requirements.yml

 

- name: balancer
src: http://rhgls.domain1.example.com/materials/haproxy.tar
 
- name: phpinfo
src: http://rhgls.domain1.example.com/materials/phpinfo.tar

 

 

$ ansible-galaxy install -r roles/requirements.yml -p roles/

 

 

 

 

7) Create and use a role (역할 생성 및 사용하기)

문제) Create a role called apache in /home/admin/ansible/roles with the following requirements:

 

다음 요구 사항을 갖는 /home/admin/ansible/roles/apache 역할(role)을 생성하십시오.

 

□ The httpd package is installed, enabled on boot, and started

□ The firewall is enabled and running with a rule to allow access to the web server

□ A template file Index.html.j2 exists and is used to create the file /var/www/html/Index.html with the following output:

 

Welcome to HOSTNAME on IPADDRESS

 

where HOSTNAME is the fully qualified domain name of the managed node and IPADDRESS is the IP address of the managed node.

 

Create a playbook called /home/admin/ansible/newrole.yml that uses this role as follows:

□ The playbook runs on hosts in the webservers host group

 

□ httpd 패키지가 설치되고 부팅시 자동 시작되며 시작됩니다. 
□ 방화벽이 활성화되고 웹 서버에 액세스를 허용하는 규칙이 적용됩니다. 
□ Index.html.j2 템플릿 파일이 존재하고, 다음 출력을 사용하여 /var/www/html/Index.html 파일을 생성합니다: 
Welcome to HOSTNAME on IPADDRESS 
여기서 HOSTNAME은 관리 노드의 완전히 정규화된 도메인 이름이고, IPADDRESS는 관리 노드의 IP 주소입니다.
/home/admin/ansible/newrole.yml 이라는 플레이북(playbook)을 다음과 같이 역할(role)로 사용하도록 만드십시오: 
□ 플레이북은 webservers 호스트 그룹의 호스트에서 실행됩니다.

 

■ 스켈레톤(skelton) 생성

 

$ vi ~/ansible/roles/apache/templates/index.html.j2

 

Welcome to {{ ansible_fqdn }} on {{ ansible_default_ipv4.address }}

 

ansible localhost -m setup -a 'filter=ansible_hostname'

ansible localhost -m setup -a 'filter=ansible_default_ipv4'

 

또는

 

ansible localhost -m setup | less를 사용하여 ansible_fqdn, ansible_default_ipv4.address 를 찾아야 한다.

 

 

 

■ main.yml 작성하기

 

$ cd ~/ansible

$ ansible-galaxy init roles/apache

$ vi ~/ansible/roles/apache/tasks/main.yml

 

---
# tasks file for apache
- name: STEP1. install httpd
  yum:
    name: httpd
    state: latest
 
- name: STEP2. Start service httpd
  service:
    name: httpd
    enabled: yes
    state: started
 
- name: STEP3. Start service firewalld
  service:
    name: firewalld
    enabled: yes
    state: started
 
- name: STEP4. Add service firewalld
  firewalld:
    service: http
    state: enabled
    permanent: yes
    immediate: yes
 
- name: Create index.html
  template:
    src: index.html.j2
    dest: /var/www/html/index.html

 

---
# tasks file for apache
- name: STEP1. install httpd
  yum:
    name: httpd
    state: latest
 
- name: STEP2. Start service httpd
  service:
    name: httpd
    enabled: yes
    state: started
 
- name: STEP3. Start service firewalld
  service:
    name: firewalld
    enabled: yes
    state: started
 
- name: STEP4. Add service firewalld
  firewalld:
    service: http
    state: enabled
    permanent: yes
    immediate: yes
 
- name: Create index.html
  template:
    src: index.html.j2
    dest: /var/www/html/index.html

 

[참고사항]

- ansible-doc yum

- ansible-doc service

- ansible-doc firewalld

- ansible-doc template

 

 

■ newrole.yml 작성

$ vi ~/ansible/newrole.yml

---
- hosts: webservers
  become: true
  roles:
    - apache

 

---
- hosts: webservers
  become: true
  roles:
    - apache

 

$ ansible-playbook newrole.yml

■ prod 그룹의 node3, node4 결과 확인

 

$ curl 172.24.1.8

Welcome to node3.domain1.example.com on 172.24.1.8

 

$ curl 172.24.1.9

 

Welcome to node4.domain1.example.com on 172.24.1.9

 

 

 

 

8) Use roles from Ansible Galaxy (Ansible Galaxy에서 역할 사용하기)

문제) Create a playbook called /home/admin/ansible/roles.yml with the following requirements:

 

다음 요구사항을 갖는 /home/admin/ansible/roles.yml 이름의 playbook을 생성합니다:

 

□ The playbook contains a play that runs on hosts in the balancers host group and uses the balancer role

      This role configures a service to load balance web server requests between hosts in the webservers host group.

      Browsing to hosts in the balancers host group(for example http://node5.domain1.example.com/) produces the following output:

     

□ balancers 호스트 그룹에서 실행되며 balancer role을 사용하는 play가 포함되어야 합니다. 
이 role은 webservers 호스트 그룹 내의 호스트 사이에서 웹 서버 요청을 로드 밸런싱하는 서비스를 구성합니다. 
예를 들어 http://node5.domain1.example.com/을 브라우징하면 다음 출력이 생성됩니다

 

      Welcome to node3.domain1.example.com on 172.24.1.8

      Reloading the browser produces output from the alternate web server:

      Welcome to node4.domain1.example.com on 172.24.1.9

 

Welcome to node3.domain1.example.com on 172.24.1.8 
브라우저를 다시 로드하면 대체 웹 서버에서 출력을 생성합니다: 
Welcome to node4.domain1.example.com on 172.24.1.9

 

□ The playbook contains a play that runs on hosts in the webserver host group and uses the phpinfo role

      Browsing to hosts in the webservers host group with the URL /hello.php produces the following output:

 

□ webservers 호스트 그룹에서 실행되며 phpinfo role을 사용하는 play가 포함되어야 합니다.
   webservers 호스트 그룹 내의 호스트에서 /hello.php URL로 브라우징하면 다음 출력이 생성됩니다: 

 

      Hello PHP World from FQDN

      wherer FQDN is the fully qualified domain name of the host. For example, browsing to http://node3.domain1.example.com/hello.php produces the following output:

 

여기서 FQDN은 호스트의 완전한 도메인 이름입니다. 
예를 들어 http://node3.domain1.example.com/hello.php을 브라우징하면 다음 출력이 생성됩니다:

 

      Hello PHP World from node3.domain1.example.com

 

      along with various details of the PHP configuration including the version of PHP that is installed. Similarly, browsing to http://node4.domain1.example.com/hello.php produces the following output:

 

http://node4.domain1.example.com/hello.php를 브라우징하면, PHP 구성의 여러 세부 정보와 함께 다음과 같은 출력이 생성됩니다.

 

      Hello PHP World from node4.domain1.example.com

 

      along with various details of the PHP  configuration including the version of PHP that is installed

 

PHP 구성의 다양한 세부 정보와 설치된 PHP 버전을 포함하여 출력됩니다.

 

 

$ vi ~/ansible/roles.yml

 

---
- hosts: webservers
  become: true
  roles:
    - phpinfo

 
- hosts: balancers
  become: true
  roles:
    - balancer

 

---
- hosts: webservers
  become: true
  roles:
    - phpinfo

 
- hosts: balancers
  become: true
  roles:
    - balancer

 

$ ansible-playbook roles.yml

 

 

■ balancers 결과 확인 (로드 벨런싱이 정상적으로 출력되는지 확인

 

$ curl http://node5.domain1.example.com

 

Welcome to node3.domain1.example.com on 172.24.1.8

 

$ curl http://node5.domain1.example.com

 

Welcome to node4.domain1.example.com on 172.24.1.9

 

 

■ hello.php 결과 확인

 

$ curl http://node3.domain1.example.com/hello.php/hello.php

 

Hello PHP World from node3.domain1.example.com

 

 

 

$ curl http://node4.domain1.example.com/hello.php/hello.php

 

Hello PHP World from node4.domain1.example.com

 

 

 

 

 

9) Create and use a logical volume (Logical Volume (LV) 생성 및 사용하기)

문제)  Create a playbook called /home/admin/ansible/lv.yml that runs on all managed nodes that does the following:

 

문제) 모든 관리 노드에서 실행되는 /home/admin/ansible/lv.yml이라는 플레이북을 만들어서 다음을 수행하십시오:

 

□  Create a logical volume with these requirements:

      □ The logical volume is created in the research volume gorup

      □ The logical volume name is data

      □ The logical volume size is 1500 MiB

 

□ 다음 요구 사항을 갖춘 논리 볼륨을 만듭니다. 
□ 논리 볼륨은 research 볼륨 그룹에 생성됩니다. 
□ 논리 볼륨 이름은 데이터입니다. 
□ 논리 볼륨 크기는 1500 MiB입니다.

 

□ Formats the logical volume with the ext4 filesystem

□ If the requested logical volume size cannot be created the error message

    Cloud not create logical volume of that size

    should be displayed and the size 800 MiB should be used instead

□ If the volume group research does not exist, the error message

    Volume group does not exist

    should be displayed

□ Does NOT mount the logical volume in any way

 

□ ext4 파일 시스템으로 논리 볼륨을 포맷합니다. 
□ 요청한 논리 볼륨 크기를 만들 수 없는 경우 오류 메시지 해당 크기의 논리 볼륨을 만들 수 없습니다. 가 표시되며 크기 800 MiB 대신 사용됩니다. 
□ 볼륨 그룹 research가 없는 경우 오류 메시지 볼륨 그룹이 없습니다. 가 표시됩니다. 
□ 논리 볼륨을 어떤 방식으로도 마운트하지 않습니다.

 

$ vi ~/ansible/lv.yml

 

---
- hosts: all
  tasks:
  - block:
    - name: Create a logical volume of 1500m
      lvol:
        vg: research
        lv: data
        size: 1500m
    - name: Create a ext4
      filesystem:
        fstype: ext4
        dev: /dev/research/data
    rescue:
    - debug:
        msg: Could not create logical volume of that size
    - name: Create a logical volume of 800m
      lvol:
        vg: research
        lv: data
        size: 800m
      when: ansible_lvm.vgs.research is defined
      ignore_errors: yes
    - debug:
        msg: Volume group done not exist
      when: ansible_lvm.vgs.research is undefined

 

---
- hosts: all
  tasks:
  - block:
    - name: Create a logical volume of 1500m
      lvol:
        vg: research
        lv: data
        size: 1500m
    - name: Create a ext4
      filesystem:
        fstype: ext4
        dev: /dev/research/data
    rescue:
    - debug:
        msg: Could not create logical volume of that size
    - name: Create a logical volume of 800m
      lvol:
        vg: research
        lv: data
        size: 800m
      when: ansible_lvm.vgs.research is defined
      ignore_errors: yes
    - debug:
        msg: Volume group done not exist
      when: ansible_lvm.vgs.research is undefined

 

 

[참고] ansible-doc lvol

 

 

 

 

10) Generate a hosts file (Hosts 파일 생성하기)

□ Download an initial template file from http://rhgls.domain1.example.com/material/hosts.j2 to /home/admin/ansible

□ Complete the template so that it can be used to generate a file with a line for each inventory host in the same format as /etc/hosts

□ Download the file from http://rhgls.domain1.example.com/materials/hosts.yml to /home/admin/ansible/hosts.yml. This playbook will use the template to

      generate the file /etc/myhosts on hosts in the dev host group.

 

□ http://rhgls.domain1.example.com/material/hosts.j2에서 초기 템플릿 파일을 /home/admin/ansible에 다운로드합니다.
□ 템플릿을 완성하여 /etc/hosts와 동일한 형식의 각 인벤토리 호스트에 대한 라인이 생성될 수 있도록합니다. 
□ http://rhgls.domain1.example.com/materials/hosts.yml에서 파일을 /home/admin/ansible/hosts.yml로 다운로드합니다.
이 플레이북은 템플릿을 사용하여 dev 호스트 그룹의 호스트에서 /etc/myhosts 파일을 생성합니다.

 

  Do not make any changes the play book

 

플레이북에는 변경하지 마세요.

 

When the playbook is run, the file /etc/myhosts on hosts in the dev host group should have a line for each managed host:

 

127.0.0.1 localhost localhost.localdomain localhosts4 localhosts4.localdomain4

::1 localhost localhost.localdomain localhosts6 localhosts6.localdomain6

 

172.24.1.6 node1.damain1.example.com node1

172.24.1.7 node2.damain1.example.com node2

172.24.1.8 node3.damain1.example.com node3

172.24.1.9 node2.damain1.example.com node4

172.24.1.10 node5.damain1.example.com node5

 

NOTE: The order in which the inventory host names appear is not important.

 

플레이북을 실행하면 dev 호스트 그룹의 호스트에서 /etc/myhosts 파일에 각 관리 호스트에 대한 라인이 있어야합니다.

127.0.0.1 localhost localhost.localdomain localhosts4 localhosts4.localdomain4 ::1 localhost localhost.localdomain localhosts6 localhosts6.localdomain6

172.24.1.6 node1.damain1.example.com node1 
172.24.1.7 node2.damain1.example.com node2 
172.24.1.8 node3.damain1.example.com node3 
172.24.1.9 node2.damain1.example.com node4 
172.24.1.10 node5.damain1.example.com node5

참고 : 인벤토리 호스트 이름이 나타나는 순서는 중요하지 않습니다.

 

 

 

 

■ hosts.j2 파일내용

 

vi hosts.j2

{% for host in groups['all'] %}

{{ hostvars[host]['ansible_facts']['fqdn'] }} {{ hostvars[host]['ansible_facts']['default_ipv4']['address'] }} {{ hostvars[host]['ansible_facts']['hostname'] }}

{% endfor %}

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

{% for host in groups['all'] %}
{{ hostvars[host]['ansible_facts']['fqdn'] }} {{ hostvars[host]['ansible_facts']['default_ipv4']['address'] }} {{ hostvars[host]['ansible_facts']['hostname'] }}
{% endfor %}

 

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

{% for host in groups['all'] %}
{{ hostvars[host]['ansible_facts']['fqdn'] }} {{ hostvars[host]['ansible_facts']['default_ipv4']['address'] }} {{ hostvars[host]['ansible_facts']['hostname'] }}
{% endfor %}

 

$ vi ~/ansible/hosts.yml

 

---
- hosts: dev
  become: true
  tasks:
  - name: template hosts file
    template:
      src: hosts.j2
      dest: /etc/myhosts
    when: ansible_hostsname in groups ['dev']

---
- hosts: dev
  become: true
  tasks:
  - name: template hosts file
    template:
      src: hosts.j2
      dest: /etc/myhosts
    when: ansible_hostsname in groups ['dev']

 

 

 

 

 

11) Modify file content (파일 내용 수정하기)

문제)  Create a playbook called /home/admin/ansible/issue.yml as follows:

 

다음과 같이 /home/admin/ansible/issue.yml 이라는 플레이북을 작성하세요. 

 

□ The playbook runs an all inventory hosts

□ The playbook replaces the contests of /etc/issue with a single line of text as follow:

     □ On hosts in the dev hosts group, the line reads: Development

     □ On hosts in the test host group, the line reads: Test

     □ On hosts in the prod host group, the line read: Production

 

플레이북은 인벤토리 호스트 전체에서 실행됩니다.

플레이북은 /etc/issue 파일의 내용을 다음과 같이 변경합니다:

□ dev 호스트 그룹의 호스트에서는 다음과 같이 변경됩니다: Development

□ test 호스트 그룹의 호스트에서는 다음과 같이 변경됩니다: Test

□ prod 호스트 그룹의 호스트에서는 다음과 같이 변경됩니다: Production

 

 

$ vi issue.yml

 

---
- name: all
  hosts: all
  tasks:
  - name: Copy using Development
    copy:
      content: 'Development'
      dest: /etc/issue
    when: "inventory_hostname in groups.dev"
 
  - name: Copy using Test
    copy:
      content: 'Test'
      dest: /etc/issue
    when: "inventory_hostname in groups.test"
 
  - name: Copy using Production
    copy:
      content: 'Production'
      dest: /etc/issue
    when: "inventory_hostname in groups.prod"

 

---
- name: all
  hosts: all
  tasks:
  - name: Copy using Development
    copy:
      content: 'Development'
      dest: /etc/issue
    when: "inventory_hostname in groups.dev"
 
  - name: Copy using Test
    copy:
      content: 'Test'
      dest: /etc/issue
    when: "inventory_hostname in groups.test"
 
  - name: Copy using Production
    copy:
      content: 'Production'
      dest: /etc/issue
    when: "inventory_hostname in groups.prod"

 

$ ansible all -m shell -a 'cat /etc/issue'

 

 

 

 

 

12) Create a web content directory (web 컨텐츠 디렉토리 생성하기)

문제) Create a playbook called /home/admin/ansible/webcontent.yml as follows:

 

/home/admin/ansible/webcontent.yml이라는 플레이북을 다음과 같이 작성하세요:

 

□ The playbook runs on managed nodes in the dev host group

□ Create the directory /webdev with the following requirements:

     □ It is owned by the webdev group

     □ It has regular permissions: owner=read+write+execute, group=read+write+execute, other=read+execute

     □ It has special permissions: set group ID

□ Symbolically link /var/www/html/webdev to /webdev

□ Create the file /webdev/index.html with a single line of text that reads: Development

□ Browsing this directoryu on hosts in the dev host group (for example http://node1.domain1.example.com/webdev/) produces the following output: Development

 

플레이북은 dev 호스트 그룹의 관리 대상 노드에서 실행됩니다.

다음 요구 사항을 갖는 /webdev 디렉토리를 생성하세요.

그룹 소유권이 webdev 설정됩니다.

일반 권한 : 소유자=읽기+쓰기+실행, 그룹=읽기+쓰기+실행, 다른 사용자=읽기+실행

               □ 특수 권한 : 그룹 ID 설정됨

심볼릭 링크 /var/www/html/webdev /webdev 생성하세요.

□ /webdev/index.html 파일을 생성하고, 해당 파일 내용은 "Development"라는 단일 텍스트 라인이어야 합니다.

□ dev 호스트 그룹의 호스트에서 이 디렉토리를 브라우징하면(http://node1.domain1.example.com/webdev/), "Development"가 출력되어야 합니다.

 

$ vi ~/ansible/webcontent.yml

 

---
- name: webcontent
  hosts: dev
  tasks:
  - name: Create a directory
    file:
      path: /webdev
      state: directory
      group: webdev
      mode: '2775'
  - name: Create a symbolic link
    file:
      src: /webdev
      dest: /var/www/html/webdev
      state: link
  - name: Copy using Content
    copy:
      content: 'Development'
      dest: /webdev/index.html
      setype: httpd_sys_content_t

 

---
- name: webcontent
  hosts: dev
  tasks:
  - name: Create a directory
    file:
      path: /webdev
      state: directory
      group: webdev
      mode: '2775'
  - name: Create a symbolic link
    file:
      src: /webdev
      dest: /var/www/html/webdev
      state: link
  - name: Copy using Content
    copy:
      content: 'Development'
      dest: /webdev/index.html
      setype: httpd_sys_content_t

 

(참고사항: 실제시험에서는 webdev group 과 httpd서비스가 자동으로 기동 및 설정 되어있다.)

 

$ curl http:// 172.24.1.6/webdev/

 

Development

 

 

 

13) Generate a hardware report (하드웨어 보고서 생성하기)

문제)Create a playbook called /home/admin/ansible/hwreport.yml that produces an output file called /root/hwreport.txt on all managed nodes with the following information:

 

/home/admin/ansible/hwreport.yml 이름의 playbook을 생성하여 다음 정보가 있는 모든 관리 노드에 /root/hwreport.txt 출력 파일을 생성하십시오. 

 

□ Inventory host name

□ Total memory in MB

□ BIOS version

□ Size of disk device vda

□ Size of disk device vdb

□ Each line of the output file contains a single key = value pair.

 

□ 인벤토리 호스트 이름 
□ 총 메모리 용량(MB) 
□ BIOS 버전 
□ 디스크 장치 vda의 크기 
□ 디스크 장치 vdb의 크기 
□ 출력 파일의 각 줄에는 하나의 키 = 값 쌍이 포함됩니다.

 

Your Playbook should:

□ Download the file from http://rhgls.domain1.example.com/materials/hwreport.empty and save it as /root/hwreport.txt

□ Modify /root/hwreport.txt with the correct values

□ If a hardware item does not exist, the associated value should be set to NONE

 

이 Playbook은 다음을 수행해야합니다. 

□ http://rhgls.domain1.example.com/materials/hwreport.empty 파일을 다운로드하고 /root/hwreport.txt로 저장합니다. 
□ /root/hwreport.txt를 올바른 값으로 수정합니다. 
□ 하드웨어 항목이 존재하지 않으면 연관된 값은 NONE으로 설정해야합니다.

 

$ vi ~/ansible/hwreport.yml

 

---
- name: Make hwreport
  hosts: all
  vars:
    hw_all:
    - hw_name: HOST
      hw_cont: "{{ inventory_hostname | default('NONE', true) }}"
    - hw_name: MEMORY
      hw_cont: "{{ ansible_memtotal_mb | default('NONE', true) }}"
    - hw_name: HOST
      hw_cont: "{{ ansible_bios_version | default('NONE', true) }}"
    - hw_name: HOST
      hw_cont: "{{ ansible_devices.vda.size | default('NONE', true) }}"
    - hw_name: HOST
      hw_cont: "{{ ansible_devices.vda.size | default('NONE', true) }}"
  tasks:
  - name: download hwreport
    get_url:
      url: http://rhgls.domain1.example.com/materials/hwreport.empty
      dest: /root/hwreport.txt
  - name: hwreport
    lineinfile:
      path: /root/hwreport.txt
      regexp: '^{{ item.hw_name }}='
      line: "{{ item.hw_name }}={{ item.hw_cont }}"
    loop: "{{ hw_all }}"

 

---
- name: Make hwreport
  hosts: all
  vars:
    hw_all:
    - hw_name: HOST
      hw_cont: "{{ inventory_hostname | default('NONE', true) }}"
    - hw_name: MEMORY
      hw_cont: "{{ ansible_memtotal_mb | default('NONE', true) }}"
    - hw_name: HOST
      hw_cont: "{{ ansible_bios_version | default('NONE', true) }}"
    - hw_name: HOST
      hw_cont: "{{ ansible_devices.vda.size | default('NONE', true) }}"
    - hw_name: HOST
      hw_cont: "{{ ansible_devices.vda.size | default('NONE', true) }}"
  tasks:
  - name: download hwreport
    get_url:
      url: http://rhgls.domain1.example.com/materials/hwreport.empty
      dest: /root/hwreport.txt
  - name: hwreport
    lineinfile:
      path: /root/hwreport.txt
      regexp: '^{{ item.hw_name }}='
      line: "{{ item.hw_name }}={{ item.hw_cont }}"
    loop: "{{ hw_all }}"

 

$ ansible all -m shell -a 'cat /root/hwreport.txt'

 

 

 

 

14) Create a password vault (비밀번호 보관소 생성하기)

문제) Create an Ansible vault to store user passwords as follows:

 

다음과 같이 사용자 비밀번호를 저장하기 위한 Ansible 보안 저장소(vault)를 생성합니다: 

 

□ The name of the vault is /home/admin/ansible/locker.yml

□ The vault contains two variables with names:

      □ pw_developer with value Imadev

      □ pw_manager with value Imamgr

□ The password to encrypt and decrypt the vault is whenyouwlshuponastar

□ The password is stored in the file /home/admin/ansible/secret.txt

 

□ 저장소 이름은 /home/admin/ansible/locker.yml 입니다. 
□ 저장소에는 다음과 같은 이름과 값의 두 가지 변수가 포함됩니다: 
□ pw_developer의 값은 Imadev 입니다. 
□ pw_manager의 값은 Imamgr 입니다. 
□ 저장소를 암호화하고 복호화하기 위한 비밀번호는 whenyouwlshuponastar 입니다.
 □ 비밀번호는 /home/admin/ansible/secret.txt 파일에 저장됩니다.

 

 

$ echo 'whenyouwishuponastar' > /home/admin/ansible/secret.txt

$ chmod 0600 /home/admin/ansible/secret.txt

 

$ vi /home/admin/ansible/ansible.cfg

vault_password_file = /home/admin/ansible/secret.txt

 

$ ansible-vault encrypt locker.yml

 

 

$ ansible-vault view locker.yml

pw_developer: Imadev
pw_manager: Imamgr

 

pw_developer: Imadev
pw_manager: Imamgr

 

 

 

15) Create user accounts (사용자 계정 생성하기)

 

□  Download a list of users to be created from http://rhgls.domain1.example.com/materials/user_list2.yml and save it to /home/admin/ansible

□  Using the password vault /home/admin/ansible/locker.yml created elsewhere in this exam create a playbook called /home/admin/ansible/users.yml that

     creates user accounts as follows:

  □ Users wich a job description of developer should be:

      □ created on managed nodes in the dev and test host group

      □ assigned the password from the pw_developer variable and should have password that expire after 30 days

      □ a member of supplementary group devops

 

  □ Users with a job description of manager should be:

        □ created on managed nodes in the prod host gorup

        □ assigned the password from the pw_manager variable should have password that expire after 30 days

        □ a member of supplementary group opsmgr

 

□ password should use the SHA512 hash format

□ Your playbook should work using the vault password file /home/admin/ansible/secret.txt created elsewhere in this exam.

 

□ http://rhgls.domain1.example.com/materials/user_list2.yml에서 생성할 사용자 목록을 다운로드하여 /home/admin/ansible에 저장합니다. 

□ 이전에 생성한 비밀번호 보관함인 /home/admin/ansible/locker.yml을 사용하여 /home/admin/ansible/users.yml이라는 플레이북을 생성하여 다음과 같이 사용자 계정을 생성합니다: 

□ 직무가 developer인 사용자는 다음과 같이 처리됩니다: 
□ dev 및 test 호스트 그룹의 관리 노드에서 생성됩니다. 
□ pw_developer 변수에서 비밀번호를 할당받으며, 30일 후에 비밀번호가 만료되도록 설정합니다.
 □ 부가 그룹 devops의 멤버가 됩니다.

□ 직무가 manager인 사용자는 다음과 같이 처리됩니다: 
□ prod 호스트 그룹의 관리 노드에서 생성됩니다. 
□ pw_manager 변수에서 비밀번호를 할당받으며, 30일 후에 비밀번호가 만료되도록 설정합니다.
          □ 부가 그룹 opsmgr의 멤버가 됩니다.

□ 비밀번호는 SHA512 해시 형식을 사용해야 합니다. 
□ 이 플레이북은 이전에 생성한 비밀번호 파일 /home/admin/ansible/secret.txt를 사용하여 작동해야 합니다.

 

$ vi ~/ansible/users.yml

 

---
- hosts: localhost
  connection: local
  become: true
 
  tasks:
  - name: download a user_list.yml
    get_url:
      url: http://rhgls.domain1.example.com/materials/user_list2.yml
      dest: /home/admin/ansible

 
- hosts: dev,test
  become: true
  vars_files:
    - locker.yml
    - user_list.yml
  tasks:
  - name: create a group
    group:
      name: devops
      state: present
 
  - name: run to developer
    user:
      name: '{{ item.name }}'
      comment: '{{ item.job }}'
      password: "{{ 'Imadev' | password_hash('sha512') }}"
      groups: devops
      append: yes
      password_expire_max: 30
    loop: '{{ users }}'
 
- hosts: prod
  become: true
  vars_files:
    - locker.yml
    - user_list.yml
  tasks:
  - name: create a group
    group:
      name: opsmgr
      state: present
 
  - name: run to manager
    user:
      name: '{{ item.name }}'
      comment: '{{ item.job }}'
      password: "{{ 'Imamgr' | password_hash('sha512') }}"
      groups: opsmgr
      append: yes
password_expire_max: 30
    loop: '{{ users }}'

 

---
- hosts: localhost
  connection: local
  become: true
 
  tasks:
  - name: download a user_list.yml
    get_url:
      url: http://rhgls.domain1.example.com/materials/user_list2.yml
      dest: /home/admin/ansible

 
- hosts: dev,test
  become: true
  vars_files:
    - locker.yml
    - user_list.yml
  tasks:
  - name: create a group
    group:
      name: devops
      state: present
 
  - name: run to developer
    user:
      name: '{{ item.name }}'
      comment: '{{ item.job }}'
      password: "{{ 'Imadev' | password_hash('sha512') }}"
      groups: devops
      append: yes
      password_expire_max: 30
    loop: '{{ users }}'
 
- hosts: prod
  become: true
  vars_files:
    - locker.yml
    - user_list.yml
  tasks:
  - name: create a group
    group:
      name: opsmgr
      state: present
 
  - name: run to manager
    user:
      name: '{{ item.name }}'
      comment: '{{ item.job }}'
      password: "{{ 'Imamgr' | password_hash('sha512') }}"
      groups: opsmgr
      append: yes
password_expire_max: 30
    loop: '{{ users }}'

 

$ ansible-playbook users.yml

 

 

 

16) Rekey an Ansible vault (Ansible Vault 키 재생성)

문제)  Rekey an existing ansible vault as follows:

 

다음과 같이 기존 ansible 보안 저장소의 비밀번호를 변경하세요: 

 

□ Download the Ansible vault from http://rhgls.domain1.example.com/materials/salaries.yml to /home/admin/ansible

□ The current vault password is insecure4sure

□ The new vault password is bbe2de98389b

□ The vault remains in an encrypted state with the new password

 

□ http://rhgls.domain1.example.com/materials/salaries.yml 에서 Ansible 보안 저장소를 다운로드하여 /home/admin/ansible 저장합니다. 
□ 현재 저장소의 비밀번호는 insecure4sure 입니다. 
□ 새 저장소 비밀번호는 bbe2de98389b입니다. 
□ 새로운 비밀번호로 저장소는 암호화된 상태로 유지됩니다.

 

$ cd /home/admin/ansible

$ wget http://rhgls.domain1.example.com/materials/salaries.yml

$ ansible-vault rekey --ask-vault-pass salaries.yml

 

Vault password: insecure4sure
New Vault password: bbe2de98389b
Confirm New Vault password: bbe2de98389b
Rekey successful

 

$ ansible-vault view salaries.yml

 

 

 

 

 

17) Configure a cron job  (크론작업 설정하기)

문제) Create a playbook called /home/admin/ansible/cron.yml that runs on all managed hosts and creates a cron job for user natasha as follows:

 

/home/admin/ansible/cron.yml라는 이름의 playbook을 만드세요. 이 playbook은 모든 관리 대상 호스트에서 실행되며 다음과 같이 사용자 natasha의 크론 작업을 만듭니다.

 

□ The user natasha must configure a cron job that runs every 2 minutes and executes logger "EX294 in progress"

 

□ 사용자 natasha는 매 2분마다 실행되고 logger "EX294 in progress"를 실행하는 크론 작업을 설정해야 합니다.

 

$ vi ~/ansible/cron.yml

---
- name: cron
  hosts: all
  tasks:
  - name: add cron
    cron:
      name: add cron natasha
      minute: "*/2"
      user: natasha
      job: logger "EX294 in progress"

 

---
- name: cron
  hosts: all
  tasks:
  - name: add cron
    cron:
      name: add cron natasha
      minute: "*/2"
      user: natasha
      job: logger "EX294 in progress"

 

$ ansible-playbook cron.yml

 

 

 

 

 

 

반응형

'LINUX > Redhat' 카테고리의 다른 글

RHCE 9 (Redhat 9) 후기  (0) 2023.05.11
RHCSA v9 후기 및 추가 문제  (8) 2023.04.05