run_container.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ---
  2. - name: Create Directory If It Doesn't Exist
  3. file:
  4. path: "{{ item }}"
  5. state: directory
  6. mode: 0755
  7. with_items:
  8. - /root/oopp_level_1
  9. - /root/oopp_level_2
  10. tags: limao_proxy
  11. - name: Define Server_config 1
  12. template: src=server_config.json dest=/root/oopp_level_1/server_config.json owner=root group=root mode=0644
  13. tags: limao_proxy
  14. - name: Define Server_config 2
  15. vars:
  16. sec: True
  17. template: src=server_config.json dest=/root/oopp_level_2/server_config.json owner=root group=root mode=0644
  18. tags: limao_proxy
  19. - name: Stop And Reomove All Container
  20. docker_container:
  21. name: "{{ item }}"
  22. state: absent
  23. with_items:
  24. - oopp-file-1
  25. - oopp-file-2
  26. ignore_errors: True
  27. tags: limao_proxy
  28. - name: Start All Container
  29. shell: "{{ item }}"
  30. with_items:
  31. - docker run --name oopp-file-1 -d --restart "always" --log-opt max-size=3m --log-opt max-file=50 -v /root/oopp_level_1:/oopp_data -p 8388:8388 -p 8389:8389 oopp:1.0 oopp --config_file=/oopp_data/server_config.json
  32. - docker run --name oopp-file-2 -d --restart "always" --log-opt max-size=3m --log-opt max-file=50 -v /root/oopp_level_2:/oopp_data -p 8488:8488 -p 8489:8489 oopp:1.0 oopp --config_file=/oopp_data/server_config.json
  33. tags: limao_proxy