java-nginx.yml 869 Bytes
# Last updated at 2019/01/07 14:30 by tiexin.yang@yoho.cn

# Sync and apply java nginx config file
# How to Run:
#       Use the default settings:
#               ansible-playbook -i inventories/$REGION/hosts  playbooks/java.restart-service.v2.yml
#       Apply the specified java_gateway ip addresses:
#               ansible-playbook -i inventories/aws/hosts playbooks/java-nginx.yml -e '{"java_gateway_ips":['IP_BLOCK1','IP_BLOCK2']}'


- hosts: java-nginx
  pre_tasks:
    - shell: cat /proc/cpuinfo | grep processor | wc -l
      register: cpu_count_ret
    - set_fact:
        processor_count: "{{ cpu_count_ret.stdout }}"
  vars_prompt:
    - name: "confirmation"
      prompt: "Sync and reload java nginx. Please Enter YES to continue."
      private: no
  vars:
    java_gateway_ips: "{{ groups['java-gateway'] }}"
  remote_user: root
  roles:
    - openresty