Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. ---
  2. - hosts: all
  3. tasks:
  4. - name: Get jboss process
  5. shell: ps -ef | grep -v grep | grep -w java | awk '{print $2}'
  6. register: running_processes
  7.  
  8. - name: Kill java processes
  9. command: "kill {{ item }} "
  10. with_items: "{{ running_processes.stdout_lines }}"
  11. become: yes
  12. become_user: jboss
  13.  
  14. - wait_for:
  15. path: "/proc/{{ item }}/status"
  16. state: absent
  17. with_items: "{{ running_processes.stdout_lines }}"
  18. ignore_errors: yes
  19. register: killed_processes
  20. become: yes
  21.  
  22. - name: jboss cleaning
  23. file:
  24. path: "{{ item }}"
  25. state: absent
  26. with_items:
  27. - /opt/jboss-eap-7.1/indices
  28. - /opt/jboss-eap-7.1/bin/indices
  29. - /opt/jboss-eap-7.1/standalone/tmp
  30. - /opt/jboss-eap-7.1/standalone/data
  31. - /opt/jboss-eap-7.1/standalone/deployments/*
  32. become: yes
  33. become_user: jboss
  34. tags:
  35. - cleaning
  36.  
  37. - name: Copy artifact
  38. copy:
  39. src: /var/lib/jenkins/workspace/{{pje_build}}/pje-web/target/pje.war
  40. dest: /opt/jboss-eap-7.1/standalone/deployments/{{ pje_artefato }}
  41. owner: jboss
  42. group: jboss
  43. mode: 0755
  44. become: yes
  45. become_user: jboss
  46. tags:
  47. - copy
  48.  
  49. - name: Start jboss
  50. chdir: /opt/jboss-eap-7.1/bin
  51. shell: ./standalone.sh &
  52. environment:
  53. JAVA_HOME: /opt/jdk
  54. ENV_EUREKA_CLIENT_HOSTNAME: "{{ ansible_default_ipv4.address }}"
  55. become: yes
  56. become_user: jboss
  57. async: 45
  58. poll: 0
  59. tags:
  60. - start
  61.  
  62. - debug:
  63. msg: "IP: {{ ansible_default_ipv4.address }}"
  64. tags:
  65. - deb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement