# ad-hoc

ad-hoc komutları, bir veya daha fazla manage node üzerinde single komut çalıştıran ve /usr/bin/ansible 'i kullanan bir komut yöneticisidir. Daha pratik, daha az öneme sahip işlemlerde kullanılabilir.&#x20;

syntax;

```
ansible [pattern] -m [module] -a "[module options]"
```

Modülleri, ad-hoc task olarak kullanabiliriz. Bir çok işlemi ad-hoc ile yapabiliriz. Ansible 'da default olarak 5 proccess aynı anda çalışır. Dilersek, -f parametresi ile farklı bir sayıya set edebiliriz.

```
ansible nodes -m shell -a "echo hello world"
      (grup ismi)
      
      
ansible nodes -m ansible.builtin.shell -a 'echo $TERM'

ansible nodes -m command -a  "hostname" --become --become-user onur

ansible nodes -m shell -a "sudo /bin/systemctl restart iptables" -u onur
sudoers dosyasında onur kullanıcısına yetki vermemiz gerekiyor.
```

{% embed url="<https://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html>" %}

{% embed url="<https://www.middlewareinventory.com/blog/ansible-ad-hoc-commands>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://note.onurbolatoglu.com/ansible/ad-hoc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
