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.

46 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
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 ...
4
votes
0answers
956 views

Ansible play for creating user not setting password

Try to set a password randomly and create user with it: vars: users: - username: myuser password: "{{ 99999999999999 | random | to_uuid }}" role: - name : Add user accounts user: name: ...
3
votes
0answers
706 views

using ansible via vpn

I have a set of hosts that I can only access via openVPN (one VPN per host or group of hosts). ssh is only available after connected to the VPN. Is there any way to automatically bring up the VPN ...
3
votes
0answers
2k views

start-stop-daemon, services, environment variables, and ansible

So, I have a Java program that runs Ansible. I'd like to run this program as a service. I've written a service script in /etc/init.d that uses start-stop-daemon to run/stop the Java program. I've run ...
2
votes
0answers
41 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 ...
2
votes
1answer
493 views

ansible | remove link | advanced

I want to achieve the following - in a directory 'sites-enabled' to have only the symlinks present that are defined in a list {{ sites_enabled }} Specifically the difficulty is with - how can I make ...
2
votes
1answer
267 views

Replace deployment scripts with ansible-pull

To deploy new servers I use a master script (in bash) which downloads from a repository another script. That script then configures the servers and the services I want. The master script is always the ...
1
vote
0answers
30 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
vote
1answer
236 views

If condition in ansible jinja2 template

Search keyword in "host_fqdn" variable. If the value has "lab.com" keyword in it, it should directly store the value to "host_fqdn" again or else it should add "lab.com" keyword to the value and store ...
1
vote
0answers
123 views

not run expect script in ansible

my script is : #!/usr/bin/expect set timeout 1 spawn /etc/init.d/oracleasm configure expect "Default user to own the driver interface []:\r" send -- "grid\r" expect "Default group to own the ...
1
vote
0answers
89 views

Ansible: failed to ping a linux container

