Questions tagged [ansible]

Ansible is an automation tool ("IT orchestration engine", per the company web site) for the deployment and configuration of applications and systems.

Filter by
Sorted by
Tagged with
0
votes
2answers
787 views

Ansible jinja2 filter reject

I need to reject "*" from stdout lines. "stdout_lines": [ "rchinnn01", "rchinnn02", "*" ] - set_fact: nfs_clients: "{{ nfs_clients_out.stdout_lines | reject(...
0
votes
0answers
31 views

rho command is failing with invalid auth error

I am trying to use rho command for my localhost on rhel7.6. System is subscribed to redhat under developer subscription. Here are details [root@redhat7-1 ~]# rho profile list Please enter your rho ...
0
votes
2answers
25 views

Ansible user ssh sudo PermitRootLogin disabled

i got this working without a problem when the remote serveur doesn't have the ssh parameter : PermitRootLogin yes My working ansible command: [ansible@myansible ~]$ ansible remoteserveur -a "cat /...
0
votes
1answer
23 views

First connection to Ansible : permission denied

I have a VM and one vps which both run on Centos 7. I created an ansible inventory file which contains : vps_ip ansible_user=root I got an error : Authentification or permission failure. I don't ...
0
votes
0answers
16 views

overriding lightdm.service from ansible

I am having an issue with my GUI. I have setup a provisioned vpn via ansible that needs to be up before the graphical interface is up (lightdm on ubuntu lts 16.04). So I read you shouldn't edit the ...
0
votes
1answer
26 views

Ansible: Prompting variables for roles

I have a simple ansible Playbook called setup.yml which looks basically like this (simplified): - hosts: my-server-to-setup remote_user: [REDACTED] become: yes #vars_prompt: # - name: "...
1
vote
2answers
961 views

How to set ansible playbook to reboot servers

I want to be able to write one playbook to update all my servers in different environments - stage and prod. I do not want to reboot these servers every time there is an update to the kernel, I only ...
-2
votes
0answers
24 views

Can not compile ansible from git

I have problem while installing ansible. I clonned ansible from git and did cd ansible/ then make install Output is Traceback (most recent call last): File "packaging/release/...
0
votes
1answer
919 views

ansible variable as environment variable

