ansible-2.x

Not able to execute python3.8 code with ansible

Not able to execute python3.8 code with ansible Question: I have a playbook: — – hosts: all gather_facts: true tasks: – name: test shell: cmd: python /tmp/test.py chdir: /tmp/ async: 150 poll: 5 become: true register: test – debug: msg={{test}} Below is the host file for me: xx.xxx.xxx.xx ansible_ssh_user=xxx ansible_ssh_pass=xxxxxxxxxxxxxxx ansible_sudo_pass=xxxxxxxxxxxxxxx ansible_ssh_common_args=’-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no’ …

Total answers: 1

Ansible – Member not found when using json_modify.py

Ansible – Member not found when using json_modify.py Question: I’m trying to modify the json public_ip_allocation_method value using json_modify.py. But I get the following error: "msg": "member ” not found in {‘name’: ‘Ubuntu915’, ‘private_ip_address’: ‘10.0.0.5’, ‘private_ip_allocation_method’: ‘Dynamic’, ‘primary’: True, ‘load_balancer_backend_address_pools’: None, ‘application_gateway_backend_address_pools’: None, ‘public_ip_address’: ‘/subscriptions/123456/resourceGroups/test-rg/providers/Microsoft.Network/publicIPAddresses/Ubuntu-915-test’, ‘public_ip_allocation_method’: None, ‘application_security_groups’: None}" } Playbook: – name: Get facts …

Total answers: 1

How can I get a list of hosts from an Ansible inventory file?

How can I get a list of hosts from an Ansible inventory file? Question: Is there a way to use the Ansible Python API to get a list of hosts from a given inventory file / group combination? For example, our inventory files are split up by service type: [dev:children] dev_a dev_b [dev_a] my.host.int.abc.com [dev_b] …

Total answers: 6

Unexpected Exception: name 'basestring' is not defined when invoking ansible2

Unexpected Exception: name 'basestring' is not defined when invoking ansible2 Question: I’m trying to execute ansible2 commnads… When I do: ansible-playbook -vvv -i my/inventory my/playbook.yml I get: Unexpected Exception: name ‘basestring’ is not defined the full traceback was: Traceback (most recent call last): File “/usr/local/bin/ansible-playbook”, line 85, in <module> sys.exit(cli.run()) File “/usr/local/lib/python3.4/site-packages/ansible/cli/playbook.py”, line 150, in …

Total answers: 7