Questions tagged [ansible-module]

75 questions
0
votes
2 answers

Enhacing a playbook by storing the hostname of the changed machines locally

I am trying to enhance my playbook by storing the hostname of the changed machines locally, and I want to use as much as possible of the ansible module that is why I choosed the usage of th copy module for this storage: My playbook look like this…
Jinja_dude
  • 404
  • 5
  • 20
0
votes
1 answer

I want to replace a word which is associated with a particular pattern/line

Say a file (socket.cfg) has the following socket1:a:1.2.3.4:wso,ws1,ws2 socket2:b:2.5.6.7:ws3,ws5,ws7 Now I want to change only the IP where "socket1" contains in the line and the rest should remain the same. The data given to me would be only…
Kushal
  • 3
  • 1
0
votes
0 answers

How to execute linux command of helm using ansible modules?

I'm running this command: - name: Save to tmp/charts shell: '{{helm_cli_path}}/helm --kubeconfig {{kube_config}} install {{install-name}} {{helm_chart}}/ --dry-run --debug > {{charts_dir}}/{{install_name}}.yaml' to store helm gerenated yamls…
medgai
  • 82
  • 4
  • 13
0
votes
1 answer

Parsing vars from Ansble to powershell

I have created my own module. This module executes a powershellscript. But now I need to overgive them some variables, how can I do this. I already have tried with this: $data = Get-Content $args[0] | Out-String | ConvertFrom-Json But that doesnt…
0
votes
0 answers

Install and use Ansible module from git repo (Ansible for Nsxt)

I'm trying to use this repo as an Ansible Module, So I git cloned it, went into the examples folder and tried to run : export ANSIBLE_LIBRARY=/home/XXX/ansible-for-nsxt-master ansible-playbook -vvv…
NeitoFR
  • 716
  • 1
  • 11
  • 23
0
votes
2 answers

ansible issue (return a unique key/value)

Sorry to put again a bockinfile issue, but regarding the cases before, i don't think, this is similar to them. How can i use key/value pair, to return a unique key/value in the output file for each host. Using the playbook mentioned bellow, it loops…
yelmir
  • 13
  • 4
0
votes
2 answers

FileNotFoundError: [Errno 2] No such file or directory : Ansible

I'm new to Ansible, here I created a module which takes CSV as an argument like below: But it keep throwing error that it's not able to find CSV_TEST.csv file. am I creating it the right way as a variable in the ansible module? module.py def…
Shivrai
  • 99
  • 2
  • 4
  • 15
0
votes
1 answer

Do we have ansible module to perform resizing of openstack volumes?

Could you please let me know whether we can use ansible module os_volume for resizing of openstack volumes?
0
votes
1 answer

Custom Ansible module issue

I'm writing a custom Ansible module and the python works fine but I'm having trouble turning it into a module. I've created a dummy module to reduce complexity and I'm getting the same issue. So the problem is with my Ansible boiler plate code.…
Mark Ryan
  • 31
  • 4
0
votes
1 answer

Update hostname for Mysql user using Ansible

I want to update my MYSQL user using ansible-playbook. What I tried: I checked out the MySQL module doc but there is no option to update the hostname of a…
AATHITH RAJENDRAN
  • 4,689
  • 8
  • 34
  • 58
0
votes
1 answer

Is there a grep and cut command equivalent in Ansible without using command module?

I am using below shell command and result is an array of strings' MQSFILEPARSED=$(cat $FILE | grep ' Name=' | cut -d '=' -f2); Is there a way to perform this operation in Ansible without using the command module
Jyotsna Gupta
  • 41
  • 2
  • 10
0
votes
1 answer

Ansible - dealing with unexpected STDOUT in custom module

I wrote a custom module that wraps a Python library. I define result dict as follows: result = dict( changed=False, original_message='Running DBSCONTROL', message='' ) Later in code I wrap the call to the library into try/except as…
Bostone
  • 36,858
  • 39
  • 167
  • 227
-1
votes
1 answer

Facing issue while updating xml file using win_xml ansible module on windows

1.I'm trying to update xml element values in test.xml file using ansible script with help of win_xml, my ansible playbook looks like below: --- - hosts: windows gather_facts: no tasks: - name: Updating xml file win_xml: path:…
-1
votes
1 answer

How to access predefined Ansible modules in Custom Module?

Can someone please post a example on how to use a predefined Ansible module, in example git module in a Custom Module? I was trying to convert the below tasks into a single Custom Module - name: Clone repo on Remote Hosts git: repo: "{{…
-2
votes
2 answers

Ansible Custom Module: Are print statements possible?

I have an Ansible Custom Module for performing a specific task in my playbook. I want to debug specific variables inside this module. Is there a way we can print anything inside this custom module? In the example below, print "Hello". Please check…
Akash-BLR
  • 63
  • 4
1 2 3 4
5