|
| 1 | +Zuul 문서 번역을 위한 Ansible module |
| 2 | +==================================== |
| 3 | + |
| 4 | +Ansible playbook을 통한 Zuul 문서 번역에 사용한 module 정리입니다. |
| 5 | + |
| 6 | +**Requirements** |
| 7 | + |
| 8 | +1. Using **Shell script** to build HTML documentation |
| 9 | + |
| 10 | + `build-translated-lang.sh <https://github.com/openstack-kr/zuul-study/blob/main/l10n-artifact/build-translated-lang.sh>`_ |
| 11 | + |
| 12 | + 위 쉘 스크립트를 사용합니다. 수행하는 작업은 아래와 같습니다. |
| 13 | + |
| 14 | + A. virtual environment 생성 |
| 15 | + B. venv에 dependencies 설치 |
| 16 | + C. co 파일 컴파일을 통한 mo파일 생성 |
| 17 | + D. 번역된 HTML파일 빌드 |
| 18 | + |
| 19 | +2. Using Zuul with **Ansible playbook** |
| 20 | + |
| 21 | + Zuul 환경에 Job을 추가해서 번역한 po파일을 커밋하면 번역된 HTML파일이 생성되도록 합니다. |
| 22 | + |
| 23 | + |
| 24 | +**Ansible playbook** 번역을 위해 playbook에 포함할 작업은 다음과 같습니다. |
| 25 | + |
| 26 | +* 파이썬 환경설정 |
| 27 | +* Zuul repository 클론 |
| 28 | +* 프로젝트의 번역된 po파일을 zuul/doc/source/locale로 복사 |
| 29 | +* 번역 문서 빌드 스크립트 실행 |
| 30 | +* 결과물(HTML) 가져오기 |
| 31 | + |
| 32 | + |
| 33 | +**Ansible module** 위 playbook 작성에 사용한 module들 입니다. |
| 34 | + |
| 35 | +* ansible.builtin.shell |
| 36 | + |
| 37 | + .. code-block:: yaml |
| 38 | +
|
| 39 | + ansible.builtin.shell: | |
| 40 | + export DEBIAN_FRONTEND=noninteractive |
| 41 | + apt-get update |
| 42 | + apt-get install -y software-properties-common gnupg gnupg2 |
| 43 | + add-apt-repository -y ppa:deadsnakes/ppa |
| 44 | + apt-get update |
| 45 | + apt-get install -y gettext python3.11 python3.11-venv python3.11-dev graphviz fonts-nanum |
| 46 | +
|
| 47 | +* ansible.builtin.git |
| 48 | + |
| 49 | + .. code-block:: yaml |
| 50 | +
|
| 51 | + ansible.builtin.git: |
| 52 | + repo: 'https://opendev.org/zuul/zuul.git' |
| 53 | + dest: "{{ ansible_user_dir }}/zuul-repo" |
| 54 | +
|
| 55 | +* ansible.builtin.copy |
| 56 | + |
| 57 | + .. code-block:: yaml |
| 58 | +
|
| 59 | + ansible.builtin.copy: |
| 60 | + src: "{{ zuul.project.src_dir }}/l10n-artifact/build-translated-lang.sh" |
| 61 | + dest: "{{ zuul_doc_path }}/build-translated-lang.sh" |
| 62 | + mode: '0755' |
| 63 | + remote_src: yes |
| 64 | +
|
| 65 | + .. code-block:: yaml |
| 66 | +
|
| 67 | + ansible.builtin.copy: |
| 68 | + src: "{{ zuul.project.src_dir }}/l10n-artifact/ko_KR" |
| 69 | + dest: "{{ zuul_doc_path }}/source/locale/" |
| 70 | + remote_src: yes |
| 71 | +
|
| 72 | +
|
| 73 | +* ansible.builtin.file |
| 74 | + |
| 75 | + .. code-block:: yaml |
| 76 | +
|
| 77 | + ansible.builtin.file: |
| 78 | + path: "{{ zuul_doc_path }}/source/locale" |
| 79 | + state: directory |
| 80 | +
|
| 81 | + .. code-block:: yaml |
| 82 | +
|
| 83 | + ansible.builtin.file: |
| 84 | + path: "{{ ansible_user_dir }}/zuul-repo/venv" |
| 85 | + state: absent |
| 86 | +
|
| 87 | +
|
| 88 | +* ansible.builtin.command |
| 89 | + |
| 90 | + .. code-block:: yaml |
| 91 | +
|
| 92 | + ansible.builtin.command: "bash {{ zuul_doc_path }}/build-translated-lang.sh ko_KR" |
| 93 | + args: |
| 94 | + chdir: "{{ zuul_doc_path }}" |
| 95 | +
|
| 96 | +* ansible.posix.synchronize |
| 97 | + |
| 98 | + .. code-block:: yaml |
| 99 | +
|
| 100 | + ansible.posix.synchronize: |
| 101 | + src: "{{ zuul_doc_path }}/build/html/ko_KR/" |
| 102 | + dest: "{{ zuul.executor.log_root }}/html_docs/" |
| 103 | + mode: pull |
| 104 | +
|
0 commit comments