Last active
November 2, 2023 19:46
-
-
Save chusiang/8550bb340c3d03d54f93aa1e8ae52b8c to your computer and use it in GitHub Desktop.
Revisions
-
chusiang revised this gist
Nov 2, 2023 . 1 changed file with 27 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ # 可以設定一些預設行為 # [defaults] General defaults [defaults] # hostfile -- 主機 ip 對照 inventory = hosts # remote_user -- 遠端使用者名稱 remote_user = vagrant # private_key_file -- SSH privite key path private_key_file = ~/.ssh/id_rsa # host_key_checking -- 不詢問加入 ssh 金鑰 host_key_checking = False # 設定 retry files (*.retry) 存放路徑, 預設放家目錄 # 我自己喜歡指定在目前目錄, 以免作完實驗家目錄一堆 .retry retry_files_save_path = ./ansible-retry # 平行處理數量, 預設是 5 個, 應該不一定會用到先記下來 # forks = 20 # 關閉警告訊息 #deprecation_warnings=False log_path = ./logs/playbooks.log -
chusiang revised this gist
Nov 2, 2023 . 1 changed file with 31 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/usr/bin/env ansible-playbook # vim:ft=ansible : # ============================================================ # Author: chusiang / chusiang.lai (at) gmail.com # Blog: http://note.drx.tw # Filename: hello_penguin.yml # Modified: 2023-11-03 03:30 # Description: A sample code for ansible-playbook. # # [ jonny@banshee ~/vcs/sandbox/ansible ] (develop) - 03:39 # (ins)$ ansible-playbook hello_penguin.yml --- - name: say hello penguin hosts: all tasks: - name: run shell: echo 'Hello, Penguin !' || /bin/true register: result - name: print debug: msg: "{{ result.stdout }}" - debug: var=result post_tasks: - name: Copy playbook.log connection: local command: "mv ./logs/playbooks.log ./logs/ansible.{{ lookup('pipe', 'date +%Y%M%d') }}.log" run_once: true # vim: set filetype=yaml.ansible -
chusiang created this gist
Nov 2, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/usr/bin/env ansible-playbook # ============================================================ # Author: chusiang / chusiang.lai (at) gmail.com # Blog: http://note.drx.tw # Filename: hello.yml # Modified: 2023-11-03 03:30 # Description: A sample code for ansible-playbook. # # [ jonny@banshee ~/vcs/sandbox/ansible ] (develop) - 03:36 # (cmd)$ ansible-playbook hello.yml # --- - name: say hello hosts: all tasks: - name: run shell: echo 'Hello, Ansible !' || /bin/true register: result - name: print debug: msg: "{{ result.stdout }}" - debug: var=result post_tasks: - name: Copy playbook.log connection: local command: "mv ./logs/playbooks.log ./logs/ansible.{{ lookup('pipe', 'date +%Y%M%d') }}.log" run_once: true # vim: set filetype=yaml.ansible