下面是基本用例: 我有一個NGINX反向代理我想成立,所以我具體的,只有在運行的遊戲「nginx」組。 但是,爲了知道ips來反向代理,我需要從「上游」組收集事實。這不會發生,因爲該遊戲在「上游」上未運行setup。 This answer包含我之前使用過的解決方案,但我希望能夠將它全部包含在單個主機遊戲中,我可以獨立運行其他遊戲。
我有我的Ansible項目結構是這樣的: 我appServershosts下包含了我的主機如下: local ansible_ssh_host=127.0.0.1
staging ansible_ssh_host=<host_ip> ansible_connection=ssh ansible_user=ubuntu ansible_ssh_private_key_file=<key>
v
運行後,下面的Ansible YAML文件中的輸出顯示文件被創建和內容發生變化 的YAML文件 ---
- hosts: all
gather_facts: yes
connection: local
tasks:
- name: Check the date on the server.
action: command touch /opt/