Red hat ansible engine 2.7 release(Korean version)
1. Red Hat Ansible Engine 2.7
In the Light
1
Nov 3, 2018
Technical Account Manager
Song Chang an
2. 다가오는 변화에 대한 준비
4
● Python 2.6은 이제 그만
○ Python 2.7 혹은 Python 3.5 이상 실행 가능.
○ Python 2.6에 대한 Ansible Engine 2.7에 대한 지원은 없음.
○ Ansible-pull를 사용하기 위해서는 필수로 업데이트.
→ 이제 새로운 Ansible engine 2.7를 사용하려는 경우, 기존의 시스템에
최소 Python 2.7 이상 설치가 되어야 정상적으로 구동이 가능.
Ansible has dropped compatibility with Python-2.6 on the controller (The
host where /usr/bin/ansible or /usr/bin/ansible-playbook is run). Modules
shipped with Ansible can still be used to manage hosts which only have
Python-2.6. You just need to have a host with Python-2.7 or Python-3.5 or
greater to manage those hosts from.
3. Ansible-pull 이란?
5
● 동시에 많은 소프트웨어를 배포하고 싶은 호스트, 실행할 수있는
병렬 SSH 연결의 수에 제한.
● 전제 조건은 localhost 에서 ansible이 설치되며, playbook을 호출 할
수있는 저장소.
● ansible-pull 옵션은 cron 작업으로 실행되거나 다른 방법으로
원격으로 트리거.
PUSH PULL
서버 → 클라이언트 호출
즉시 원격 노드 실행
클라이언트 → 서버 호출
지연된 원격노드 실행
Ansible, Fabric, Salt, etc Chef, CFEengine, Puppet, Salt, (Ansible)
4. Ansible-pull 이란?
6
(plabook예제)
- name: Install ansible
yum:
name: ansible
….
- name: Create local directory to work from
file:
path: {{workdir}}
state: directory
…
- name: Copy ansible inventory file to client
copy:
src: /etc/ansible/hosts
dest: /etc/ansible/hosts
…
- name: Create crontab entry to clone/pull git repository
template:
src: templates/etc_cron.d_ansible-pull.j2
dest: /etc/cron.d/ansible-pull
5. 다가오는 변화에 대한 준비
7
● 모듈은 더 이상 실제 파일을 가리키는 __file__ 속성에 사용 X.
[포팅가이드 참조]
→ __file__ 속성이 구현된 타사 써드파티 모듈에 대해서 추가로 업데이트
확인.
- tempdir = os.path.dirname(__file__)
- package = os.path.join(tempdir, to_native(deb.rsplit('/', 1)[1]))
+ package = os.path.join(module.tmpdir, to_native(deb.rsplit('/', 1)[1]))
6. 새로운 파일 잠금 기능
8
● 같은 delegation 호스트 및 동일한 파일에 대한 여러 delegation과의
동시 파일 쓰기에 대한 발생 문제 (이슈 재현 케이스)
● module_utils.common.file.FileLock에 개선
→ 현재까지 파악으로는 현재 모듈 단위에서 locking 을 처리하기 위한
목적으로
파악. (lineinfile file locking support)
lib/ansible/module_utils/common/file.py
…
:kw path: Path (file) to lock
:kw lock_timeout:
Wait n seconds for lock acquisition, fail if timeout is reached.
0 = Do not wait, fail if lock cannot be acquired immediately,
Default is None, wait indefinitely until lock is released.
:returns: True
7. Linux 환경의 자동화 개선
9
● 원격으로 모듈을 실행하는 전략을 변경,
모듈 호출은 원격 시스템에서 모듈 당 한 번만 파이썬을 두 번 호출.
[포팅가이드참조]
→ 전체 스레드가 모듈 실행에서 제거되어 잠재적으로 작업 속도를 높임.
OLD In Ansible 2.6 (and earlier) NEW In Ansible 2.7
- name: Install packages
yum:
name: "{{ item }}"
state: present
with_items:
- ngix
- postgresql
- name: Install packages
yum:
name:
- ngix
- postgresql
state: present
8. 재부팅 모듈(2.7)
10
● 시스템을 재부팅하고 시스템이 다시 작동하면 명령에 응답하는
재부팅 모듈
● 이 모듈의 사용은 * nix 시스템에서만 가능.
● Windows 시스템을 재부팅하는 경우, win_reboot(2.3) 를 참조.
→ 이전에 shell에서 shutdown -r now 이후, wait_for로 구현 ,
reboot 모듈을 사용하여, 신뢰성 있는 재부팅이 가능함.
- name: Reboot a slow machine that might have lots of updates to apply
reboot:
reboot_timeout: 3600
9. 신뢰할 수없는 환경에서의 관리 개선
11
● 연결이 어려워진 환경에서 인프라를 보다 잘 관리 하기위한 새로운
기능
● ignore_unreachable 가 추가되어 playbook을 완전히 중단하는
대신 도달 할 수없는 호스트에서 작업을 제외 가능.
→
ignore_unreachable
Boolean that allows you to ignore unreachable hosts and continue with play. This
does not affect other task errors (see ignore_errors) but is useful for groups of
volatile/ephemeral hosts.
인프라가 100 % 신뢰할 수없는 시나리오 예를 들어서 문제가
있는 클라우드 또는 edge 위치 에 아주 유용.
10. 그외 추가된 여러 모듈들
12
Google Cloud Platform
Azure
OpenStack
VMWare
NetApp
and plenty more
많은 수의 모듈 추가 ( 자세한 내용은 현재 링크 )
→ 클라우드 관련 모듈 및 네트워크 관련 모듈 에 대해서 많은 추가가
되었으며, 이전 보다 많은 관련 contributer 들의 참여 확인.
11. 그외 없어지거나 바뀌는 모듈들
13
● 총 40개의 DEPRECATED module list가 공개.
Ansible DEPRECATED module list
→ 이문서를 작성하면서, 2.7.1에는 총 66개의 Deprecated module list
가 확인.
● na_cdot_aggregate use na_ontap_aggregate instead.
● na_cdot_license use na_ontap_license instead.
● na_cdot_lun use na_ontap_lun instead.
● na_cdot_qtree use na_ontap_qtree instead.
● na_cdot_svm use na_ontap_svm instead.
● na_cdot_user use na_ontap_user instead.
● na_cdot_user_role use na_ontap_user_role instead.
……..
12. 도움이 되는 링크
14
● Ansible 2.7 포팅 가이드
● Ansible pull 예제관련 블로그