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
1answer
23 views

lineinfile module creating a file if it doesn't exist even I use “create=no”

--- - hosts: testhost become: yes tasks: - name: change user profile copy: src=/tmp/profile dest=/home/test/.bash_profile force=no owner=test group=test - name: update bashrc ...
0
votes
1answer
16 views

Ansible cloud stack module nested loop for security groups and ports

I'm trying to set multiple security groups at once using the ansible cloud stack module. The yaml file currently looks like this: - name: add inbound tcp rules to security group web ...
0
votes
0answers
14 views

Why is Terraform prompting for a variable value when I've already declared it?

Background In regards to ansible-playbook plays. I'm aware you can output to a log: log_path = ./ansible.log I'm aware of adding verbosity (-v, -vv, -vvv...) to the output. However what about ...
0
votes
2answers
42 views

How can I abstract away Ansible roles?

I have 2 different database instances in my infrastructure, each used to save different data, each running on different machines, and each of them needs different levels of availability & safety, ...
-1
votes
1answer
41 views

Openshift installation playbook failing

I'm trying to install 2-node cluster with origin version 3.10 (one master, one node). Playbook fails on task openshift_control_plane : Wait for control plane pods to appear Initialization ...
0
votes
0answers
17 views

Ansible AWX playbooks pulled from github do not show in playbook drop-down box

I've got an installation of AWX 1.0.7.2, running on Ubuntu 18.04.1 and using Ansible 2.6.2. The installation was done using docker on linux. I have a couple of projects configured each of which uses ...
0
votes
2answers
23 views

ansible replace module is not working as expected

my ansible play book is working for me to uncomment certain lines in a .conf file, but its failing for one particular line its not making any change. below is my .conf file part. #<VirtualHost ...
2
votes
1answer
25 views

ansible -how to pickup hostname and create self signed certificate

i have working command for creating self signed certificate for IHS server's .kdb file and i was trying to use the same command through ansible. Here my aim is that ansible should detect the hostname ...
0
votes
0answers
27 views

Avoiding jinja templating delimiter in when statements

I'm currently porting my Ansible playbooks from version 2.1 to 2.7. Ansible now prints a warning if I use jinja templating delmiters such as {{ .. }} in a when clause. [WARNING]: when statements ...
0
votes
1answer
67 views

Ansible expect is not sending response

I'm new to ansible and trying it by writing an ansible playbook for installing graphite, as a part of it I have the graphite-manage syncdb command which I would like to automate. I wrote this task to ...
0
votes
1answer
19 views

Unable to access group address for template in Ansible

I'm trying to enumerate my eth0 address (set to default, because I read somewhere that eth0 is not always available..). In my template I attempt calling it from the group like so... [Unit] ...
0
votes
1answer
27 views

Ansible Playbook and syntax issue with variables

I'm trying to execute the below playbook I wrote but it fails on some syntax errors. I tried few things from the online doc but without sucess so far. The aim of these variable is to generate a ...
0
votes
1answer
38 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
60 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
113 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
245 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 ...
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
84 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
70 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
64 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
138 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
237 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
39 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
38 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
109 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
42 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
23 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
14 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
209 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
80 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
647 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
80 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
47 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
476 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
170 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
123 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
63 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 ...
3
votes
0answers
80 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
91 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
2k 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
99 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
321 views

Ansible parsing a JSON output

I'm using URI in order to get a JSOn output to a register called "vchosts" TASK [debug] ****************************************************************************************************************...
1
vote
1answer
207 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
54 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
490 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
2k 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
113 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
90 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 ...