Questions tagged [ansible-playbook]
468 questions
1
vote
1 answer
How to handle existing/non existing fact in Ansible?
For inventory purpose due to some business limitation, i wrote a playbook that retrieve content of resolv.conf + ntp.conf + timesyncd.conf and then, write the retrieved content within a CSV file.
Globally, maybe it's not the best practice but i set…

motorbass
- 303
- 2
- 12
1
vote
1 answer
Ansible & Jenkins
here is my problem
I run a playbook on jenkins with extra variables, I want to test in my playbook is variables are defined
ansible [core 2.12.1] , jenkins plugin 1.1
here is the command from jenkins :
ansible-playbook create_user.yml -i hosts -e…

Wanexa
- 71
- 1
- 1
- 2
1
vote
1 answer
Accesing debug values in Ansible
My ansible code looks like this,
¦ - name: Copying Archived File
¦ ¦ unarchive:
¦ ¦ ¦ src: "/home/user/{{ item }}"
¦ ¦ ¦ dest: "/home/user/someLocation"
¦ ¦ ¦ list_files: yes
¦ ¦ register: archive_contents
¦ ¦ loop: "{{…

Siham Sharif
- 35
- 4
1
vote
1 answer
Ansible - nginx package removed, but service is running on the server
I'm trying to learn Ansible, but I have strange thing. I have below playbook:
---
- name: "Uninstall apache server"
hosts: all
become: true
tasks:
- name: "Uninstall packages"
apt:
name: nginx
state: absent
-…

PawelC
- 149
- 1
- 11
1
vote
1 answer
Ansible Ad-Hoc command - raw module not working on Cisco IOS devices
trying to use Ad Hoc commands on both my Cisco ios Router and Switch with the -m raw Module. But getting the following error instead.
$ansible -i inventory_file02.ini netgrp -m raw -a "show version" -u abdo -K
Error====
BECOME password:
R1 | FAILED…

abdo_ch
- 11
- 2
1
vote
1 answer
Could not find imported module support code for freeipa.ansible_freeipa.ipaclient_test
My ansible controller is running on a Rocky 8.5 machine with the ansible-freeipa version 0.3.8-1.el8 rpm package installed.
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules',…

dutsnekcirf
- 249
- 2
- 4
- 16
1
vote
1 answer
I am getting an error in the ansible playbook
I am trying to learn ansible and I have coded my first playbook but it gives me the error saying
ERROR! A playbook must be a list of plays, got a instead
The error appears to be in…

baba yaga
- 11
- 1
- 2
1
vote
1 answer
Playbook containing unsafe variable values breaks after upgrading from ansible 2.10 to ansible 2.12 (from ansible 5)
I have upgraded my ansible setup from ansible 2.10 to ansible 2.12 (from ansible 5) using homebrew on Mac OS.
Since then a playbook has stopped producing working results.
- name: Assemble consul cluster
become: true
hosts: consul_nodes
roles:
…

Martin Ahrer
- 279
- 1
- 3
- 12
1
vote
1 answer
How should i write the yaml file for use in ansible variable?
I started to deploying an ansible server, and i was trying to create 5 users in the client hosts, through a playbook (add5userslist.yaml), with a loop that uses variables in a list from another file (userslist.yaml), but isnt working.
And...this is…

SergioDG
- 13
- 4
1
vote
2 answers
Hide my password in Ansible Playbook
I would like to run mysqldump in the Ansible playbook by the shell module. Trying to find a way to hide my MySQL root password in the ansible playbook or Ubuntu.
I currently have a file that was encrypted by ansible-vault to store my mysql root…

ITnewbie
- 171
- 2
- 9
1
vote
1 answer
Ansible conditional with variables and wildcards
Been trying to add a conditional with a wildcard and an Ansible variable and getting an error message. The idea is to trigger the api request with the container name starts with "android-", this is a follow-up to a docker container creation…

Saptronic
- 13
- 1
- 4
1
vote
2 answers
Ansible filter using ad-hoc command
How can I filter the nocache block or free block using ad-hoc command? I tried ansible centos1 -m setup -a 'filter=ansible_memory_mb.nocache' but doesn't filter it out.
ansible centos1 -m setup -a 'filter=ansible_memory_mb'
centos1 | SUCCESS => {
…

user630702
- 495
- 10
- 32
1
vote
2 answers
ansible main.yml if else conditionals
So I'm running an ansible role which has a file main.yml in the defaults/ role folder. The content of that file is this:
---
api_secrets:
'API_PROFILE': "{{ api_profile }}"
'SERVER_ADDRESS': "{{ server_address }}"
'MGMT_SERVER_ADDRESS': "{{…

Bogdan Stoica
- 403
- 4
- 9
1
vote
1 answer
Custom fact does not receive value
This is a playbook part of a role that talks with vmware.
I'm is trying to set a custom fact (target_vm) that receive the virtual machine name.
But when I Print it's value with the debug module it apears to be empty.
I don't know what I'm is doing…

azk
- 39
- 9
1
vote
1 answer
How to get extra vars java link and download it in ansible and extract it
I want to download java from http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
then extract it
tar -xzvf jdk-8u131-linux-x64.tar.gz
but not able to do it
I have the below ansible…

Rajarshi Das
- 113
- 6