Questions tagged [ansible]

Ansible is an IT automation tool. Use this tag for questions regarding the Ansible IT automation tools.

263 questions
31
votes
3 answers

Ansible playbook to determine OS release

I'm simply trying to check the version of ubuntu on all my servers. Based on this question I see that ansible has a ansible_distribution_version but this playbook does not show how I would simply just have it print out the ubuntu version, ie ubuntu…
nadermx
  • 745
  • 1
  • 13
  • 36
26
votes
3 answers

How to set a default ssh user for all hosts in Ansible?

Ansible version 2.1 I have an inventory file hosts [nodes] host1 host2 ... And a simple playbook site.yml --- - hosts: all tasks: - include: tasks/main.yml If I just start the play, ansible-playbook -i hosts site.yml -vvvv I get this error…
Howard Lee
  • 1,006
23
votes
2 answers

What is the significance of an Ansible task reporting that something has changed?

I have a task that checks if my process is listening on port 8080 and only when the exit code is not zero, would I run fail with a message. When the service is running, it reports that the status has changed. I want it to say ok. What does a changed…
14
votes
2 answers

Ansible task to confirm if a process is running

Ansible 2.1 In the playbook, I started a process: - name: Start Automation Agent, and enable start on boot service: name=mongodb-mms-automation-agent state=started enabled=yes From play recap, it appears the process has successfully started. TASK…
Howard Lee
  • 1,006
9
votes
4 answers

Ansible command-task runs into "Exec format error"

I wrote this ansible task to run a process on a remote vagrant box. (Well, actually the ansible file itself is much longer, but this is a reproducer that only runs the start script.) --- - hosts: myappname_server vars_files: -…
SadBunny
  • 1,416
9
votes
5 answers

ansible: silently skip unreachable hosts

We use ansible to configure some hosts, including IP configuration. We do not want to use a DHCP server. Sometimes we add new hosts to the network. Those new hosts are in one ip address range and the existing production hosts are in another. We just…
icehawk
  • 235
6
votes
0 answers

Writing toml sections with ansible

I have an Ansible setup for "Gitlab Runners". These use toml as configuration format [[runners]] name = "gitlab-runner-1" url = "https://example.com" token = "x" executor = "docker" [runners.custom_build_dir] [runners.cache] …
madflow
  • 290
6
votes
1 answer

ansible: execute local_action only once while running playbook against a group of hosts (multiple managed hosts)

Is it possible in ansible to make local_action task being run ONLY once while running playbook against a group of hosts? Here is the problem: hosts: - macbooks - localhost tasks: #......# - local_action: command …
drew1kun
  • 2,137
  • 8
  • 42
  • 59
6
votes
1 answer

Ansible reports "permission denied" when issuing command on remote host

Ansible 2.1 Ansible host: Ubuntu 16.04 Remote host: CentOS 6.5 I'm quite new to Ansible. I have a simple ansible project: ├── hosts ├── roles │   └── setup │   ├── defaults │   │   └── main.yml │   ├── tasks │   │   └── main.yml │   …
Howard Lee
  • 1,006
5
votes
3 answers

Can't make Ansible to wait for a server to reboot and continue playbook to work

I am creating a playbook to install a software and I need to restart the server int he middle of the playbook. I need my Ansible host to wait till the server is back and execute the rest of my tasks but this is not happenning. These are my Ansible…
masber
  • 173
4
votes
1 answer

How to remove items from an ansible list?

In my Ansible playbook, I need to change permissions on a lot of files, but a few subdirectories need read-write permissions, while most need read-only. Following another suggestion from superuser, I have this solution: - name: A few directories…
Kevin Keane
  • 960
  • 3
  • 9
  • 19
4
votes
1 answer

Run ansible playbook on specified host and group?

Let's suppose that we have host group dev with corresponding group vars. [dev] host1 host2 How to run ansible playbook with a host3 that is not in group dev using CLI?
3
votes
2 answers

Ansible - ignore whitespace differences in lineinfile

I am starting to look into using ansible for maintaining a set of servers. I have ran into a difficulty with lineinfile. I am setting up rsyslog and want to make sure a few lines are in the /etc/rsyslog.conf: - name: set up rsyslog …
3
votes
1 answer

Ansible installation on Windows 10 giving following error

Please someone suggest me how to install Ansible on Windows 10 and I've tried to do the same from GIT Bash that didn't help. Error Log: copying lib\ansible\galaxy\data\network\tests\inventory -> build\lib\ansible\galaxy\data\network\tests …
info2m
  • 31
2
votes
3 answers

Ansible : Configuring a Windows Host

I'm trying to set a windows Host through a VM using mac M1 but I'm having the following issue : UNREACHABLE! => {"changed": false, "msg": "Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have…
Hugues
  • 23
1
2 3 4