# The name of a node is not resolved after it was resolved ?

**URL:** <https://forum.ansible.com/t/the-name-of-a-node-is-not-resolved-after-it-was-resolved/36396>\
**Category:** Ansible Project\
**Created:** [March 3, 2022, 10:46am UTC](https://forum.ansible.com/t/the-name-of-a-node-is-not-resolved-after-it-was-resolved/36396 "2022-03-03T10:46:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arc\_Tangente](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@Arc\_Tangente](https://forum.ansible.com/u/Arc_Tangente)\
**Post date:** [March 3, 2022, 10:46am UTC](https://forum.ansible.com/t/the-name-of-a-node-is-not-resolved-after-it-was-resolved/36396/1 "2022-03-03T10:46:11Z")

</div>

Hello,

I start this playbook install-mediawiki.yml, the first role is executed without problems.

The second role has 4 tasks, executed fully the 2 first of them, but has suddently an issue: the name of the node is not resolved anymore.  
**I do not know why**.

I have installed ansible in a virtual python environment and  
**defines the inventory so** :  
(ansible2.7.10) user-ansible@node-manager:~$ cat inventaire.ini  
[apache]  
http2

[db]  
bdd2

/etc/hosts in each node contains this:  
(ansible2.7.10) user-ansible@node-manager:~$ cat /etc/hosts  
…  
192.168.0.103 http2  
192.168.0.104 bdd2

**The SSH connexion works withe key** , the public keys are in the nodes…

**Here is a ping test:**  
(ansible2.7.10) user-ansible@node-manager:~$ ansible -i inventaire.ini all -m ping  
bdd2 | SUCCESS =\> {  
“changed”: false,  
“ping”: “pong”  
}  
http2 | SUCCESS =\> {  
“changed”: false,  
“ping”: “pong”  
}

**The playbook** :  
(ansible2.7.10) user-ansible@node-manager:~$ cat install-mediawiki.yml

---

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [March 3, 2022, 7:59pm UTC](https://forum.ansible.com/t/the-name-of-a-node-is-not-resolved-after-it-was-resolved/36396/2 "2022-03-03T19:59:12Z")

</div>

> - name: “mediawiki configuration”  
> become: yes  
> become\_user: “apache”  
> args:  
> creates: “{{mediawiki\_directory}}/LocalSettings.php” # =\> /var/www/html/mediawiki/LocalSettings.php  
> chdir: “{{mediawiki\_maintenance\_directory}}” # =\> /var/www/html/mediawiki/maintenance (contient install.php !!)  
> command:  
> php install.php --scriptpath /{{mediawiki\_name}} --dbname mediawiki --lang fr --dbuser {{mediawiki\_db\_user}} --dbpass {{mediawiki\_db\_password}} --pass {{mediawiki\_admin\_password}} --dbserver {{mediawiki\_db\_host}} {{mediawiki\_title}} {{mediawi  
> ki\_admin\_user}}  
> run\_once: yes  
> delegate\_to: “{{item}}”  
> **with\_items: “{{groups.apache}}”**

have you tried loop instead of with\_items? something like:

…  
run\_once: yes  
delegate\_to: “{{item}}”  
**loop:**  
**- “{{groups.apache}}”**

if I am not mistaken with\_items is deprecated?

also the indentation looks a bit suspicious, or is that just the email formatting?

---

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [March 4, 2022, 10:45am UTC](https://forum.ansible.com/t/the-name-of-a-node-is-not-resolved-after-it-was-resolved/36396/3 "2022-03-04T10:45:47Z")

</div>

sorry to hear the loop did not help.  
Generally I believe it is better to reply to the group and not to the correspondent personally (probably not even intended)

---

<div class="post-metadata">

**Author:** ![Arc\_Tangente](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@Arc\_Tangente](https://forum.ansible.com/u/Arc_Tangente)\
**Post date:** [March 4, 2022, 11:17am UTC](https://forum.ansible.com/t/the-name-of-a-node-is-not-resolved-after-it-was-resolved/36396/4 "2022-03-04T11:17:18Z")

</div>

Hi,  
Thanks for your help.

I changed ‘ **with\_items** ’ for ‘ **loop** ’, as proposed. It does not resolve the issue.  
By the way ‘with\_items’ works well in another task in another role.

**About the indentation** , it is because of the email formating… (sorry)

‘become, become\_user, args, command, run\_once, delegate\_to and with\_items’ **are aligned with** ‘name’ (not with - )  
‘creates and chdir’ **have two more spaces** compared to ‘args’.

---

<div class="post-metadata">

**Author:** ![Pushparaj\_Gothandam](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/pushparaj_gothandam/32/5538_2.png) [@Pushparaj\_Gothandam](https://forum.ansible.com/u/Pushparaj_Gothandam)\
**Post date:** [March 5, 2022, 2:51am UTC](https://forum.ansible.com/t/the-name-of-a-node-is-not-resolved-after-it-was-resolved/36396/5 "2022-03-05T02:51:42Z")

</div>

you can try in separate yaml file

---

<div class="post-metadata">

**Author:** ![Arc\_Tangente](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@Arc\_Tangente](https://forum.ansible.com/u/Arc_Tangente)\
**Post date:** [March 8, 2022, 11:36am UTC](https://forum.ansible.com/t/the-name-of-a-node-is-not-resolved-after-it-was-resolved/36396/6 "2022-03-08T11:36:35Z")

</div>

Hi,  
thanks. I have searched a lot these past days for a solution.

I have installed ansible in another VM, Ubuntu 20.04, as sshpass with apt. I configured everything, so that the first part of network works. I have also this time configured /etc/ansible/hosts, therefor I didn’t use -i inventaire.ini any more in the cli (ad-oc). Before, I didn’t have this file, because I was in a virtual python environment.

The result is positive, it works well. I can now access to mediawiki through a web browser 🙂

I will make a try with your proposal, but a bit later. I am a beginner, follow a tutorial and want learn further…

Have a nice day.
