Questions tagged [ansible]

Red Hat Ansible is a model-driven, configuration management, multi-node deployment/orchestration and remote task execution system. It uses SSH by default, so there is no special software to be installed on the nodes you manage. Ansible is written in Python but can be extended in any language.

Filter by
Sorted by
Tagged with
457votes
24answers
495kviews

How to create a directory using Ansible

How do you create a directory www at /srv on a Debian-based system using an Ansible playbook?
user avatar
283votes
7answers
238kviews

Run command on the Ansible host

Is it possible to run commands on the Ansible host? My scenario is that I want to take a checkout from a git server that is hosted internally (and isn't accessible outside the company firewall). Then ...
user avatar
  • 44.5k
259votes
10answers
389kviews

How can I pass variable to ansible playbook in the command line?

I'm new to ansible and wonder how to do so as the following didn't work ansible-playbook -i '10.0.0.1,' yada-yada.yml --tags 'loaddata' django_fixtures="tile_colors" Where django_fixtures is my ...
user avatar
257votes
13answers
266kviews

Safely limiting Ansible playbooks to a single machine?

I'm using Ansible for some simple user management tasks with a small group of computers. Currently, I have my playbooks set to hosts: all and my hosts file is just a single group with all machines ...
user avatar
  • 18.2k
254votes
26answers
358kviews

Specify sudo password for Ansible

How do I specify a sudo password for Ansible in non-interactive way? I'm running Ansible playbook like this: $ ansible-playbook playbook.yml -i inventory.ini \ --user=username --ask-sudo-pass ...
user avatar
235votes
13answers
362kviews

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

How is it possible to move/rename a file/directory using an Ansible module on a remote system? I don't want to use the command/shell tasks and I don't want to copy the file from the local system to ...
user avatar
222votes
7answers
202kviews

How to run only one task in ansible playbook?

Is there a way to only run one task in ansible playbook? For example, in roles/hadoop_primary/tasks/hadoop_master.yml. I have "start hadoop job tracker services" task. Can I just run that ...
user avatar
  • 7,453
210votes
11answers
185kviews

How to ignore ansible SSH authenticity checking?

Is there a way to ignore the SSH authenticity checking made by Ansible? For example when I've just setup a new server I have to answer yes to this question: GATHERING FACTS ***************************...
user avatar
  • 32.7k
193votes
20answers
98kviews

Ansible fails with /bin/sh: 1: /usr/bin/python: not found

I'm running into an error I've never seen before. Here is the command and the error: $ ansible-playbook create_api.yml PLAY [straw] ****************************************************************** ...
user avatar
  • 1,969
192votes
18answers
432kviews

Ansible: How to delete files and folders inside a directory?

The below code only deletes the first file it gets inside the web dir. I want to remove all the files and folders inside the web directory and retain the web directory. How can I do that? - name: ...
user avatar
  • 2,844
185votes
10answers
203kviews

ansible: lineinfile for several lines?

The same way there is a module lineinfile to add one line in a file, is there a way to add several lines? I do not want to use a template because you have to provide the whole file. I just want to ...
user avatar
  • 8,022
182votes
12answers
305kviews

How to check if a file exists in Ansible?

I have to check whether a file exists in /etc/. If the file exists then I have to skip the task. Here is the code I am using: - name: checking the file exists command: touch file.txt when: $(! -s /...
user avatar
  • 1,837

15 30 50 per page
1
2 3 4 5
1431