[ansible-project] Create action plugin script with two modules
Hi Team, Need some help to develop an action plugin script using two modules. Below is my ansible playbook code: - name: Ensure packages are installed yum: name: - xorg-x11-server* - dhcp - bind - vsftpd - dovecot - samba - squid - net-snmp - ypserv - ypbind - rsh - telnet-server - telnet state: absent async: 86400 #24 hours poll: 0 register: yum_installer - name: Waiting for yum package installation to complete async_status: jid={{ yum_installer.ansible_job_id }} shell: nohup python /opt/ibm/si/saas/ansible/test_neha.py register: console_job_results until: console_job_results.finished retries: 100 Here above in the second task, I am calling two ansible modules at once (shell & async_status) which is giving me the error *ERROR! conflicting action statements: shell, async_status*, so as an alternative I am now trying to develop an action plugin, which can call two ansible modules at once. Now here, async_status module will go on iteration till the job finished, so on each iteration, I want to call the python script. Thats why going with the approach of developing action plugin. Need some help regarding the same Thanks & Regards Neha Singh -- 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/a1a7143d-f34c-47cf-bbd0-28020b64d2d7n%40googlegroups.com.
[ansible-project] AnsibleUndefined in Tower execution
Hi Everyone, I have playbook executed in Ansible server and it is successful but when i execute the same in Tower I am getting 1. AnsibleUndefined, 2. Dict converting to string. I would like to understand what makes a difference and a solution for it. Thank you. Under vars i have defined - vars: failed_list: [] failed_lists: "{{ dict(groups.all| zip(hostvars|dict2items| map(attribute='value.failed_list', default=[]))) }}" failed_hosts: "{{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}" Under 'rescue' section - rescue: - set_fact: failed_list: "{{ failed_list + [ansible_failed_task.name] }}" Below output for: - name: failed_lists | groups all | hostvars|dict2items | attribute='value.failed_list' | dict debug: msg: "{{ dict(groups.all | zip(hostvars| dict2items | map(attribute='value.failed_list', default=[]))) }}" *Result in server: * TASK [failed_lists | groups all | hostvars|dict2items | attribute='value.failed_list' | dict] *** ok: [TestCluster1] => {} MSG: {'TestCluster1': ['Aggregate Information gathering'], 'Cluster1': [], 'Cluster2': [], 'TestCluster2': ['Aggregate Information gathering']} ok: [Cluster1] => {} MSG: {'TestCluster1': ['Aggregate Information gathering'], 'Cluster1': [], 'Cluster2': [], 'TestCluster2': ['Aggregate Information gathering']} ok: [Cluster2] => {} MSG: {'TestCluster1': ['Aggregate Information gathering'], 'Cluster1': [], 'Cluster2': [], 'TestCluster2': ['Aggregate Information gathering']} ok: [TestCluster2] => {} MSG: {'TestCluster1': ['Aggregate Information gathering'], 'Cluster1': [], 'Cluster2': [], 'TestCluster2': ['Aggregate Information gathering']} *Tower output:* TASK [failed_lists | groups all | hostvars|dict2items | attribute='value.failed_list' | dict] *** ok: [Cluster1] => { "msg": "{'Cluster1': AnsibleUndefined, 'Cluster2': *AnsibleUndefined*, 'TestCluster': ['Aggregate Information gathering'], 'TestCluster2': ['Aggregate Information gathering']}" } ok: [Cluster2] => { "msg": "{'Cluster1': AnsibleUndefined, 'Cluster2': *AnsibleUndefined*, 'TestCluster': ['Aggregate Information gathering'], 'TestCluster2': ['Aggregate Information gathering']}" } ok: [TestCluster] => { "msg": "{'Cluster1': AnsibleUndefined, 'Cluster2': AnsibleUndefined, 'TestCluster': ['Aggregate Information gathering'], 'TestCluster2': ['Aggregate Information gathering']}" } ok: [TestCluster2] => { "msg": "{'Cluster1': AnsibleUndefined, 'Cluster2': AnsibleUndefined, 'TestCluster': ['Aggregate Information gathering'], 'TestCluster2': ['Aggregate Information gathering']}" } TASK [print failed_hosts] ** fatal: [Cluster1]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}'. Error was a , original message: Unexpected templating type error occurred on ({{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}): dict2items requires a dictionary, got instead."} fatal: [Cluster2]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}'. Error was a , original message: Unexpected templating type error occurred on ({{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}): dict2items requires a dictionary, got instead."} fatal: [TestCluster]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}'. Error was a , original message: Unexpected templating type error occurred on ({{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}): dict2items requires a dictionary, got instead."} fatal: [TestCluster2]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}'. Error was a , original message: Unexpected templating type error occurred on ({{ failed_lists|dict2items| selectattr('value')| map(attribute='key')|list }}): dict2items requires a dictionary, got instead."} -- 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/CANGEjuXBkcFy6AXHd4o8ESMRE51S9i-o6D02pK_U8APU5w_%2BXQ%40mail.gmail.com.
Re: [ansible-project] version Issue
On Wednesday 29 March 2023 at 14:36:40, kankatala venkatapraveen wrote: > I got the below error while running the playbook for enabling port on AWS > server. could please provide the solution? > Python Module not found: firewalld and its python module are required for > this module,version 0.2.11 or newer required (0.3.9 or newer for offline > operations) The solution is to install firewalld and its python module at the appropriate version level. Antony. -- If you can't find an Open Source solution for it, then it isn't a real problem. Please reply to the list; please *don't* CC me.
[ansible-project] version Issue
I got the below error while running the playbook for enabling port on AWS server. could please provide the solution? Python Module not found: firewalld and its python module are required for this module,version 0.2.11 or newer required (0.3.9 or newer for offline operations) -- 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/b20c5516-bbf9-48f8-9c95-4ac01ade9e0bn%40googlegroups.com.
Re: [ansible-project] ssh-key exchange and root password set
On Wed, 29 Mar 2023 19:56:23 +0900 Prady A wrote: > #ansible-playbook -i inventory ssh_install.yml *-k* > ... avoid the -k option Use *ssh-agent*. https://www.ssh.com/academy/ssh/agent It is a bad practice to *ssh* to root. See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_privilege_escalation.html > password: "{{ 'PLAIN_PASSWORD' | password_hash('sha512') }}" See how to use Ansible vault https://docs.ansible.com/ansible/latest/cli/ansible-vault.html The next option is *passwordstore* https://www.passwordstore.org/ See the Ansible *passwordstore* lookup plugin https://docs.ansible.com/ansible/latest/collections/community/general/passwordstore_lookup.html -- Vladimir Botka -- 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/20230329140245.257f0080%40gmail.com. pgpjzvwp8hxc3.pgp Description: OpenPGP digital signature
[ansible-project] ssh-key exchange and root password set
Hello folks As a new learner, I am trying to copy the ssh pub key to the managed node as below. ssh_install.yml === tasks: - name: Exchange the pub key authorized_key: user: root state: present key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" === Running with below command #ansible-playbook -i inventory ssh_install.yml *-k* It is running without any issue but is there any way to avoid the -k option? I dont want to provide the password for each managed node in the command prompt. Secondly using below task for changing the root password. I will use vault to store PLAIN_PASSWORD. Is there any better method to do it? Kindly advice. - name: passwd change user: name: root password: "{{ 'PLAIN_PASSWORD' | password_hash('sha512') }}" -- 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/CAEuB3AqUA3ME-PdwKi_ugERPPp5OifysPB_UjMGAfpw1Y6eUrA%40mail.gmail.com.