Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ansible-playbook]

The tag has no usage guidance.

0
votes
0answers
8 views

Overriding ansible_skip_tags within a playbook

I’ve been able to manage Ansible's control variable that you usually specify on the command line using the set_fact module; such as - name: Use a default SSH key for this playbook set_fact: ...
0
votes
2answers
30 views

Ansible: user escalation failure

I am having a hard time understanding how to set privileges per task in ansible. So given the playbook scrappy, I want to log in as the admin user (ubuntu) but do something as the user scrappy. Note ...
1
vote
2answers
91 views

Ansible Variable above hosts

Ansible Variable above hosts hello its posible to create a variable for multi hosts like this? vars: some_vars: "./Prometheus/roles/" # <---- THIS Variable? - hosts: lxd1 vars_files: ...
1
vote
3answers
85 views

Rollback the changes in Ansible

Is there any method to rollback the changes in Ansible? Suppose my play book contains different plays like create 5 users,install 3 rpms, start the services. If I want to rollback a certain play how ...
-2
votes
0answers
46 views

Ansible chgrp failed when changing permission and owner of a directory

I have a following task that change the owner ship of directory to be able to writeable by webserver - name: give writeable permissions to laravel storage directory file: > path={{ ...
0
votes
1answer
29 views

How to define Microsoft network client: Digitally sign communication (always) with ansible win_regedit

I want to select Define this policy setting for Microsoft network client: Digitally sign communication (always) in the Group Policy on Windows Server with Ansible and select Disabled radio button. The ...
1
vote
1answer
70 views

Ansible - Using different users to login when working on a dynamic inventory

I'm trying to install a package on a list of servers, these have a tag in common so I'm using that tag as they are all having Environment tag set to Dev. But the issue is some of them have OS as ...
0
votes
1answer
32 views

Force Ansible to log off to refresh user groups

I'm setting up a server with Ansible and Docker. I'm currently learning both technologies, so please bear with me if I'm being overly stupid here. In order to run run Docker commands, the user has to ...
0
votes
2answers
62 views

New to Ansible - adding users to servers depending on type

I'm relatively new to ansible, and am trying to write a playbook which adds users to a group of servers depending on the user_type (which i'm trying to define)... So... my playbook looks a little ...
-3
votes
1answer
80 views

How to copy a 1 GB file using ansible to remote machine as different remote user and password

I have tried to copy a file output of the ansible-playbook looks ok , but the file was copied to local machine not to remote machine in the location dest mentioned in yaml file. bash-4.2# ansible --...
0
votes
1answer
96 views

Ansible where do PreferredAuthentications SSH settings come from?

I'm running a standard ansible (v2.3.1) playbook using SSH username and password settings. When using the '-vvvv' setting i can see these SSH commands getting generated EXEC ssh -C -o ControlMaster=...
0
votes
0answers
25 views

ansible playbook to restart servers if necessary

I have tried to create a playbook to update servers and reboot if necessary. I cannot get it to work. I have managed to split it into 2 playbooks for Amazon Linux and Ubuntu. However, when I try to ...
0
votes
1answer
24 views

ansible double loops execute one by one based on when condition

In ansible variables are getting dynamically from register output first loop will collect the values from registered ouput result and once it will satisfy the when condition, next loop should start ...
1
vote
1answer
81 views

Ansible: cannot get contents of a variable

I seem unable to get the output from a yum command from ansible. I have $ cat mcve.yum - name: MCVE hosts: localhost tasks: - name: Install package yum: name=perl register: ...
0
votes
0answers
34 views

Ansible is stalling while running bundler module

I'm putting together a small ansible playbook to deploy a jekyll site and I'm running into some issues when running a task to update the codebase dependencies with bundler. I've tried debugging with ...
0
votes
0answers
17 views

ansible run from mac fails with objc error

I've been running ansible-playbooks from my mac for months and yesterday I began having problems. I'm reinstalled ansible and python 2.7 to no effect. I have a workaround but the reason for the ...
0
votes
0answers
12 views

ansible cuts off WINRM RESULT making investigation a challenge

Is there a way to get ansible-playbook execution to provide the entire winrm error? I am running with -vvvv and still see a cut off like below: WINRM RESULT u'<Response code 1, out "{"changed":...
0
votes
1answer
97 views

ansible-pull: what does `fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “one of the following is required: name, list”}` mean?

What does the following message mean? fatal: [localhost]: FAILED! => {"changed": false, "msg": "one of the following is required: name, list"} The scenario: I run: $ sudo ansible-pull -C ${user}/...
0
votes
2answers
56 views

Ansible variable for roles used several times

I have a role with some variables than I using several times with different parameters like below: roles: - role: my_role vars: role_uuid: uuud_1 first_param: first - ...
0
votes
2answers
165 views

Using ansible with password authentication and different usernames

We're in the position of maintaining multiple database servers, which have one of two admin accounts, and which use password authentication. Lets say that the two accounts are "db_admin" and "db_user"...
0
votes
1answer
62 views

Does ansible win_chocolatey module support retries?

Has anyone ever seen retries work on an ansible win_chocolatey task? The follow seems to fail on the first attempt with no retries and I'm getting timeouts at the ansible level while choco attempts ...
1
vote
1answer
38 views

Ansible hangs on pumactl start

I have a playbook to install puma on my ec2 instance and everything is fine except when I run bundle exec pumactl start at the the end it starts the server but the playbook hangs indefinitely. Here ...
0
votes
1answer
113 views

In ansible, how do I specify an exclusion set of hosts in a playbook?

With command line patterns, you can specify patterns like "all,!ntpservers" but I can't figure out how to specify this in a playbook. I'm regularly running into cases where I have to install a client ...
1
vote
1answer
53 views

Pooling package installs in ansible

I am trying to set up a system with multiple roles (e.g., webserver, database-server, mailserver etc.) Each of the roles requires the installation of some software packages defined as their own task ...
1
vote
1answer
107 views

Ansible: Calling tags from role but they are not getting executed

I have some tasks as shown below - name: Add the server's domain to the hosts file lineinfile: dest: /etc/hosts #regexp='.*{{ item }}$' line: "{{ hostvars[item].ansible_default_ipv4....
1
vote
1answer
70 views

Managing multiple remote user accounts and pubkeys with Ansible

I'm trying to work out a way to manage a single user's pubkey across multiple sites, as well as dropping that key into multiple $HOME directories. Reason being; our devs login as themselves to check ...
1
vote
1answer
43 views

Restart MariaDB cluster with Ansible

I would like to restart my MariaDB cluster with Ansible. I applied serial option to run script on servers one by one, but at the end of the script (= after build cluster), I would like to run command ...
2
votes
0answers
59 views

Ansible: Replace (only) default config file

I'd like to place a custom configured /etc/my.cnf ONLY if the default my.conf is currently in place. Once the default my.cnf has been replaced or edited, I don't want to risk replacing it with my ...
0
votes
1answer
65 views

Iterating Over An Unknown number of custom Ansible Facts

I've written some custom facts which I reference to as values for a module in a task . When I have 1 custom fact I don't have a problem running the task , but the question is , what do I do when I ...
2
votes
1answer
1k views

Using if/else statement to run a command in shell

I wanted to run a command in shell (basically via ansible playbook), the condition is, if the ps status gives non zero exit code then it needs to run another command. I don't wanted to split this into ...
0
votes
1answer
91 views

issues with Ansible and vars precedence with dependencies

I'm having issues with vars precedence, hope you can help me here. I'm currently using geerlingguy.ansible-role-postgresql as a dependency of my own postgresql role. Is define as a dependency in meta ...
0
votes
0answers
24 views

In ansible is it possible to use different users inside role task

In ansible is it possible to use different users inside role task # example: role # fuse_star # tasks # main.yml - name: start fuse command: " start fuse" ...
2
votes
2answers
214 views

Ansible parsing a JSON output

I'm using URI in order to get a JSOn output to a register called "vchosts" TASK [debug] ****************************************************************************************************************...
0
votes
1answer
176 views

Ansible Debug-msg data as email content

I want to send email with content from .yml file output. I've created a Jenkins job using groovy script and inside groovy I'm using shell script to call .yml file and inside I'm checking the url's ...
-1
votes
1answer
50 views

Ansible won't create yum repository

I'm trying to get Ansible to set up the EPEL repository on a new AWS instance. It fails if I use the yum_repository module. If I use the yum module and try to install it over the wire it reports as ...
0
votes
1answer
408 views

ansible-playbook doesn't work inside a bash script

I am not sure what is going on and hence I enquiring here as well in hopes that some of you might. I am trying to figure out why the same one-liner will successfully connect on my remote server ...
2
votes
1answer
1k views

Register ansible variable in multiple tasks

I'm using the following tasks in an ansible script that installs updates on various servers. These tasks are for CentOS machines: - name: Check for outstanding reboot shell: needs-restarting > /...
0
votes
1answer
86 views

Ansible : format Filesystem subtask fails

I have below task which fails at formatting EBS volume and just do not proceed further. I've checked all the documentation here but I find no issue with ansible task I defined here. --- # tasks file ...
1
vote
1answer
74 views

How to distribute SSH sessions via load balancer?

I have servers set up that look something like the diagram attached. I am trying to ssh into one of the build servers in the auto scaling group via the load balancer(NLB), but getting the following ...
0
votes
1answer
617 views

run long shell command on remote servers using ansible

I have a task in which I want to run below command on a shell on remote servers but whenever I run my playbook, it always gives me exception: - name: copy files shell: "machines=(machineA ...
-1
votes
2answers
384 views

template error with conditional check on “failed_when” ansible

I have an ansible task in which I need to verify whether I have all 1987 files and all those files were generated within 1 minute period. - name: check all 1987 files find: paths=/proc/files ...
1
vote
0answers
28 views

change a group_var on every 20 executions

I have an Ansible project with more or less 100 hosts (much more in a near future), this project does several calls to an API that as a limit rate of 1000 calls per token. In my project I define the ...
0
votes
1answer
65 views

ansible-playbook to use subdirectory as variable

/var/lib/phoronix-test-suite/test-results/ it has 3 subdirs: 2018-04-22-1850 2018-04-23-1850 2018-04-24-1850 and a tiny file in each: composite.xml part of it's content: <Result> <...
-2
votes
2answers
170 views

Error while connecting to remote host using Ansible [closed]

Geting error while connecting to remote Mysql host using Ansible. Playbook as below --- - name: "Create database" login_host: host.xyz.com login_password: "{{ mysql_root_pass }}" login_port: ...
0
votes
1answer
580 views

How to skip a playbook in Ansible

I have two playbooks one is fs.yml and nfs.yml..How can i add these two play books in single playbook and should prompt me which one i need to play. My playbooks pasted below. Tried multiple options ...
0
votes
1answer
92 views

ansible-playbook 2.5 doesn't find group vars when specifying an inventory file directly

I've been using ansible scripts for some one shot tasks, for example doing a firstsetup after provisioning a VM. I have a script that creates a temporary inventory file, uses it to run an ansible ...
0
votes
1answer
974 views

Ansible jinja2 template: How to loop through sub-elements of interface facts

There's a unappreciated but very useful answer here which explains how to loop through the interface facts for an arbitrary number of interfaces. Basically, it comes down to this: debug: msg: "{{ ...
0
votes
1answer
706 views

VARIABLE IS NOT DEFINED ! response from API Call in Ansible

The following is my playbook containing a Rest Call --- - name: "REST CALL" hosts: local tasks: - name: "REST Call to Get Session ID" uri: url: http://192.168.96.172:5300/avxapi/...
0
votes
1answer
54 views

Ansible: don't require password on every run

I am looking for a way to securely handle passwords in ansible. Basically I'd like to avoid typing my password every time root or administrator access is required on a remote machine, but maintain ...
1
vote
1answer
831 views

How can I set the content of a variable to the result of a HTTP call?

I am attempting to query artifactory to find the latest version matching a given glob pattern. I'd like to set the output of this to a variable that I can later use with the maven_artifact module. I ...