Questions tagged [ansible-playbook]
468 questions
0
votes
1 answer
Return Values from Ansible Role Tasks in a loop are only registered for the last item
I have a role ovirt_vm_add_disk_role that creates a new disk for a VM with ovirt_disk module.
In that role I register the variable disk_info which contains the results of the ovirt_disk module:
- name: "Update disk information"
ovirt_disk:
…

TZar
- 46
- 2
0
votes
0 answers
why ansible_facts['distribution']=="Suse" skipping apache install on Suse
I created the simple ansible playbook to install apache on CentOS and Suse. It works on CentOS but skipping on Suse without any errors, I do not understand why.
This is the playbook:
name: To install Apache on CentOS and Suse
hosts:…

emp0001
- 1
0
votes
0 answers
How can I make Ansible Playbook to Continue after IP Change?
I have a playbook which configures Static IP Address and reboots the Server. However, the playbook is resulting in an error. Even the following code also doesn't seems working
- name: Creating Interface Configuration using JINJA2 Temlate
…

UME
- 111
- 2
0
votes
1 answer
How to replace shell module with command module in Ansible?
I need one small help.
In below example I need to replace shell with command module. But I am confused as command is not working with pipe.
So please give me the solution of this task. E.g:
- name: Get the version
become: true
run_once: true
…
0
votes
2 answers
Ansible 'command' task missing 'stdout' for 'nginx' config verification
After deploy new configuration of Nginx, I would like to verify configuration before Nginx handler for reload is applied. This is output of command line:
nginx -t && echo $?
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx:…

dorinand
- 319
- 2
- 5
0
votes
2 answers
Ansible :: Am I not using the `cisco.ios.ios_facts` module?
I'm trying to build a simple POC ansible playbook that logs into a Cisco router and pulls the config. About my environment:
My Ubuntu is Ubuntu 18.04.5 LTS
My Ansible is version ansible 2.10.7 (Python ver 3.6.9)
My Ansible-Playbook is version…

Pete
- 131
- 6
0
votes
0 answers
Store ansible vault password in azure keystore
At my company we use Azure cloud services. For our local department we want to setup a set of Linux servers. These servers are used to form a test setup.
To setup and maintain these servers we chose to use Ansible. To store secrets such as login…

Jan Jaap
- 101
0
votes
0 answers
Ansible getting error when connecting to remote windows host over ssh
I have created a windows 2019 EC2 instance using Ansible. Once ec2 instance is created i have added the instance into hosts and then created a new play for accessing and executing commands on remote windows server.
Getting below error on ansible…
0
votes
2 answers
In ansible, with win_shell (Powershell), how to force the job status into failed
I'm new to Ansible. I created a playbook that uses PowerShell to reset your password of your admin account. The script has a check that only resets the password IF the account is enabled. When the account is disabled, it spits out a write-host…

Snak3d0c
- 101
- 4
0
votes
2 answers
AWX SSH connection not establishing when running playbook
I am trying to run my first playbook. Running AWX on CentOS8,trying to connect to remote device using SSH. On my remote device I have run ssh-genkey on my device and added the .pub key to authorized_keys file. I have also taken the .pub private key…

leonardf2001
- 1
- 1
0
votes
0 answers
Tagging behavior in a playbook with a role which contains an "include_role" task
Having this structure:
Playbook(play2.yml)
- hosts: localhost
roles:
- name: genrole
tags:
- genrole_tag # tagging is needed, since other roles may be present just below current one
Major…
0
votes
0 answers
Failing to create Digital Ocean Droplet with firewall
I am trying to create a firewall and then create a DO Droplet with that firewall added to it. Here's my playbook:
- hosts: localhost
vars:
digital_ocean_token: '{{ lookup("env", "DO_API_TOKEN") }}'
ephemeral_ssh_key_pub: '{{ lookup("env",…

trouble_bucket
- 13
- 3
0
votes
2 answers
Running a local script on local host with Ansible
I have a python script which is able to retrieve the IP adress of my remote node, and as a pre-task of my ansible playbook I would like to run this script and set the IP adress. Is there a command in Ansible which would allow me to do this ?

hugo2410
- 1
- 1
0
votes
1 answer
ansible print folder path from register variable
I'm trying to print just the path of a register var that has multiple values, however I can only print a specific value. how can I print multiple values?
---
- name: find directories
find:
paths: "{{ item }}"
recurse: yes
…

rigged
- 1
0
votes
1 answer
Ansible: read csv file line by line and render it to template with loop
I am using a csv file to get data and render it to template and copy to remote servers. I am facing issue that CSV file read twice for same server and this results in loop to copy last line in each server instead of 1st line in first server and…