0

I have a playbook which will checkout the code from git copy the changes to the respective remote server and execute the process and share the output back to github now that everything is fine lastly I need to restart the server,but my issue is it should not be root user how can I restart the server after executing the necessary changes with the user who is normal user access, server is weblogic,

---

- hosts: deploy
  tasks:

  - name: clone a private repository
    git:
      repo: 'git@172.28.xx.xx:Rakshith/BELLCANNADA.git'
      dest: /srvrs/osm104/PONG
      version: SAAS_1
      clone: yes

  - copy:
          src=/srvrs/osm104/PONG/COM/OSM/OPERATION/OSM_104/wlst1.properties
          dest=/srvrs/osm104/Oracle/Middleware/Oracle_Home/oracle_common/common/bin/wlst1.properties
          mode=0644
          backup=true
          remote_src=yes


  - name: Execute script
    shell: wlst.sh >> OUTPUT.txt
    args:
      chdir: /srvrs/osm104/Oracle/Middleware/Oracle_Home/oracle_common/common/bin/
      creates: OUTPUT.txt


  - copy:
          src=/srvrs/osm104/Oracle/Middleware/Oracle_Home/oracle_common/common/bin/OUTPUT.txt
          dest=/srvrs/osm104/PONG/COM/OSM/OPERATION/OSM_104/SAAS1.0_OUTPUT_EnvName.txt
          mode=0644
          backup=true
          remote_src=yes


 - name: Reboot server
   shell: reboot
    become: yes
    become_user: some_user
    local_action: wait_for host="{{ 10.36.xx.xx }}" search_regex=OpenSSH port=22 timeout=300
2
  • It would be much easier if you just posted your playbook. – Gerald Schneider Aug 8 '17 at 13:46
  • I have placed now but its a user named osm104 not root so how to restart my weblogic server after the neccessary changes – Rakshu Aug 8 '17 at 13:54
0

Maybe add a handler? You need to create a handles file under the roles directory. For example: roles/common/handlers/main.yml

- name: reboot server command: /sbin/reboot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.