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
0answers
74 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
400 views

How to run Ansible playbooks only if there are no problems in the playbook?

I have learned of the command ansible-playbook example.yml --check which can tell me if something in my playbook is problematic (as far as Ansible can recognize). I think I should combine this ...
1
vote
3answers
384 views

What's the advantage of mere Ansible on mere shell-scripting if one doesn't use communally-maintained Ansible-Galaxy roles? [closed]

I establish a LAMP with a few extras on a remote Debian machine with a similar shell (Bash) script: #/bin/bash apt update -y apt upgrade ufw sshguard unattended-upgrades wget curl git zip unzip tree ...
1
vote
2answers
49 views

Can kernel upgrades be done with configuration management (CM) tools for above-OS software?

I use various Linux Distros, mostly Debian-based, usually all default (I change nothing in the kernel/shell or internal-utilities (utilities that come with the distro). I usually install Apache, MySQL ...
0
votes
1answer
20 views

What are the basic files (dirs and regular file) in Ansible-Galaxy roles? [closed]

I have an Ansible playbook for establishing LAMP environments on remote machines. Part of this playbook deals with installing Composer: - name: Install Composer get_url: url: https://...
2
votes
1answer
179 views

Is it a best practice to use Ansible-Galaxy roles in playbooks instead ansible-modules in playbooks? [closed]

I have an Ansible playbook for establishing LAMP environments on remote machines. Part of this playbook deals with installing Composer: - name: Install Composer get_url: url: https://...
0
votes
1answer
90 views

Changing PHP's post_max_size and upload_max_filesize with Ansible

Is there a way to change the two famous PHP variables post_max_size and upload_max_filesize in php.ini in a version-agnostic way with Ansible? I didn't find any literature covering this and it seems ...
0
votes
1answer
242 views

How to install Composer with Ansible?

In Bash I usually install Composer this way: curl -sS https://getcomposer.org/installer -o composer-setup.php php composer-setup.php --install-dir=/usr/local/bin --filename=composer I tried to read ...
0
votes
1answer
344 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
1answer
166 views

Ansible orchestration for ufw with ufw --force enable

I deploy an Ansible playbook to some debian:stable machines aiming to update package index cache, install ufw and setup it in the Ansible architecture-agnostic and version-agnostic way. - name: ...
0
votes
1answer
1k views

What does cache=yes mean in apt: update_cache=yes in Ansible?

I know that apt update updates existing package-indexes on a supporting distro but not upgrading installed-packages (utilities) that were being installed based on these package-indexes (as apt upgrade ...
2
votes
1answer
1k views

Ansible command returns change instead of success

I'm learning ansible and encountered a situation which is not clear. Running the following module command the result is a 'Changed'. ansible agent.example.com -i inventory -m copy -a 'content="Node ...
1
vote
1answer
479 views

Ansible - Add a word to a specific line in a specific part of that line

I want to add the word "nodev" to the line that contain /home in /etc/fstab file here's the file before UUID=2ea6e2e5-d902-4289-b516-40c175cd481b / ext3 defaults 1 1 ...
1
vote
2answers
202 views

read-verification alternative (two prompts and if-then comparison alternative)

I am trying to create a small script for creating simple, all-default Apache virtual host files (it should be used any time I establish a new web application). This script prompts me for the domain....
1
vote
2answers
178 views

Using Ansible inside Bash

I use Ubuntu 18.04 with Ansible installed this way: apt-get update -y install software-properties-common apt-add-repository ppa:ansible/ansible apt install ansible I also have a small Bash script I ...
1
vote
1answer
545 views

Ansible, docker_container and depends_on

I am using ansible and docker_container module. But when I start my playbook, I have error like: "'depends_on' is not a valid attribute for a Task" This is my playbook: - name: Docker-compose ...
1
vote
2answers
1k views

Ansible Playbook: Get value from variable

I'm writing my first ansible playbook right now. That's what I have so far. --- - hosts: kolumbus become: yes tasks: - name: Copy RPM copy: src: "{{ item }}" dest: /tmp ...
1
vote
0answers
130 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 ...
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 ...
4
votes
1answer
645 views

ansible.cfg become_ask_pass not working

I am using Ansible 2.5.1., and I do not want to use the flag -K all the time (I think it will be deprecated soon). I know there is a directive of become_ask_pass in the ansible.cfg file. I set this ...
0
votes
1answer
766 views

How to specify range to iterate through an array in ansible

I want to remove an application on a remote node using ansible. Below is my playbook. How do i provide a range to the uninstall task to repeat till no packages are left. --- hosts: all tasks:...
0
votes
1answer
54 views

ansible block of code

I need to create an xml formated file in ansible. The file contains <> and spaces. When I run the playbook without the <> or any white spaces between lines in it, the playbook creates the ...
0
votes
2answers
358 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: "{{ ...
-1
votes
1answer
1k views

replace specific line in file with ansible [closed]

I know how to replace strings in the file with the ansible replace module. What I am looking at is replacing a specific line. I have a file that has the same string in several places and I only want ...
0
votes
2answers
2k views

Ansible: return status of the last task

I'm using this command to have a return from tasks in ansible. To see if they are successful or not. This is a example of my code in a playbook: - name: Install JDK8 shell: cd /tmp/install/ &&...
1
vote
3answers
2k views

simulate enter key in Ansible

I am trying to create a playbook to run the mysql_secure_installation command. This command ask several questions. I am using pexpect, but not sure how to simulate an "enter" The first question it ...
0
votes
2answers
373 views

Find in Ansible and Save to a file

I want to save the result of find into the file with an Ansible play. - name: Find / -name "postgresql" find: paths: /var/log patterns: 'postgresql' The result of above will be saved into ...
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 ...
4
votes
1answer
5k 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
69 views

Using a if/else statement in shell for netsat

My goal is to ensure that email connections are limited to outbound only So I have two shell commands one is netstat -an | grep ':25' | grep -v '127.0.0.1' | wc -l which prints out 1 The command ...
-1
votes
1answer
1k 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 ...
1
vote
0answers
98 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 ...
3
votes
2answers
8k views

Ansible: How to parse an inventory source

I'm following an Ansible tutorial I got from Packt, I reached this part where I've created 3 Ubuntu containers (lxc) and got them up and running. I'm also able to login to each of them. I've ...
0
votes
4answers
347 views

Best practice DNS (resolving IP to hostname in LAN)?

Recently I've created my own thin client operating system (Xubuntu based, so basically Linux yes) that will run across our thin clients. Currently I'm testing the OS in my test environment, but I've ...
-1
votes
1answer
268 views

ansible and continue the script with expect tools

My expect script: #!/usr/bin/expect -f set timeout 1 spawn /opt/install.sh expect "\[input\] Are you installing the application at the central data center? \[yes/no default: yes\]? \[yes\]\r" ...
0
votes
1answer
1k views

ansible and expect problem

I want to use expect tools in bash script by ansible. first, step my shell script. Checking for $JAVA_HOME variable. I set $JAVA_HOME but in Ansible, I get an error. My env for $JAVA_HOME: [root@...
2
votes
1answer
6k views

When I use ansible module expect, I get this msg: The pexpect python module is required

Some code from yml file: - name: --- run /opt/installer/bin/install.sh --- expect: command: /opt/installer/bin/install.sh responses: 'Are you installing the application at the ...
0
votes
1answer
336 views

Concatenate two commands with output on sam line Ansible shell command

I have this ansible command that is writing Docker container ip address and hostname to nginx hosts file which is running for more than 1 time. How can I join two commands and get ouput on same line ...
1
vote
1answer
632 views

Ansible copy module failure on Ubuntu 18.04 - “you may have been able to authenticate and did not have permissions on the target directory…”

I think I've used Ansible before, to control a Ubuntu 16.04 VM. I can definitely use this same task to successfully control a Debian 9 VM. However, with a Ubuntu 18.04 VM, it fails with "...
0
votes
1answer
328 views

How to automatically add IP addresses to Ansible host file

I am looking for a way to automate adding IP addresses to my Ansible host file when new Virtual machines are created instead of manually adding/removing them to the hosts file. I also want to be ...
1
vote
1answer
896 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 ...
4
votes
1answer
3k views

Ansible - How to mark a tasks as success when it failed actually

We are using some pipelines to build servers using ansible and one of the task is to check if server is online (means a production server in inventory list by accident). We check the port 443 and ...
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 ...
0
votes
1answer
135 views

How to save the password for the next commands in the shell script?

When my script starts, the shell asks me for the password for the module apt-get, and then again for ansible, because it has the option --ask-get-pass. How do I enter the password only once for ...
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. -...
0
votes
1answer
87 views

Build Ansible inventory based on server variables [closed]

I want to build ansible inventory and assign hosts to respective groups based on the values gathered from Clients. Eg: Information of all the clients and their respective group will be pushed to ...
1
vote
2answers
914 views

Add new line to /etc/sudoers via ansible

I am trying to add new line to the /etc/sudoersfile via ansible. But it does not work what is the problem, Could you please help? I have tried visudo -c command in order to make sudoers file to ...
2
votes
1answer
152 views

Clarification on example from Ansible documentation needed

The lxd_container module for Ansible 2.5 contains this example: # An example for creating a Ubuntu container and install python - hosts: localhost connection: local tasks: - name: Create a ...
1
vote
1answer
299 views

executing linux script with options in expect

I am executing Linux script in expect mentioned as below. spawn "sh /opt/Avaya/CCR/util/CAT/cat.sh --iptfile=no" I am using ansible to execute above command . when I execute ansible-playbook ...
0
votes
3answers
2k views

Try to Get Single Row from Ansible Output

I am using ansible in order to read /etc/sudoers file to display which users have root permission on related server. This is the .sh file #!/bin/bash username=`sudo cat /etc/sudoers | grep "...