Samples - name: Find files to delete find: paths: /home/mcpaint/backup patterns: *.tar.gz register: out - name: Delete files to delete file: path: "{{ item.path }}" state: absent with_items: "{{ out.files }}" loop_control: label: "{{ item.path }}" Documents https://docs.ansible.com/ansible/latest/collections/ansible/builtin/find_module.html 참고 자료: http://www.freekb.net/Article?id=573 Remove file..
Ansible ‘When’ Statement: Check If Variable Is… Check if Ansible variable is defined (exists): tasks: - shell: echo "The variable 'foo' is defined: '{{ foo }}'" when: foo is defined - fail: msg="The variable 'bar' is not defined" when: bar is undefined Check if Ansible variable is empty: tasks: - fail: msg="The variable 'bar' is empty" when: bar|length == 0 - shell: echo "The variable 'foo' is n..
2.5 버전을 기준으로 사용법이 변경되었습니다. 2.5 이후 버전 패스워드 파일을 만들고 OpenSSL을 이용하여 암호화 # Plain test 형태의 암호를 가진 파일 생성 $ vi .vault_pass_org # OpenSSL을 이용하여 암호화 $ sudo openssl aes-256-cbc -salt -in .vault_pass_org -out .vault_pass enter aes-256-cbc encryption password: Verifying - enter aes-256-cbc encryption password:ansible.cfg 에 옵션 추가 [defaults] vault_identity_list = files@./.vault_pass변수파일을 암호화 $ ansible-vault en..
Changed how to use after version 2.5. Ansible Version: 2.5 or later Create a vault password file and encrypt using Openssl # Create a plain text password file and input password $ vi .vault_pass_org # Encrypt a password file using OpenSSL $ sudo openssl aes-256-cbc -salt -in .vault_pass_org -out .vault_pass enter aes-256-cbc encryption password: Verifying - enter aes-256-cbc encryption password:..
증상 Jenkins 실행하면 Permission denied 가 발생한다. Terminal 로 접속하여 직접 ansible command를 실행하면 정상 접근이 된다. Terminal 에서 수동 실행 후 Jenkins 에서 실행하면 또 된다. 확인 내용 구글링을 했더니 ssh 관련 로그 위치를 알 수 있었다. 위치는 /var/log/secure 접근 안될 때 내용을 보니 아래와 같다. Apr 26 12:14:45 XXXXX sshd[74792]: Authentication refused: bad ownership or modes for file /home/xxxxx/.ssh/authorized_keys Apr 26 12:14:45 XXXXX sshd[74795]: Connection closed by 1..
common.yml 이라는 playbook 파일이 있다는 과정에서 다른 playbook 에서 common.yml 을 Include 하는 방법은 아주 간단한다. ---- include: common.yml vars: param1: "param1_value" param2: "param2_value" 위와 같이 작성하면 되고 파라미터 전달 시 vars 구문을 이용하면 된다.공통적인건 common에 하드코딩하고 각 playbook 마다 다르게 적용하고 싶으면 vars 로 전달 후 common.yml 에서 {{param1}}, {{param2}} 형태로 사용하면 된다.
2개의 세션으로 나누어져 있습니다. Ansible 교육 자료 - 01. Introduction: http://mcpaint.tistory.com/277Ansible 교육 자료 - 02. Playbooks: http://mcpaint.tistory.com/278https://github.com/mcpaint/learning-ansible/tree/master/02_Playbooks PlaybooksPlaybook 이란?Playbooks - play - tasks 구조 #1Playbooks - play - Roles 구조Playbooks - Hosts - Roles 관계문법의 변화특정 버전에서 부터 문법이 달라졌다. 두개 모두 사용이 가능하다.file 모듈을 예로 들자면변경 전- file: path=/etc..
2개의 세션으로 나누어져 있습니다. Ansible 교육 자료 - 01. Introduction: http://mcpaint.tistory.com/277Ansible 교육 자료 - 02. Playbooks: http://mcpaint.tistory.com/278 https://github.com/mcpaint/learning-ansible/tree/master/01_Introduction Introduction왜 Ansible 인가?다음과 같은 니즈가 있을 경우 어떻게 처리할 것인가?우리팀 전체 서버의 PING을 체크하고 싶다.우리팀 전체 서버의 OS 버전을 알고 싶다.A라는 프로젝트에 10대의 신규 서버가 추가 투입되어 서버 셋팅이 필요하다.어제날짜 기준 Nginx Access Log 건수를 알고 싶다...
개요shell 이나 command 모듈을 사용하게 되면 아래와 같은 메시지가 나올 때가 있다.뭐 요약하자면 file module 있으니 그거 사용하라는 말. [WARNING]: Consider using the file module with state=absent rather than running rm. If you need to use commandbecause file is insufficient you can add warn=False to this command task or set command_warnings=False inansible.cfg to get rid of this message. 그럼 어떻게 설정하나?두가지 방식1. ansible.cfg 에서 전역 설정2. task에서 설정 a..
- Total
- Today
- Yesterday
- Shell Script
- Config History
- 엔서블
- 파이프라인
- Password manager
- Linux
- 엔시블
- 데브옵스
- Jenkins
- nginx
- PostgreSQL
- vagrant
- groovy
- Docker
- 젠킨스
- 플레이북
- ssl
- iTerm2
- Nexus
- Playbook
- rsync
- 쓰레드덤프
- URL Encoding
- Thread Dump
- Ansible
- 리눅스
- DevOps
- openssl
- JVM
- rundeck
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |