site.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. tasks:
  27. - name: Create output directory
  28. ansible.builtin.file:
  29. path: output
  30. state: directory
  31. mode: "0755"
  32. - name: Render Surge client config
  33. ansible.builtin.template:
  34. src: templates/surge-client.conf.j2
  35. dest: output/surge-client.conf
  36. mode: "0600"
  37. - name: Display Surge config location
  38. ansible.builtin.debug:
  39. msg: "Surge client config generated at: output/surge-client.conf"