site.yml 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ---
  2. - name: Bootstrap Python on all hosts
  3. hosts: all
  4. gather_facts: false
  5. become: true
  6. tasks:
  7. - name: Install Python 3
  8. ansible.builtin.raw: apt-get update && apt-get install -y python3
  9. changed_when: false
  10. - name: Base server setup (all hosts)
  11. hosts: all
  12. roles:
  13. - base
  14. - name: Deploy Shadowsocks on relay server
  15. hosts: relay
  16. roles:
  17. - shadowsocks
  18. - name: Deploy Trojan on landing server
  19. hosts: landing
  20. roles:
  21. - trojan
  22. - name: Generate Surge client configuration
  23. hosts: localhost
  24. connection: local
  25. gather_facts: no
  26. become: false
  27. tasks:
  28. - name: Create output directory
  29. ansible.builtin.file:
  30. path: output
  31. state: directory
  32. mode: "0755"
  33. - name: Render Surge client config
  34. ansible.builtin.template:
  35. src: templates/surge-client.conf.j2
  36. dest: output/surge-client.conf
  37. mode: "0600"
  38. - name: Display Surge config location
  39. ansible.builtin.debug:
  40. msg: "Surge client config generated at: output/surge-client.conf"