Continuig with my ansible learning, I already fixed how to Ansible: How to parse an inventory source but now I ran into a new problem. He executes the following 2 commands (but im not sure if he does ...
1
vote
0answers
29 views

Issue in finding modules to change directory service type of ESXI host to Active Directory using ansible

I am facing issue in finding modules to join ESXI host to Active Directory. I have comes across few modules like win_domain_membership like below. But it is not working out for ESXi host. Please help ...
1
vote
0answers
3k views

How to save ansible stdout.lines to a file is in list format

Need to save std.out lines to a file in delegated host using below playbook. I am able to save the data, but the saved data is in json format. I need this data as list format as like command output. -...
1
vote
0answers
181 views

Can't access gems after installing ruby and gems with ansible

I'm working on an Ansible script to install my standard working environment (Ruby on Rails). Ansible runs under sudo, and the gems that have been installed are only accessable under sudo too. If I ...
1
vote
1answer
390 views

Automation of Oracle XE installation with ansible and vagrant - Oracle environment variables not correctly visible?

I am currently trying to automate Oracle Database XE using ansible playbook. Everything with the installation seems to be fine, except for the step in which environment variables for Oracle are set: ...
1
vote
0answers
102 views

Detect if password is expired from ssh

How to catch expired (own) password from ssh, from non-root account ? Expect is not installed on target servers. I need to catch two states with single command: password is expired → when you login, ...
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, ...
1
vote
0answers
1k views

Ansible, trying to find a way to force a task time out on a host it's currently operating on

Concerning Ansible, this should be fairly straightforwards I hope: Scenario: I have 3 servers, red, green, and blue. I have a task created for ansible to use yum in linux to install a random ...
1
vote
3answers
6k 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 ...
1
vote
1answer
116 views

Ansible variables scope clash

I've got an ansible setup that looks like this inventories/ sandbox1 group_vars/ all sandbox1 pb/ pb1/ run_pb1.yml I've got roles and other stuff too, but I think ...
1
vote
1answer
709 views

Error while installing edx on debian squeeze

I am installing edx platform on debian squeeze with anisible at the middle of the process of installation I get this error : TASK: [supervisor | create a symlink for supervisor cfg] ******************...
0
votes
1answer
31 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=...
0
votes
0answers
14 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
0answers
188 views

ansible unarchive module not working as intented!

i am using ansible unarchive module,, cassandraDir = /opt/con/cassandra cassandra package = /tmp/apache-cassandra-3.7-bin.tar.gz I need to unzip the cassandra package in the "cassandraDir" ...
0
votes
1answer
201 views

Ansible modules copy/template errors for Linux 5 hosts using python26 ,python binding libselinux-python needed

We have some 50 odd linux 5 hosts, and to manage that we use ansible. Problem :- Ansible modules copy/template errors for Linux 5 hosts using python26 ,python binding libselinux-python needed ...
0
votes
2answers
429 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 ...
0
votes
0answers
275 views

How can I prompt users while running a playbook?

My needs: Write a playbook which can install apache if the user wants to, while the playbook is running by typing yes or no. apache_prompt.yml hosts: slaves vars_prompt: - name: ...
0
votes
1answer
129 views

How to change the user after connecting to the jump host when using ProxyCommand

My normal flow is like: ssh jumphost sudo -iHu jump_user ssh target_user@targethost Do some task How to do this using ProxyCommand? I have tried: ssh target_user@target_host -o ProxyCommand="ssh ...
0
votes
2answers
444 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
89 views

How can I import an OVA into RHEV oVirt with Ansible

I am using both Ansible and RHEV and notice there does not seem to be a way to import an OVA into a RHEV oVirt environment using the Ansible oVirt VM module. I have a prebuilt VM I exported as an OVA ...
0
votes
0answers
63 views

Is there an Ansible command to check all essential logs of a web server environment?

I use Debian stable and Apache 2.4. In the past I wrote a script with 3 different commands to read all logs of my webserver. Like: #!/bin/bash nginx -t && echo;echo;echo tail /var/log/...
0
votes
1answer
303 views

Which modules are available in ansible ad-hoc commands?

I am working on Ansible. I see that we create roles and then under "tasks" folder we create main.yml. In this file, we specify which commands should be performed for this specific role. While writing ...
0
votes
2answers
1k 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 ...
0
votes
2answers
302 views

need to list the item from facts output

I need to save the target host's IP addresses to a file using set_fact. Below is my playbook, but it's giving output as a list. hosts: all tasks: - set_fact: data: "{{ ...
0
votes
1answer
1k 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 ...
0
votes
1answer
762 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 ...
0
votes
0answers
248 views

ansible deprecated problem

I have ansible 2.4.2.x running and an inventory file which has "ansible_ssh_host etc." params.Normally ansible_ssh_host must be ansible_host as it is deprecated. deprecated . when I play with ...
0
votes
1answer
588 views

Ansible: core modules are missing

I willing to get a list of variables for the host using ansible all -m system and keep getting an error: The module system was not found in configured module paths. Additionally, core modules are ...
0
votes
1answer
594 views

How to make playbook idempotent with raw module?

I have servers without python2 installed by default (the target servers are mainly under Alpine Linux) and i use the playbook below to fix that. - hosts: all become: yes remote_user: root ...
0
votes
0answers
590 views

argument not work on expect through command line

Here I have creating script which execute the ansible-playbook, After the execute script which ask the Sudo password which one I have to send(sudo password) though expect and send but getting below ...
0
votes
1answer
438 views

SSH startup script fails with -t option

I'm wondering about the SSH -t option. When I try to start a Tomcat server like this: ssh user@example.com -t '~/tomcat/bin/startup.sh' then Tomcat will not be started, eventhough the startup ...
0
votes
0answers
2k views

Ansible ERROR! 'AnsibleUnicode' object has no attribute 'keys

I am running Ansible for the first time and I get this error: root@raspberrypi:/opt/ansible# ansible-playbook -i /opt/ansible/hosts simple.yml ERROR! 'AnsibleUnicode' object has no attribute 'keys' /...
0
votes
1answer
288 views

Ansible: running from virtualenvwrapper with pip installation

I'm trying to test ansible with a "pip" installation of ansible in a virtualenv of python managed by virtualenvwrapper. However, I am having problems to use the ssh-agent and the SSH keys: (ansible)$ ...
0
votes
1answer
64 views

Echo n-values for 1 key in ansible?

I have an ansible var : site1: - name: myName value1: something1 value2: apple value3: 14 ... valuen: "a submarine" So the point is, that I don't know how many values are ...
-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 ...
-1
votes
1answer
939 views

Ansible Playbook syntax check issue

i have below detail in /etc/ansible/hosts [dev] 10.13.212.32 and i am able ping this hosts as below: # ansible dev -m ping Output: [root@localhost ~]# ansible dev -m ping 10.13.212.32 | SUCCESS ...