Most viewed questions in Ansible

0 votes
1 answer

How to list down all the hosts in Ansible?

Hi@akhtar, You can use the option --list-hosts. It will ...READ MORE

Jul 28, 2020 in Ansible by MD
• 95,440 points
43,585 views
+1 vote
1 answer

"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.

Hi@akhtar, You are getting this error because when ...READ MORE

Aug 1, 2020 in Ansible by MD
• 95,440 points
32,790 views
0 votes
1 answer

How to copy directory and sub dirs's and files from source to remote using ansible playbook

Hey @Nishant, you can use the copy ...READ MORE

Apr 3, 2019 in Ansible by Kalgi
• 52,360 points
29,972 views
0 votes
1 answer

How to add multiple lines in a file using Ansible playbook?

Hi@akhtar, You can update your file using lineinfile ...READ MORE

Sep 16, 2020 in Ansible by MD
• 95,440 points
25,022 views
0 votes
1 answer

How to turn gathering facts task off in Ansible?

Hi@akhtar, You can use gather_facts: no keyword in your playbook. ...READ MORE

Aug 10, 2020 in Ansible by MD
• 95,440 points
23,078 views
0 votes
1 answer

How to see any module details in Ansible from the command line?

Hi@akhtar, Ansible has a very attractive command named ...READ MORE

Aug 11, 2020 in Ansible by MD
• 95,440 points
22,671 views
0 votes
1 answer

Install git using Ansible

Installing git using ansible is pretty simple. ...READ MORE

Mar 15, 2019 in Ansible by Haider
22,648 views
+1 vote
2 answers

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

Hey @Sitara,   I just found it is because ...READ MORE

Jan 22, 2019 in Ansible by Naina
21,580 views
+1 vote
2 answers

What is the difference between ansible playbook and roles?

Hi, Roles: Roles containing certain vars_files, tasks, and handlers ...READ MORE

Jan 21, 2020 in Ansible by vivek
• 530 points
21,033 views
+1 vote
3 answers

Error message “Failed to connect to the host via ssh” while running ping command on host machines using Ansible

I hadn't created the ssh connection between ...READ MORE

Apr 23, 2019 in Ansible by Lavanya
19,736 views
0 votes
1 answer

How to move/rename a file using an Ansible task on a remote system?

Hi@akhtar, You can use the command module to ...READ MORE

Sep 17, 2020 in Ansible by MD
• 95,440 points
19,381 views
0 votes
1 answer

ansible playbook: using multiple variables in loops

Use an indexed hostname, and then define ...READ MORE

Jul 16, 2018 in Ansible by DareDev
• 6,890 points
18,251 views
0 votes
1 answer

Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6))

Hi@akhtar, You may get this error if the ...READ MORE

Aug 7, 2020 in Ansible by MD
• 95,440 points
17,477 views
0 votes
1 answer

ERROR! Attempting to decrypt but no vault secrets found

Hi@akhtar, As you are using a vault in ...READ MORE

Aug 11, 2020 in Ansible by MD
• 95,440 points
17,254 views
0 votes
2 answers

Error saying "ImportError: No module named yaml"

actually this related python pckage in order ...READ MORE

Jul 18, 2020 in Ansible by shivanand
16,716 views
0 votes
1 answer

Ansible playbook to wget a file

Hey @Celia, one recommendation, try not using ...READ MORE

Jan 16, 2019 in Ansible by Vaishu
16,668 views
0 votes
1 answer

"msg": "Failed to connect to the host via ssh: root@192.168.0.179: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).",

Hi@akhtar, You need to pass the username and ...READ MORE

Jul 28, 2020 in Ansible by MD
• 95,440 points
15,612 views
0 votes
1 answer

Error saying " mapping values are not allowed in this context" while executing an ansible playbook

Hey, @Nishit seems like you've made a ...READ MORE

Jan 21, 2019 in Ansible by Emily
15,438 views
0 votes
1 answer

How to ignore failed commands in Ansible?

Usually, if even one command fails to ...READ MORE

Feb 7, 2019 in Ansible by Patt
15,392 views
0 votes
1 answer

Change Ansible Vault editor from vi to nano

By default, the editor used by the ...READ MORE

Mar 5, 2019 in Ansible by Yogesh
15,215 views
0 votes
1 answer

Error saying permission denied while running ansible playbook

Hey @Neha, add the following line to ...READ MORE

Feb 8, 2019 in Ansible by Amy
15,120 views
0 votes
1 answer

Is it possible to run an Ansible Playbook in python script?

Hey @Cerci, Of course its possible. You ...READ MORE

Jan 17, 2019 in Ansible by Nicolas
15,058 views
0 votes
1 answer

How to capture the output of a task in Ansible Playbook?

Hi@akhtar, Ansible registers module used to capture/store the ...READ MORE

Aug 2, 2020 in Ansible by MD
• 95,440 points
14,383 views
0 votes
1 answer

No match for argument: ansible Error: Unable to find a match

Hi@akhtar, Ansible is not part of your RedHat ...READ MORE