I try this - name: Install required packages shell: "apt-get instal linux-headers-{{ ansible_kernel }}" However getting this instead {"msg": "The task includes an option with an undefined ...
1
vote
1answer
6k views

Ansible, attempting to get specific regex pattern to work with lineinfile module

As per my question above: "Ansible, attempting to get specific regex pattern to work with lineinfile module" Essentially, I'm trying to get it to work in a single play as opposed to 2 separate plays, ...
5
votes
1answer
6k views

Terminate and disable/remove unattended upgrade before command returns

I'm having an issue here where I try to automate a setup with Ansible. Some of the steps require interaction with apt, but occasionally I get an error because unattended-upgrade kicked off and locked ...
2
votes
2answers
66 views

Spacewalk reboot the server after patch installed

I am using Spacewalk release 2.9 to manage my CentOS Linux server. using below spacecmd command to push the new packages. I want to reboot the server once all the packages are installed on the machine....
1
vote
3answers
7k views

ansible pass shell command result to variable

I stuck a bit with ansible and autogenerated id, I have multiple mysql master - slaves server for that I need to generate a server-id. my idea was to do something like this: - name: generate ...
0
votes
1answer
32 views

Does Ansible have the ability to suspend a Linux system?

I'm having trouble locating any modules besides rebooting and shutdown for Linux. I'm wondering if anyone has done this?
0
votes
2answers
102 views

Ansible docker_container module - How to pass variables in environment section?

In the below task: - name: Create a data container docker_container: name: mydeploycontainer image: 1111112222.dkr.ecr.us-east-1.amazonaws.com/someteam/app-deploy:v.1 env: name1: {...
0
votes
1answer
21 views

ENTRYPOINT relative path - Ansible

We are able to run the docker container locally with docker file having relative path in ENTRYPOINT: USER user1 WORKDIR /home/user1 ADD script.sh $HOME/script.sh ENTRYPOINT ["./script.sh"] When ...
0
votes
1answer
43 views

Ansible - How to remove a docker container after start?

Below is the shell command we use to launch a docker container: #!/bin/bash docker container run --rm -it \ -e name1=value1 -e name2=value2 -e name3=value3 \ 1111112222.dkr.ecr.us-...
1
vote
0answers
25 views

(Ubuntu 16.04 Server) systemd update lightdm.service from ansible

I am making an ansible script to add an extra service (VPN/Strongswan) to be loaded to lightdm.service before booting to graphical.target / graphical GUI. I am adding "strongswan.service" to the end ...
-1
votes
1answer
59 views

Ansible - How to select Element in output

Im newbie when it comes to ansible started just a week ago. I was playing around with playbooks and ad-hoc command i run ad-hoc command ansible ansiblenodes -m setup -a "filter=ansible_mounts" 192....
0
votes
0answers
14 views

Getting Ansible ARA working

Please excuse me but could someone point out in simple steps how I should get Ansible ARA installed on a CentOS 7 Virtual Machine ? (or even debian) I have followed https://ara.readthedocs.io/en/...
8
votes
2answers
1k views

Whenever ansible makes changes to sshd in CentOS7 a random future play cannot connect

This has been an irritating enough problem now that I thought I would finally ask the community at large what a possible solution might be. It's even more irritating that I seem to be the only one ...
0
votes
0answers
12 views

yum installing mysql-server 5.5 instead of 5.7 on Amazon Linux

My understanding of yum is that it should default to installing the latest version of a package available in all the repos enabled. The default repos installed in Amazon Linux 1's AMI include the ...
2
votes
1answer
89 views

Transfer RPMs file with Ansible and localinstall them

I am having the following yaml ansible-playbook and want to transfer the rpms and then localinstall them on the remote machine. Until the transfer file step its working fine however on the ...
2
votes
1answer
45 views

Is it possible to define run_once strategy on Ansible?

I would like to run a task only on one host with Ansible. To do that, I use the parameter run_once. But what would really rock is to be able to specify a strategy to select that one host to run that ...
0
votes
1answer
226 views

Ansible replace first occurance on file

I am using Ansibles replace module, I want to replace only the first occurrence in the file. I have example string: example.string.in.my.text=test.@@sometext@@ I wish: example.string.in.my.text=...
1
vote
1answer
74 views

Ansible get a list of certification files and check their expiration date

I am trying to figure out how to get a list of .crt files from one of our web servers and check the expiration date of these certification files (actually check if these certs are valid within a time ...
11
votes
2answers
27k views

How would I register a dynamically named variable in an Ansible task?

I'm trying to retrieve the group ID of two groups (syslog and utmp) by name using an Ansible task. For testing purposes I have created a playbook to retrieve the information from the Ansible host ...
0
votes
0answers
27 views

How to save svn credentials via Ansible

I have an ansible role which will setup a Subversion server, create users with the htpasswd utility. The login of users manually work fine. However I have some scripts that will run later on via ...
0
votes
1answer
56 views

Execute command using Ansible

I want to use the dpkg -l | grep -i staff command using ansible, but it gives me an error: ansible all -m 'dpkj -l | grep -i stuff' ERROR! this task 'dpkj' has extra params, which is only allowed ...
1
vote
1answer
434 views

Ansible: difference between “shell” and “command” modules

Ansible wiki says: The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like $HOME and operations like <, >, |, ; and & will ...
0
votes
3answers
7k views

Ansible array variable

I have a template file config.j2. {% for host in groups['dbs'] %} ips= {{ hostvars[host].ansible_default_ipv4.address }} {% endfor %} My output is: ips= 192.168.231.91 ips= 192.168.231.92 ...
0
votes
2answers
2k views

How do i store a variable value to a file in new lines on ansible

I would like to store the variable value to a file in new lines format. - set_fact: linked_dirs: "{{ linked_dirs.stdout_lines | select('search',nfs_server) | list }}" - debug: var=linked_dirs ...
1
vote
1answer
29 views

ansible template module permission error

Snippet of my yaml code: - name: 11|Copy sw-installer.jinja2 response file for unattended installation template: src: "{{ CNTRL_SERVER_RSP_FILE_DIR_LOCATION_FOR_INSTALL }}/sw-installer....
1
vote
2answers
44 views

Deploy different roles on different servers using one playbook

F.e. I created two roles via "ansible-galaxy init": deploy_back and deploy_front Also I wrote a playbook.yml file. - name: Create cluster become: yes hosts: all roles: - deploy_front - ...
0
votes
1answer
50 views

Ansible User module removes sudo configuration. Why?

An Amazon Linux 2 machine is configured with a user that can sudo without password as follows: # Add user sudo groupadd -g 2002 one-username sudo useradd -u 2002 -g 2002 -c "One Username Account" -...
0
votes
1answer
26 views

Accessing variable value from inside ansible playbook

I have used the following variable in ansible playbook as shown below. --- - hosts: hosts vars: vers: 18.7 I am trying to access the value of vers using $ under tasks as shown below ...
1
vote
1answer
41 views

Linux Mint Infrastructure Management [closed]

I want to deploy Linux Mint on ~40 PCs. If I do that, I will need a centralized way to control those PCs. For Example, install/remove software on all those PCs on the same time, set environment ...
0
votes
1answer
2k views

How to pass prompt in ansible?

I am trying to pass a prompt y in ansible when it executes the below command. When i do manually on server it asks for a prompt. How should i do it with ansible using shell module.Please help with ...
16
votes
2answers
80k views

Ansible use inventory_hostname or ansible_hostname in task name

I am writing a rolling upgrade playbook and would like to print out the hostname of current host been upgraded. I put inventory_hostname and ansible_hostname in task names but that did not work - ...
1
vote
0answers
40 views

PXE boot a computer using Ironic Bifrost

I am using Openstack Ironic standalone using Bifrost. I followed this link link https://docs.openstack.org/bifrost/latest/install/index.html#introduction to install Bifrost on CentOS system in ...
-1
votes
1answer
24 views

Defining Ansible inventory on remote server

What specific changes need to be made to the code below so that the Ansible Playbook will know how to pull testFile.txt from ServerB into ServerA? These are both Amazon Linux servers. Note that ...
2
votes
1answer
1k views

yum lockfile is held by another user

Amazon Linux 2 instances are operated upon by an Ansible Playbook which performs multiple yum tasks one after the other. What specific changes need to be made to the syntax below in order for the ...
0
votes
1answer
150 views

Ansible mysql_* modules show error at first launch

This is my yml file which should update system, install mysql-server, change binding and run steps from "mysql_secure_installation". --- # tasks file for deploy_db - name: Update repos apt: ...
0
votes
1answer
303 views

Ansible configuration file

I have my ansible.cfg file in /etc/ansible/ as well as /apps/ansible/. We have made all the required setup in /apps/ansible/. Now, I have created new user and have all the ssh keys setup for the ...
0
votes
3answers
2k views

Run shell command from Ansible

I have a shell script which just changes directory (here directory path is given). shell file #!/bin/bash p="dir/file/create" cd "$p" exec bash Ansible playbook --- - hosts: localhost ...
2
votes
0answers
75 views

Ansible firewalld - guaranteed final state?

The ansible firewalld module is great for adding rules, but old rules are left in place. How can I achieve a guaranteed final state using the firewalld module? Specifically, I would like a role that ...
1
vote
1answer
2k views

How can I pass a positional parameter a bash script requires to it in ansible?

I have a bash script I am running in ansible with the script module. However, it needs a specific positional parameter to be specified as a server-name to function in this case as $1. I am ...
0
votes
1answer
151 views

fetch dependencies while install deb with ansible

i'm trying to install mysql 8.0.15-1debian9 on a debian 9 server the problem is that mysql only provides the latest version of mysql in their apt repository which is 8.0.16-1debian9 however 8.0.16-...
2
votes
2answers
169 views

Encrypt a file on remote host

How to encrypt a file on the remote host using Ad-Hoc command 'ansible-vault'. for example, a myfile.txt on a remote machine needs to be encrypted from the host machine
0
votes
2answers
895 views

how to use included variable from file with jinja2 template and with_items

I am having an error where the fields of my variable are not being detected when trying to build a configuration using a jinja2 template. This is to sync Linux repositories to yum and apt based ...