- setfact: stopcommand: “{{ weblogichome }}/userprojects/domains/{{…
- User
-
set_fact: stop_command: “{{ weblogic_home }}/user_projects/domains/{{ hostvars[inventory_hostname].domain }}/bin/stopWebLogic.sh &”
-
name: Stop Admin Server shell: “{{ stop_command }}” when: admin_port|string in check_adm_port.stdout
-
name: Wait for wl port to be unavailable wait_for: host: “{{ hostvars[inventory_hostname].ansible_host }}” port: “{{ hostvars[inventory_hostname].admin_port }}” state: absent timeout: 800 register: wait_adm
why do i need set facts on the above or its not nessesary
-
- Assistant
In an Ansible playbook, the
set_factmodule is used to set host variables during the execution of a playbook. These facts can then be reused later in the playbook.In the snippet you've provided,
set_factis used to define a variable calledstop_command. This variable constructs the command to stop the WebLogic server by combining the and variables with the path to the script. By using , you can easily change the in one place if, for example, the location of the script were to change, rather than having to change it everywhere the command is used in your playbook.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.