Questions tagged [ansible-playbook]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 views

How can I use ansible to synchronize directories between groups of servers?

I am currently migrating some data between servers and need to make sure I'm copying some data directories while still preserving mappings between old hosts and new hosts. I'm looking at using ansible ...
1
vote
0answers
15 views

Ansible is unable to connect to a MySLQ database from last week

I have a docker container with jenkins, that uses ansible for some automated commands. One specific commands connects to a database on a different docker container and perform some checks (as cleaning ...
0
votes
0answers
22 views

Ansible exclude semicolon

I'm new to ansible and right now I'm trying to search a specific word from my output: vars: vlans: - vlan 999 tasks: - name: Check Vlans ios_facts: gather_subset: - '!...
0
votes
1answer
21 views

Ansible: Iteration fails while looping over output variable

Here is my debug output from an ansible playbook: "msg": { "changed": false, "failed": false, "instances": [ { ...
0
votes
1answer
26 views

How to pass a different sets of variables for each iteration of loop in an Ansible task

I have an Ansible task which loops through a list and for each item in the list runs a role, using include_role. For each iteration of loop I want to pass a different set of variables. Currently, I am ...
-2
votes
0answers
15 views

“msg”: "ansibleundefinedvariable: 'ansible.parsing.yaml.objects.ansibleunicode object' has no attribute

I'm needing some help with my ansible playbook I keep getting this long error about missing a variable. - hosts: [centos] vars: company_site: - {item.companyname: "Totsuki ...
-1
votes
0answers
11 views

Ansible Filtering for VMware Disk Scanning

I'm writing a playbook with following tasks: List the disk and store it as a variable using set_fact {before_fact} Add new disk Refresh facts using setup List the latest disk and store it as a ...
0
votes
1answer
87 views

Ansible: populate new fields in each item of a list

I'm a total Ansible and Python beginner. I have a list: my_items: - name: item1 unix_user: unixuser1 homedir: /home/unixuser2 - name: item2 unix_user: unixuser2 homedir: /home/unixuser2 I ...
0
votes
1answer
43 views

Adding arguments to Packer's Ansible provisioner

My Friday brain is really struggling to convert an Ansible command line into the format my Packer .json wants. The Ansible: ansible-playbook playbook.yml -e @env/users/user01.yml --ask-vault --ask-...
-1
votes
0answers
28 views

How to Upgrade ceph-ansible from Nautilus to Octopus using rolling_update.yml

So one of the things, I am trying to do is upgrade ceph-ansible from nautilus to octopus. Right now ceph-ansible is the preferred method of deployment for ceph, and I need to upgrade pretty soon. ...
0
votes
1answer
24 views

How to fetch the disk difference before and after adding a new disk

I'm preparing a playbook to find the newly scanned HDD from vmware, I used below filtering to fetch the no. of HDDs: before_add: "{{ hostvars[inventory_hostname].ansible_devices.keys() | select('...
3
votes
2answers
203 views

Ansible command ignore creates

I use command module with creates on an ansible 2.9 role. However, sometimes I need to ignore the creates arg and re-run the command multiple times. Is there any way I can override the default ...
0
votes
0answers
21 views

Ansible Windows install a service only if does not exist

I need to configure a service with ansible on Windows OS, but there are servers that has the service installed and others don't have. How can I specify in ansible playbook to install the service only ...
0
votes
2answers
77 views

Does Ansible offer a way to build/compile on the control node, and then deploy to managed nodes?

Is there any way to have Ansible run a build script locally on the control node, and then deploy the resulting artifact to various managed nodes? Please let me know if there's something I've missed, ...
0
votes
1answer
70 views

On a RHEL workin as ansible controller getting error running playbook

I have a playbook that runs with no errors in my local tests VM (CentOS7) but when I run this same playbook on the prod servers (RHEL7). I run below command sudo ansible-playbook passwords.yml -e ...
0
votes
1answer
59 views

Failing to download metadata with DNF upgrade playbook

i'm trying to learn something about ansible and the automation, unfortunately I'm getting frustrated at the early step. I just tried from debian 10 machine with ansible to write a yaml to upgrade 2 ...
0
votes
1answer
31 views

How do I populate Ansible variables in a single pass

I have a simple Ansible role which creates a Foreman activation key, however it only "subscriptions" with the last value and not both? # cat roles/hammer/tasks/subscription.yml --- - name: ...
1
vote
1answer
57 views

Restarting winbind service on rhel6, service restarts but ansible fails the run

Seeing this consistently with the playbook below. - hosts: all gather_facts: no become: yes tasks: - name: restart winbind service: name: winbind state: restarted - name: ...
0
votes
2answers
31 views

How can I ask a remote server that was never connected with my local machine to connect with me by SSH?

I use an old server, that has not been updated and that cannot be updated. The OS is FreeBSD, there is no Python, obviously Ansible, and no sshpass. I access this old server from my personal computer ...
0
votes
2answers
278 views

Ansible - x.x.x.x | UNREACHABLE! => { “changed”: false, “msg”: "Failed to connect to the host via ssh … }

I created a cluster and i try to reach the master node from an another Ansible server. I copied the ssh key to the master server. and i can reach it via below command, from ansible server ssh -i ~/....
0
votes
1answer
99 views

Run a remote playbook

I have a situation where I have the AWX repo cloned into the /tmp/ folder on a remote docker swarm container and I am already using ansible playbooks. What I am trying to do is run the playbook I have ...
0
votes
1answer
70 views

How to cache Ansible group and host variables throughout a play

I have a playbook for some hosts which have group variables and host variables that use a custom lookup plugin to extract values from an API endpoint. ansible_user: "{{ lookup(...
0
votes
0answers
299 views

How in Ansible AWX 15.0.1 to use 'in' to find a nested variable from extra_vars

I wrote in my extra_vars block in AWX the following variables that I expect to be changed anytime someone runs this servers: - vm_name: TestDeploy01 vm_ip: 10.10.1.241 vm_tag: - Infra ...
0
votes
1answer
205 views

How to mount disks based on a ansible facts ansible_devices ids?

i'm trying to mount disks when a ansible device correspond a specific ids name: google-pgdata "sdc": { "holders": [], "host": "", ...
0
votes
1answer
389 views

Ansible --become not working when “sudo with NOPASSWD” is not activated on remote machine - MODULE FAILURE

In remote server, normal user is having sudo access but NOPASSWD not activated. sudo su - command ask for user password. I am trying to run a command using Ansible as providing sudo password but its ...
0
votes
1answer
273 views

Ansible Get hostname from hosts file

I want to be able to get the first 8 characters of the first host in a group from a hosts file. So in the below example I want a variable to be assigned xx33sx01. I know I can use inventory_hostname ...
0
votes
1answer
101 views

Store ansible inventory files on a remote location

I'm trying to find a way to store Ansible inventory files on a location other than the server's local space (say for example Azure). Is this something that can be achieved by Ansible Dynamic Inventory?...
1
vote
2answers
420 views

Ansible run certain tasks one one group of servers, other on another

I'm migrating a group of websites from one infrastructure to another, including a fairly slow rsync operation. The migration process includes changes to both the source and target systems. Due to a ...
-1
votes
1answer
114 views

How to expose passwords/secrets in Ansible playbook

I have a simple Ansible playbook to Fetch a database connection config from an RestAPI, Extract the config object from the payload, Using the config JSON (as request body) to create a PUT request to ...
1
vote
0answers
58 views

Multiple ansible-playbook Execution with Error status

I am trying to execute multiple playbooks with master.yml file. For each playbook PASS/FAIL summary I need to publish. Each playbook executes on multiple hosts, so can't use it in tasks. Any idea how ...
2
votes
2answers
125 views

How to manage a modified copy of a file?

Following this answer, I want to make a copy of OpenSSL's configuration, with a specific set of changes. The original file is out of my control, so I can't make it a template. At the moment I have: -...
0
votes
1answer
585 views

Ansible to rename a file only if exists

I need to rename /jp/Test to /jp/test only if /jp/Test exists , otherwise i dont need to perform this task. if Both exists i need to merge both into /jp/test I get below error {"msg": "...
0
votes
1answer
298 views

cannot download repodata/repomd.xml

I'm training for my RHCE 8 EXAM, and I have to: Create a playbook with the name setupreposerver.yaml to set up the control host as a repository host. Make sure this host meets the following ...
0
votes
1answer
136 views

sequential deployment in multiple servers using ansible playbook

I have 8 servers as(s1,s2,s3...)which are windows servers and an ansible-playbook with tasks in roles. How do I configure host inventory and execute all these tasks in s1 then in s2 then in S3......
0
votes
1answer
50 views

Dynamically creating a list in Ansible with jinja

I need to dynamically set a new list type variable list var. Here's a basic playbook example: vars: app_instances: - host_name: host1-domain inst_count: 3 - host_name: host2-...
1
vote
3answers
913 views

Using if else statement inside shell module in ansible playbook

I am trying to run if else statement inside shell module in ansible playbook but looks like my else statement is not executing in any case. - name: verify application/database processes are not ...
0
votes
1answer
21 views

Pass encrypted value from xml file to ms build command

I have a xml file with passwords in it. I have to pass these passwords from a xml file to password property in MSBUILD command. Can anyone guide me Xml: <?xml versio------> <configuration> ...
0
votes
3answers
959 views

Start systemd service after ansible playbook execution is complete

We are running ansible playbook on every boot and it does bunch of checks and configuration tasks on the host. We also have few systemd services that needs to run on that host. How do I make those ...
0
votes
1answer
171 views

Ansible shell passes a command without executing it

I am using ansible for the execution of a script (myScript.sh) over some nodes through the command: - hosts: primaryNodes,!node13 vars: mongodPath: /usr/local/mongodb become: yes become_user:...
0
votes
0answers
56 views

How to force ansible to limit stdout width?

Is there a simple way to force ansible to think that the shell where it writes is shorter than the actual shell? How does it determine the shell width? I'm using ansible-playbook command in a python ...
1
vote
1answer
1k views

Ansible, with_nested, How to asign dynamic variables in loop

I'm trying to iterate through the number of entries dynamically in an array and use the output as an index. Pretty sure I'm doing something wrong. How can I assign a variable to the sequence end that ...
1
vote
1answer
119 views

Ansible module to look for new hostname and update config file

Can you help fix this? I am trying to write the hostname into a file. --- - name: Update host. hosts: all connection: local # Default Value domain: '{{ default_domain }}' hostname: “...
0
votes
1answer
59 views

Getting a fact from group not specified in role in ansible

My ansible playbook has specified which group it's for. But the role that is specified, needs to get a specific variable from another group the host is in, because the apache setup is dependent on ...
1
vote
2answers
37 views

How to use a predefined dynamic list in a loop correctly in ansible

In a playbook, I need to use a loop from a dynamic list, I wrote this construction: dirs: - one - two - three path_to_some_files: - some_path/folder/{{ item }}/*.file with_items: - '{{ ...
0
votes
2answers
1k views

creating user and sshkey with ansible user module

I wanna create some local and remote users and generate ssh keypair for respective users and transfer them to remote server but it seems local user - ansible - which runs ansible-playbook does not ...
0
votes
1answer
24 views

Failing play prevents later 'localhost' play from executing

I've written the following playbook. I expect an error from the second play, but the first and third to run. What I get is the first running, the second failing, and the third is completely ignored. ...
0
votes
2answers
154 views

Check if job is running on another server in the same network using Ansible

On a private Network, I have two servers, let's call them server01 and server02. They are in the same network. The second server is rebound server i-e if server01 is no longer active, the second ...
0
votes
1answer
204 views

How access ansible dictionary ansible_net_interfaces sub branches

I'm trying to read information from ansible_net_interfaces, but the interface names will be different on each device. I'm having no trouble accessing most information, but when I get to ipv4, there's ...
1
vote
1answer
500 views

Ansible - Avoid duplicates between group and host vars

I'm new at using ansible for server management and I need some help managing users and group's membership definition according to host and hosts-group, with a minimum of duplication and a maximum of ...
1
vote
1answer
206 views

How to convert and save raw data to PDF format using ansible

I will be getting some raw data directly from an API. I want to format this and convert into PDF file and save it. I gone through ansible modules. I am not getting any idea in this. Can someone ...

1
2 3 4 5
7