ansible

use ansible-runner as Python module Interface to Ansible error: RunnerConfig' object has no attribute 'command'

use ansible-runner as Python module Interface to Ansible error: RunnerConfig' object has no attribute 'command' Question: I use ansible 2.9.13 and ansible-runner 1.4.6 Below is my Python code: from ansible_runner import Runner, RunnerConfig f = open(‘/home/george/dev/beeops/ansible_private/keyfile’, ‘r’) key = f.read() rc = RunnerConfig(private_data_dir=’/home/george/dev/beeops/ansible_private’, playbook=’test.yml’, inventory=’127.0.0.1′, ssh_key=key,) r = Runner(config=rc) r.run() An error occurred while I …

Total answers: 1

How to Install python packages on a virtualenv using Ansible?

How to Install python packages on a virtualenv using Ansible? Question: I am not able to launch gunicorn I am getting this error error: fatal: [172.105.102.110]: FAILED! => { "changed":false, "cmd":"/myproject/myprojectenv/bin/gunicorn -D –chdir /myproject –error-logfile /root/.ansible/tmp/ansible-tmp-1593463703.788082-353660-248038870081082/gunicorn.temp.error.log –pid /root/.ansible/tmp/ansible-tmp-1593463703.788082-353660-248038870081082/gunicorn.temp.pid wsgi", "msg":"[Errno 2] No such file or directory: b’/myproject/myprojectenv/bin/gunicorn’", "rc":2 } do_tutorial.yml — – hosts: DigitialOceanExample become: …

Total answers: 2

Ansible error: AttributeError: module 'platform' has no attribute 'dist'

Ansible error: AttributeError: module 'platform' has no attribute 'dist' Question: I want to add group in remote machine via ansible playbook and i get error. This is my code from playbook: – name: Ensure group for deploy_user exists become: yes group: name: “{{ deploy_user }}” state: present and this is error what I get: fatal: …

Total answers: 2

Ansible is using wrong version of Python

Ansible is using wrong version of Python Question: I have been dealing with this issue for a couple of days now. I am running ansible on a raspberry pi. I have made Python3.7 the default version of Python. Apparently Ansible wants to use Python 2.7. I have added Version 3.7 in the vars in the …

Total answers: 3

Ansible weird error : The error was: 'str object' has no attribute 'ip'

Ansible weird error : The error was: 'str object' has no attribute 'ip' Question: I have a very strange problem with an Ansible playbook. I use ansible with a Flask API, so I use ansible-runner to pass my variables to my playbook. My playbook is just a debug of my dictionary and its ip attribute: …

Total answers: 2

Ansible – Vmware guest – No module named requests

Ansible – Vmware guest – No module named requests Question: I’m playing around with ansible, I came over the vmware guest module which allows snapshot operation. However, I’m facing some issues. My default python interpreter is Python 3.6.9 i.e if I enter python in my Ubuntu 18.04 machine, Python 3.6.9 is started. Now to the …

Total answers: 2

Ansible append dict results for all hosts

Ansible append dict results for all hosts Question: I am attempting to use Ansible to send a command to several hosts that returns a dict. I then want to append the the dict results of each host to accumulate the results of all the hosts. Finally, I want to print the dict of accumulated results …

Total answers: 2

Cannot run ansible on RHEL 7 – Paramiko is not installed

Cannot run ansible on RHEL 7 – Paramiko is not installed Question: I have a server running RHEL 7, and I have installed ansible but cannot run a playbook with error saying paramiko is not installed. I have verified that paramiko is installed and also tried to install paramiko using pip but still does not …

Total answers: 3

Ansible – how to use selectattr with yaml of different keys

Ansible – how to use selectattr with yaml of different keys Question: im pulling my hairs trying to do a simple thing (i thought it should be easy) with parsing a yaml and filtering for some key in Ansible. My yaml file looks like this: — – vm: “vm1” ip: 10.10.10.1 – vm: “vm2” ip: …

Total answers: 2

How to use Ansible module 'wait_for' together with 'loop'?

How to use Ansible module 'wait_for' together with 'loop'? Question: In Ansible 2.7.11 and wanted to use the module waif_for together with loops for connection test to my System Center Operations Manager (SCOM) servers. Currently I’m using a task – name: "Test connection to SCOM_MGMT_SRV_PROD: {{ SCOM_MGMT_SRV_PROD }}" wait_for: host: "{{ item }}" port: "{{ …

Total answers: 1