Hello guys !
I do not get the hostname using this fact in task name within a role.
Not sure if there is a known issue around this or that I'm doing something
wrong.
This is my code:
main yml file contains this:
# facts are collected by default but we want to make sure nobody removes
them
# as they are needed for the 'alive_boxes' task
#
gather_facts: true
...
The role file contains this:
---
# Stop the DB services
#
- name: Stop MySql on {{ ansible_hostname }}
systemd:
state: stopped
name: mysql
become: yes
register: screen_out
- name: DBG | Status of MySql for {{ansible_hostname}}
ansible.builtin.debug:
msg: "{{ ansible_hostname}} - {{ screen_out }}"
Tried with and without quotes, etc without success.
It perferctly works in the 'msg' so I think there must be something else
I'm missing.
Appreciate your help.
> ansible --version
ansible [core 2.12.5]
config file = /mnt/c/Ansible/Ansible_scripts/MySql/ansible.cfg
configured module search path =
['/home/fjlopez/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location =
/home/fjlopez/.local/lib/python3.8/site-packages/ansible
ansible collection location =
/home/fjlopez/.ansible/collections:/usr/share/ansible/collections
executable location = /home/fjlopez/.local/bin/ansible
python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
jinja version = 2.10.1
libyaml = True
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/3ff1ca90-d94c-41e8-baae-99eaf21f999en%40googlegroups.com.