# List of hosts by MacAdress + Connexion if computer is in standby

**URL:** <https://forum.ansible.com/t/list-of-hosts-by-macadress-connexion-if-computer-is-in-standby/32247>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [February 17, 2020, 9:46am UTC](https://forum.ansible.com/t/list-of-hosts-by-macadress-connexion-if-computer-is-in-standby/32247 "2020-02-17T09:46:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Test\_Deux](https://avatars.discourse-cdn.com/v4/letter/t/dc4da7/32.png) [@Test\_Deux](https://forum.ansible.com/u/Test_Deux)\
**Post date:** [February 17, 2020, 9:46am UTC](https://forum.ansible.com/t/list-of-hosts-by-macadress-connexion-if-computer-is-in-standby/32247/1 "2020-02-17T09:46:49Z")

</div>

Hello,

I am considering using Ansible to achieve a certain goal, but as I get more informed, I feel that Ansible may not be the right tool. Unless, perhaps, I missed some information?

**Result sought:**

Use Ansible to quickly install softwares on Ubuntu 18.4 computers in a computer room (school).

**Questions:**

- Create a list of hosts uses IP addresses. But these addresses are not fixed, so can’t I create the list of hosts by naming them with their MacAdress?

- Ansible seems to be designed for connection to servers, machines that are constantly on. But the classrooms computers are often in standby, when they are not used. I have tried some direct SSH connection and it seems that this cannot be done if the target computer is in standby. Is Ansible also facing this obstacle?

Thank you in advance for your help 🙂

Seb

---

<div class="post-metadata">

**Author:** ![Gunter\_Zochbauer](https://avatars.discourse-cdn.com/v4/letter/g/bcef8e/32.png) [@Gunter\_Zochbauer](https://forum.ansible.com/u/Gunter_Zochbauer)\
**Post date:** [February 17, 2020, 12:02pm UTC](https://forum.ansible.com/t/list-of-hosts-by-macadress-connexion-if-computer-is-in-standby/32247/2 "2020-02-17T12:02:17Z")

</div>

> Hello,
> 
> I am considering using Ansible to achieve a certain goal, but as I get more informed, I feel that Ansible may not be the right tool. Unless, perhaps, I missed some information?
> 
> **Result sought:**
> 
> Use Ansible to quickly install softwares on Ubuntu 18.4 computers in a computer room (school).

[https://docs.ansible.com/ansible/latest/modules/apt\_module.html](https://docs.ansible.com/ansible/latest/modules/apt_module.html)

> **Questions:**
> 
> - Create a list of hosts uses IP addresses. But these addresses are not fixed, so can’t I create the list of hosts by naming them with their MacAdress?

I’m an Ansible beginner myself and there might be a better way but an idea is to address all machines and then use  
conditionals to assign tasks to MAC addresses  
[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_conditionals.html](https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html)

[https://stackoverflow.com/questions/40224460/getting-mac-address-from-ansible-facts-in-role](https://stackoverflow.com/questions/40224460/getting-mac-address-from-ansible-facts-in-role)

> - Ansible seems to be designed for connection to servers, machines that are constantly on. But the classrooms computers are often in standby, when they are not used. I have tried some direct SSH connection and it seems that this cannot be done if the target computer is in standby. Is Ansible also facing this obstacle?

There are ways to run Ansible in a pull way like [https://docs.ansible.com/ansible/latest/cli/ansible-pull.html](https://docs.ansible.com/ansible/latest/cli/ansible-pull.html)  
(there might be others)

You can use Wake-on-LAN to wake the machines up to be able to manage them  
[https://docs.ansible.com/ansible/latest/modules/wakeonlan\_module.html](https://docs.ansible.com/ansible/latest/modules/wakeonlan_module.html)  
(and shut them down again when done)

---

<div class="post-metadata">

**Author:** ![Stu](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@Stu](https://forum.ansible.com/u/Stu)\
**Post date:** [February 17, 2020, 12:30pm UTC](https://forum.ansible.com/t/list-of-hosts-by-macadress-connexion-if-computer-is-in-standby/32247/3 "2020-02-17T12:30:12Z")

</div>

I’d look into something like ddns getting your dhcp server to update dns for you

Then you can use the machine hostname?

Wake on LAN

Etc

---

<div class="post-metadata">

**Author:** ![Test\_Deux](https://avatars.discourse-cdn.com/v4/letter/t/dc4da7/32.png) [@Test\_Deux](https://forum.ansible.com/u/Test_Deux)\
**Post date:** [February 18, 2020, 12:05pm UTC](https://forum.ansible.com/t/list-of-hosts-by-macadress-connexion-if-computer-is-in-standby/32247/4 "2020-02-18T12:05:35Z")

</div>

Ok, thanx guys 🙂
