Questions tagged [ansible-module]

75 questions
1
vote
1 answer

What are Ansible module attributes?

Each Ansible module's documentation page has an "Attributes" section. For example, here is the one for the command module. It has these attributes: check_mode, diff_mode, platform and raw. In general, how do I use a module's attributes? And in this…
lonix
  • 14,255
  • 23
  • 85
  • 176
1
vote
1 answer

How to search for a string in a remote file using Ansible?

Based on a questions How to search for a string in a file using Ansible? Ansible: How to pull a specific string out of the contents of a file? Can slurp be used as a direct replacement for lookup? and considerations like By using the slurp module…
U880D
  • 8,601
  • 6
  • 24
  • 40
1
vote
1 answer

Ansible should only print 'FAILED' after completion of all retries in until loop, not for every iteration

I have an Ansible task almost identical to the top answer here: Ansible playbook wait until all pods running - name: Wait for all control-plane pods become created shell: "kubectl get po --namespace=kube-system --selector tier=control-plane…
Josh
  • 31
  • 4
1
vote
0 answers

How to read the ansible.cfg file variables in Ansible custom modules?

Can anyone help me find how I can access the variables defined in ansible.cfg file into my Ansible modules Python code?
1
vote
0 answers

Ansible win_chocolatey install_args

I try to install oracle sql developer on windows host with ansible with this task: - name: Install oracle-sql-developer win_chocolatey: name: oracle-sql-developer version: '20.4.1.20210328' state: present install_args: "--params…
1
vote
1 answer

Ansible Module - required_if

I am developing an Ansible module and I have a problem with the architecture of my module. I would like to have something that looks like this: - name: test my new module hosts: localhost tasks: - name: run the new module my_module: …
Nemrode
  • 27
  • 2
1
vote
1 answer

Grant LOAD from S3 with PyMySQL 1.0.2 not working

I'm using ansible with community.mysql.mysql_user to automate database user creation on AWS aurora. So far all the grants have been working fine, however a new requirement for "Load from S3" which is specific to mysql on AWS does not show up after…
fjc101
  • 23
  • 3
1
vote
0 answers

Ansible module for Brocade/ICX is misbehaving

I've to perform some network automation in my infra using ansible. When I'm trying to use ansible module for icx switches it seems to be misbehaving. Playbook I used --- - name: ICX switch testing hosts: test-switch gather_facts: no vars: …
saurabh
  • 21
  • 3
1
vote
1 answer

Ansible check disk space of a folder

There is a module that allow me to check disk space of a folder like the command df -h /path/to/folder? i want to avoid to use shell or command module, i can't believe there is no module for it
Mirco
  • 212
  • 3
  • 12
1
vote
0 answers

Ansible Module Development - Reuse Options

I am developing some ansible modules for interactions with a REST API. As I am writing them I am finding that I am copy/pasting common options. For example, in module1: module1.py def run_module(): module_args = dict( …
TheMethod
  • 2,893
  • 9
  • 41
  • 72
1
vote
1 answer

cant enable mongo service

I am trying to enable mongo service using ansible on my aws AMI. Here is the task for the playbook - name: Mongodb repo yum_repository: name: mongodb description: mongodb baseurl:…
1
vote
2 answers

Custom Ansible module is giving param extra params error

I am trying to implement hostname like module and my target machine in an amazon-ec2. But When I am running the script its giving me below error: [ansible-user@ansible-master ~]$ ansible node1 -m edit_hostname.py -a node2 ERROR! this task…
Sandipan
  • 683
  • 8
  • 25
1
vote
2 answers

Not able to use unarchive module to untar file.tar.gz folder also when used shell module facing error

My playbook with shell module - name: Unarchive macports from local machine shell: | tar -xvf MacPorts-2.6.2.tar.gz cd MacPorts-2.6.2 ./configure make make install Error [WARNING]: Consider using the…
ZAriel
  • 35
  • 2
  • 10
1
vote
0 answers

Writing module 'su - ' in Ansible module or use become?

I'm writing a Ansible module to configure software The supplier requires that the configuration commands must be executed under a specific user. If you do it under 'root' you will get an error. So mu current solution is: module = AnsibleModule(....)…
Erwin
  • 11
  • 2
1
vote
1 answer

How to copy file from Network path to controller machine in ansible

Let's assume I have a textfile in some network path EX: \cr-ampd-a01.abcd.loc\BulkFolder\textfile.txt How to copy that file to my controller machine in ansible Note: I can access it by (WIN+R and that path) then it pops up for credentials to…