Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [defaults]
- host_key_checking = False
- hostfile = inventory
- deprecation_warnings = False
- [privilege_escalation]
- become = yes
- become_user = root
- become_method = sudo
- Inventory file
- host1 ansible_ssh_host==10.30.24.154
- [webservers]
- host1
- [datacenter:children]
- webservers
- [datacenter:vars]
- ansible_ssh_user=root
- ansible_ssh_pass=password
- /roles/webserver/tasks/main.yaml
- ---
- - name: start jboss server
- remote_user: root
- command: sh /home/tcprod/schaitanya/first.sh
- webserver.yaml
- ---
- - hosts: webservers
- gather_facts: yes
- roles:
- - webserver
- I used below command to execute
- ansible-playbook webserver.yaml
- Below is the first.sh file for scenario1
- #!/bin/bash
- # My first script
- /usr/jboss/bin/run.sh -c production -b 0.0.0.0
- #!/bin/bash
- # My first script
- echo "I am able to run as root user"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement