Questions tagged [ansible-playbook]
468 questions
0
votes
2 answers
Using ansible with password authentication and different usernames
We're in the position of maintaining multiple database servers, which have one of two admin accounts, and which use password authentication. Lets say that the two accounts are "db_admin" and "db_user". The passwords are the same for all examples…

Graham Nicholls
- 291
- 2
- 5
- 13
0
votes
1 answer
Iterating Over An Unknown number of custom Ansible Facts
I've written some custom facts which I reference to as values for a module in a task . When I have 1 custom fact I don't have a problem running the task , but the question is , what do I do when I have an unknown number of facts that I want to run…

John Doe
- 495
- 1
- 6
- 12
0
votes
1 answer
issues with Ansible and vars precedence with dependencies
I'm having issues with vars precedence, hope you can help me here.
I'm currently using geerlingguy.ansible-role-postgresql as a dependency of my own postgresql role. Is define as a dependency in meta and I'm using import_role on my main task.
I was…

leave_britney_alone
- 25
- 1
- 5
0
votes
0 answers
In ansible is it possible to use different users inside role task
In ansible is it possible to use different users inside role task
# example: role
# fuse_star
# tasks
# main.yml
- name: start fuse
command: " start fuse"
become: yes
become_user: test1
- name: check fuse…

khyathi
- 1
- 1
0
votes
1 answer
ansible-playbook doesn't work inside a bash script
I am not sure what is going on and hence I enquiring here as well in hopes that some of you might.
I am trying to figure out why the same one-liner will successfully connect on my remote server
ansible-playbook initial.yml -u root -e…

Central
- 1
- 1
- 1
0
votes
1 answer
Ansible : format Filesystem subtask fails
I have below task which fails at formatting EBS volume and just do not proceed further. I've checked all the documentation here but I find no issue with ansible task I defined here.
---
# tasks file for aws-create-ec2
- name: Set instance file…

Shailesh Sutar
- 1,517
- 5
- 23
- 41
0
votes
3 answers
run long shell command on remote servers using ansible
I have a task in which I want to run below command on a shell on remote servers but whenever I run my playbook, it always gives me exception:
- name: copy files
shell: "machines=(machineA machineB machineC); for machine in $(shuf -e…

user1950349
- 223
- 1
- 3
- 10
0
votes
2 answers
template error with conditional check on "failed_when" ansible
I have an ansible task in which I need to verify whether I have all 1987 files and all those files were generated within 1 minute period.
- name: check all 1987 files
find: paths=/proc/files
file_type=file
age=-{{ window…

user5447339
- 141
- 2
- 6
0
votes
1 answer
ansible-playbook to use subdirectory as variable
/var/lib/phoronix-test-suite/test-results/
it has 3 subdirs:
2018-04-22-1850
2018-04-23-1850
2018-04-24-1850
and a tiny file in each:
composite.xml
part of it's content:
pts/ramspeed-1.4.1
RAMspeed…

BiG_NoBoDy
- 138
- 1
- 8
0
votes
1 answer
How to skip a playbook in Ansible
I have two playbooks one is fs.yml and nfs.yml..How can i add these two play books in single playbook and should prompt me which one i need to play. My playbooks pasted below. Tried multiple options but always vars_prompt executing first though tag…

SriramKannan C
- 1
- 1
- 2
0
votes
1 answer
VARIABLE IS NOT DEFINED ! response from API Call in Ansible
The following is my playbook containing a Rest Call
---
-
name: "REST CALL"
hosts: local
tasks:
- name: "REST Call to Get Session ID"
uri:
url:…

Shyam Prasad
- 11
- 1
- 4
0
votes
1 answer
Ansible: don't require password on every run
I am looking for a way to securely handle passwords in ansible. Basically I'd like to avoid typing my password every time root or administrator access is required on a remote machine, but maintain some semblance of security (I know any solution…

ebarrere
- 330
- 1
- 3
- 15
0
votes
1 answer
One to many ansible validation of firewall ports
I have this input.csv
Server, Check-Server, Firewall-Port,
Server1,Server2,80,
,Server2,9999,
,server8,8443,
Server2,,,
server3,Server6,8443,
,Server9,8888,
and I will create a server.yml,
---
Server1:
name: Server2
- 80
-…

Ricky Vene
- 21
- 1
- 1
- 4
0
votes
1 answer
Ansible library strategy?
I'm starting to use ansible for configuration management and wondering how to structure my ansible directory. For instance, web1 is a host which needs configuration edits made to Apache and /etc/ssh/sshd_config. jira1 is a host which doesn't use…

Server Fault
- 3,714
- 12
- 54
- 89
0
votes
0 answers
retry ansible remote task that copies the file if there is any failure?
I have ansible playbook as shown below which copies tar.gz file to remote servers and it works fine mostly..
- name: Play 2
hosts: ALL_HOSTS
serial: "{{ num_serial }}"
tasks:
- name: untar latest process.tar.gz file
unarchive:…

user1950349
- 223
- 1
- 3
- 10