[ansible-project] connection: local and delegate_to not working together
Hello Team, I am facing issue while running below playbook from ansible server. Getting error like below. I gave small part of the playbook. The intention to use connection: local is I like to perform few tasks from ansible server and like to perform few task on remote server. Which task I like to perform remote server there am using delegate_to action. It was working fine in anisble 2.9.9 version. After upgraded ansible to 2.9.10 am facing this issue. Not sure it is bug in latest version. Could you please help on this issue. Thanks in advance. TASK [Copy script to remote server] *** fatal: [localhost]: UNREACHABLE! => {"changed": false, "msg": "Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo /home/ansible/.ansible/tmp `\"&& mkdir /home/ansible/.ansible/tmp/ansible-tmp-1597756123.06-13139-115650747168755 && echo ansible-tmp-1597756123.06-13139-115650747168755=\"` echo /home/ansible/.ansible/tmp/ansible-tmp-1597756123.06-13139-115650747168755 `\" ), exited with result 1", "unreachable": true} --- - name : Playbook test hosts: localhost connection: local become_method: sudo tasks: - name: Copy script to remote server copy: src: /oci-playbooks/DBRefresh/files/removedisks.sh dest: /home/ansible/ become: yes delegate_to: 192.168.1.2 -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ac8656e9-066b-4477-b764-36973f24b99ao%40googlegroups.com.
[ansible-project] Ansible: Debug and iteration
Hello Team, I am trying to iteration register value and print that value using debug but I unable to achieve the result which I want to get it. Below is the register value in that I like to get value of "lifecycle_state" using debug. Could you please someone help me on this. Playbook part: - debug: var="{{ item }}" with_items: result_1.volume_attachments Register result: ok: [localhost] => (item=result_1.volume_attachments) => { "ansible_loop_var": "item", "item": "result_1.volume_attachments", "result_1.volume_attachments": [ { "attachment_type": "iscsi", "availability_domain": "x", "chap_secret": null, "chap_username": null, "compartment_id": "xxx", "device": null, "display_name": "x", "id": "xxx", "instance_id": "xx", "ipv4": "x", "iqn": "", "is_pv_encryption_in_transit_enabled": false, "is_read_only": false, "lifecycle_state": "ATTACHED", "port": 3260, "time_created": "", "volume_id": "xxx" } ] } -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/91113efb-7155-4ae1-8445-721b5c8eaff8%40googlegroups.com.
[ansible-project] debug msg ignore other results.
Hello Team, I am iterating register result using debug and loop but it prints other variable result as well how to ignore that one while printing value which I want Below is the sample results. Cloud you please help me on this issues. I just want to print value of "item.invocation.module_args.volume_id" and ignore other results. - debug: msg: "{{ item.invocation.module_args.volume_id }}" register: unused_block with_items: "{{result_1.results}}" when: item.volume_attachments | length == 0 debug result TASK [debug] * skipping: [localhost] => (item={'failed': False, 'ansible_loop_var': u'item', u'volume_attachments': [{u'chap_username': None, u'time_created': u'2019-12-26T09:38:51.785000+00:00', u'is_read_only': False, u'volume_id': u'', u'device': None, u'xxx', u'lifecycle_state': u'ATTACHED', u'availability_domain': u'xx', u'display_name': u'volumeattachment20191226093851', u'compartment_id': u'', u'port': 3260, u'instance_id': u'x', u'iqn': u'x', u'is_pv_encryption_in_transit_enabled': False, u'attachment_type': u'iscsi', u'chap_secret': None, u'ipv4': u'169.254.2.2'}], 'item': u'xxx', u'invocation': {u'module_args': {u'auth_type': u'api_key', u'api_user_key_pass_phrase': None, u'availability_domain': None, u'display_name': None, u'config_profile_name': u'root', u'compartment_id': u'xxx', u'region': None, u'volume_id': u'xxx', u'instance_id': None, u'tenancy': None, u'api_user_key_file': None, u'api_user_fingerprint': None, u'api_user': None, u'config_file_location': u'~/.oci/config', u'volume_attachment_id': None}}, 'changed': False, 'ansible_facts': {u'discovered_interpreter_python': u'/usr/bin/python'}}) ok: [localhost] => (item={'failed': False, 'ansible_loop_var': u'item', u'volume_attachments': [], 'item': u'', u'invocation': {u'module_args': {u'auth_type': u'api_key', u'api_user_key_pass_phrase': None, u'availability_domain': None, u'display_name': None, u'config_profile_name': u'root', u'compartment_id': u'xx', u'region': None, u'volume_id': u'xxx', u'instance_id': None, u'tenancy': None, u'api_user_key_file': None, u'api_user_fingerprint': None, u'api_user': None, u'config_file_location': u'~/.oci/config', u'volume_attachment_id': None}}, 'changed': False}) => { "msg": "xx" } -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1642abc3-e997-4247-b250-fe0ee0aec82d%40googlegroups.com.
Re: [ansible-project] debug msg ignore other results.
Thanks a lot. It is working for me. On Tuesday, January 14, 2020 at 3:03:12 PM UTC+5:30, James Cassell wrote: > > > On Tue, Jan 14, 2020, at 12:48 AM, Jegan A wrote: > > Hello Team, > > > > I am iterating register result using debug and loop but it prints > > other variable result as well how to ignore that one while printing > > value which I want Below is the sample results. Cloud you please help > > me on this issues. I just want to print value of > > "item.invocation.module_args.volume_id" and ignore other results. > > > > > > > > - debug: > > msg: "{{ item.invocation.module_args.volume_id }}" > > register: unused_block > > with_items: "{{result_1.results}}" > > when: item.volume_attachments | length == 0 > > > > > > debug result > > > > TASK [debug] > > > * > > > > skipping: [localhost] => (item={'failed': False, 'ansible_loop_var': > > u'item', u'volume_attachments': [{u'chap_username': None, > > u'time_created': u'2019-12-26T09:38:51.785000+00:00', u'is_read_only': > > False, u'volume_id': u'', u'device': None, u'xxx', > > u'lifecycle_state': u'ATTACHED', u'availability_domain': u'xx', > > u'display_name': u'volumeattachment20191226093851', u'compartment_id': > > u'', u'port': 3260, u'instance_id': > > u'x', u'iqn': u'x', > > u'is_pv_encryption_in_transit_enabled': False, u'attachment_type': > > u'iscsi', u'chap_secret': None, u'ipv4': u'169.254.2.2'}], 'item': > > u'xxx', u'invocation': {u'module_args': > > {u'auth_type': u'api_key', u'api_user_key_pass_phrase': None, > > u'availability_domain': None, u'display_name': None, > > u'config_profile_name': u'root', u'compartment_id': u'xxx', > > u'region': None, u'volume_id': u'xxx', > > u'instance_id': None, u'tenancy': None, u'api_user_key_file': None, > > u'api_user_fingerprint': None, u'api_user': None, > > u'config_file_location': u'~/.oci/config', u'volume_attachment_id': > > None}}, 'changed': False, 'ansible_facts': > > {u'discovered_interpreter_python': u'/usr/bin/python'}}) > > > > ok: [localhost] => (item={'failed': False, 'ansible_loop_var': u'item', > > u'volume_attachments': [], 'item': u'', > > u'invocation': {u'module_args': {u'auth_type': u'api_key', > > u'api_user_key_pass_phrase': None, u'availability_domain': None, > > u'display_name': None, u'config_profile_name': u'root', > > u'compartment_id': u'xx', u'region': None, > > u'volume_id': u'xxx', u'instance_id': > > None, u'tenancy': None, u'api_user_key_file': None, > > u'api_user_fingerprint': None, u'api_user': None, > > u'config_file_location': u'~/.oci/config', u'volume_attachment_id': > > None}}, 'changed': False}) => { > > "msg": "xx" > > } > > > > > > loop_control: > label: "{{ item.invocation.module_args.volume_id }}" > > Or similar. > > V/r, > James Cassell > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f46e6744-4e77-4f23-a5a0-51997c98932e%40googlegroups.com.
[ansible-project] ignore -has no attribute
Hello Team, I am parsing register value using debug and using when condition to print particular matching value. While doing that am getting below error. some of the register value doesn't have "volume_attachments" variable due to that the when condition is failing. I want to ignore this error how can I do it. Could you please help me on this. Thanks in advance. fatal: [localhost]: FAILED! => {"msg": "The conditional check 'item.volume_attachments | length == 0' failed. The error was: error while evaluating conditional (item.volume_attachments | length == 0): 'dict object' has no attribute 'volume_attachments'\n\nThe error appears to be in '/var/lib/home/s': line 33, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- debug:\n ^ here\n"} Regards, Jegan A -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b7353ab1-5a43-4d6d-a510-21d3dba61e1d%40googlegroups.com.
[ansible-project] Skipping plugin
Hello Team, Am getting below warning message while running ansible Ad hoc command. There is no changes made in ansible.cfg file. How to avoid the below warning message. Could you please some one help me on this. [WARNING]: Skipping plugin (/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object [WARNING]: Skipping plugin (/usr/lib/python2.7/site-packages/ansible/plugins/callback/grafana_annotations.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object [WARNING]: Skipping plugin (/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object [WARNING]: Skipping plugin (/usr/lib/python2.7/site-packages/ansible/plugins/callback/nrdp.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object [WARNING]: Skipping plugin (/usr/lib/python2.7/site-packages/ansible/plugins/callback/slack.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object [WARNING]: Skipping plugin (/usr/lib/python2.7/site-packages/ansible/plugins/callback/splunk.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object [WARNING]: Skipping plugin (/usr/lib/python2.7/site-packages/ansible/plugins/callback/sumologic.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fdae4d4c-49c7-43e4-bddf-0dcf16a7feac%40googlegroups.com.
[ansible-project] Re: Skipping plugin
The issue is fixed by myself. One of the recent package install via pip was causing the issue. After removing that package issue got fixed. On Thursday, February 13, 2020 at 4:41:06 PM UTC+5:30, Jegan A wrote: > > Hello Team, > >Am getting below warning message while running ansible Ad hoc > command. There is no changes made in ansible.cfg file. How to avoid the > below warning message. Could you please some one help me on this. > > [WARNING]: Skipping plugin > (/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py) as > it seems to be invalid: > from_buffer() cannot return the address of the raw string within a str or > unicode or bytearray object > > [WARNING]: Skipping plugin > (/usr/lib/python2.7/site-packages/ansible/plugins/callback/grafana_annotations.py) > > as it seems to be > invalid: from_buffer() cannot return the address of the raw string within > a str or unicode or bytearray object > > [WARNING]: Skipping plugin > (/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.py) as > it seems to be invalid: > from_buffer() cannot return the address of the raw string within a str or > unicode or bytearray object > > [WARNING]: Skipping plugin > (/usr/lib/python2.7/site-packages/ansible/plugins/callback/nrdp.py) as it > seems to be invalid: > from_buffer() cannot return the address of the raw string within a str or > unicode or bytearray object > > [WARNING]: Skipping plugin > (/usr/lib/python2.7/site-packages/ansible/plugins/callback/slack.py) as it > seems to be invalid: > from_buffer() cannot return the address of the raw string within a str or > unicode or bytearray object > > [WARNING]: Skipping plugin > (/usr/lib/python2.7/site-packages/ansible/plugins/callback/splunk.py) as it > seems to be invalid: > from_buffer() cannot return the address of the raw string within a str or > unicode or bytearray object > > [WARNING]: Skipping plugin > (/usr/lib/python2.7/site-packages/ansible/plugins/callback/sumologic.py) as > it seems to be invalid: > from_buffer() cannot return the address of the raw string within a str or > unicode or bytearray object > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/39013434-b393-41d0-9728-97eb0c1e2d13%40googlegroups.com.
[ansible-project] Ansible callback
Hello All, Can anyone help me on this. I have requirement that send notify to LogicMonitor if any unexpected results are returned by ansible. I have checked supported callback module there I couldn't find any module for logicmonitor. Please help me one this how can I achieve this. If it can be achieved by writing custom callback plugin please share me good ref links how can write custom callback plugin for this one. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/62f11607-5383-42ae-b395-68a8aa3a167d%40googlegroups.com.