반응형
  1. Yaml을 이용하여 Node에 tar 파일을 전송하고 tar를 해제하는 작업
  2. AWX 적용
  3. 실행 결과


반응형
  1. HOST 서버에 있는 파일을 Copy 해야 하는 경우
  2. hosts파일에  다음 추가
    • [local]
    • 127.0.0.1


  3. 소스파일
  4. 실행 결과
  5. 참고
    • 복사 대상이 큰 경우 시간이 매우 오래 걸림
    • tar 후 복사 후 extract 추천


반응형
  1. Yaml에서 ansible_facts를 사용하기 위해 어떤 것들이 지원되는지 알아보기 위한 샘플 코드
    • #debugtest.yml 파일 생성
    • ---
      - name: debug Test
      hosts: all
      tasks:
      - name: debug testing
      shell: echo "debug test"
      - debug: var=ansible_facts

    • 들여쓰기 등 주의
    • 아래 이미지와 같이 생성 후 저장
    • #ansible-playbook -i hosts.inv debugtest.yml
    • 중간 생략
    • -
  2. Yaml에서 ['os_family']를 확인할 경우
    • tasks:
        - shell: echo "only on Red Hat 6, derivatives, and later"
          when: ansible_facts['os_family'] == "RedHat" and ansible_facts['lsb']['major_release']|int >= 6
    • 의 형태로 사용 가능

    • 자세한 내용을 알고 싶을 경우 stdout을 파일로 받아서 확인
    • #ansible-playbook -i hosts.inv debugtest.yml > out.txt
    • #cat out.txt
    • -
  3. 목표
    • ansible_fact에서 사용가능한 종류 확인