Jul 28, 2020 in Ansible by MD
• 95,440 points
14,160 views
0 votes
1 answer

Error saying "ImportError: No module named ansible.playbook" when installing Ansible on AWS

Hey Loki, Looks like your python library ...READ MORE

Jan 13, 2019 in Ansible by Patrick
14,130 views
0 votes
1 answer

Error reading config file (/etc/ansible/ansible.cfg): File contains no section headers.

Hi@akhtar, You need to add one tag in ...READ MORE

Jul 28, 2020 in Ansible by MD
• 95,440 points
14,087 views
+1 vote
1 answer

Is it possible to append a large amount of text to a file using Ansible?

Here is concept which you can follow. blockinfile is ...READ MORE

Jul 30, 2018 in Ansible by Atul
• 10,240 points
14,048 views
+1 vote
4 answers

Pass variable to ansible playbook through command line

ansible-playbook test.yml --extra-vars "arg1=${var1} arg2=${var2}" Use is like ...READ MORE

May 7, 2019 in Ansible by Bobin
13,967 views
0 votes
1 answer

"msg": "winrm or requests is not installed: No module named winrm"

Hi@akhtar, You need to install pywinrm module in ...READ MORE

Sep 8, 2020 in Ansible by MD
• 95,440 points
13,652 views
0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

Aug 2, 2020 in Ansible by MD
• 95,440 points
13,287 views
0 votes
1 answer

Ansible error "from ansible import context ImportError: cannot import name context"

I had faced a similar issue. In ...READ MORE

Aug 8, 2019 in Ansible by Pallavi
12,696 views
0 votes
1 answer

Ansible error "urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)"

That means you do not have the ...READ MORE

Oct 15, 2019 in Ansible by Yogesh
12,624 views
0 votes
1 answer

"The task includes an option with an undefined variable. The error was: 'item' is undefined\n\nThe error appears to be in '/root/haproxy/user.yml':

Hi@akhtar, You can perform iterate tasks in Ansible ...READ MORE

Sep 1, 2020 in Ansible by MD
• 95,440 points
12,404 views
0 votes
1 answer

How do I check uptime on hundreds of servers using Ansible?

You need an Ansible box for this, ...READ MORE

Nov 15, 2019 in Ansible by Eric
12,267 views
0 votes
1 answer

How to check the syntax of an Ansible playbook?

Hi@akhtar, Ansible has lots of commands, that help ...READ MORE

Sep 15, 2020 in Ansible by MD
• 95,440 points
12,103 views
0 votes
1 answer

Playbook to install and start nginx on ubuntu

Write your playbook like this: --- - hosts: droplets ...READ MORE

Mar 15, 2019 in Ansible by Deep
11,550 views
0 votes
1 answer
0 votes
1 answer

How to change vault password in Ansible?

Hi@akhtar, You can use rekey keyword in your ...READ MORE

Aug 11, 2020 in Ansible by MD
• 95,440 points
11,113 views
0 votes
1 answer

Ansible task to know if a path exists and if its a directory

Hi @Nisha, use the stat module provided ...READ MORE

Apr 2, 2019 in Ansible by Alok
10,952 views
0 votes
1 answer

How do I configure a jump host to access servers that I have no direct access to?

You can set a ProxyCommand in the ansible_ssh_common_args inventory variable. Any ...READ MORE

Jan 31, 2019 in Ansible by Mahir
10,761 views
0 votes
1 answer

FAILED! => { "msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"

Hi@akhtar, Ansible needs extra software to run commands ...READ MORE

Jul 28, 2020 in Ansible by MD
• 95,440 points
10,718 views
0 votes
1 answer

ERROR: Ansible playbook execution failed - Ansible Jenkins

Hey @Asha, Try to run it as user ...READ MORE

Apr 4, 2019 in Ansible by Aman
10,463 views
0 votes
1 answer

How to compare two files using Ansible?

Hi@akhtar, You can use the copy module in ...READ MORE

Sep 17, 2020 in Ansible by MD
• 95,440 points
10,437 views
0 votes
2 answers

ansible-command not found

Use some other variable instead of PATH. READ MORE

Apr 23, 2019 in Ansible by Vismaya
10,379 views
0 votes
1 answer

bash: ansible: command not found. Failed to search for file: Cannot update read-only repo

Hi@akhtar, By default, Ansible is not part of ...READ MORE

Jul 28, 2020 in Ansible by MD
• 95,440 points
10,357 views
0 votes
1 answer

How to copy multiple files to remote system using Ansible Playbook?

Hi@akhtar, You can use the copy module in ...READ MORE

Sep 16, 2020 in Ansible by MD
• 95,440 points
10,308 views
0 votes
1 answer

Error saying "Failed to find required executable gpg in paths"

Hey @Nisha, according to your error, your ...READ MORE

Mar 13, 2019 in Ansible by Yesha
10,233 views
0 votes
1 answer

How to skip execution of a task in ansible playbook ??

Define tags...  Then while running playbook use --skip-tags. READ MORE

Sep 30, 2020 in Ansible by Adil
10,166 views