Ansible


https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-ubuntu-20-04 ``` $ cat ansible/semaphore/playbooks/modules-dev-playbook.yaml - name: Copy Jar file from local hosts: localhost tasks: - name: display module list find: paths: "/home/ansible/ansible/jar/{{ item }}/target" patterns: "*.jar" file_type: file with_items: "{{ modules | difference(['apim-common']) }}" register: jars_to_copy - name: Copy Jar file to remote hosts: dev tasks: - name: Copying jar files copy: src: "{{ item.files[0].path }}" dest: "/home/apim_vup/cruzapim/base/lib/{{ item.item }}/" owner: apim_vup mode: 0664 with_items: "{{ hostvars['localhost']['jars_to_copy'].results | selectattr('matched', 'gt', 0) }}" register: copy_result - name: display module list debug: msg: "Copied jar file for {{ item }}" loop: "{{ copy_result.results }}" - name: Run container register: run_container_result shell: | source /$HOME/.bash_profile /bin/bash /home/apim_vup/cruzapim/bin/all_apim.sh restart - name: Display script output debug: msg: "{{ run_container_result.stdout }}"
되돌아가기 수정