Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible-playbook is a little inconsistent #85

Open
pfuntner opened this issue Oct 18, 2020 · 0 comments
Open

ansible-playbook is a little inconsistent #85

pfuntner opened this issue Oct 18, 2020 · 0 comments

Comments

@pfuntner
Copy link
Owner

After working on #84, I noticed the ansible-playbook is a little inconsistent about the status of tasks on a node:

$ ansible-tasks < install-toys.txt 
Task type  Role  Task                                                   Item     aws-amazon1  aws-amazon2  aws-rh8
task             Gathering Facts                                                 ok           ok           ok
task             Query peon home directory                                       changed      changed      changed
task             Capture peon home directory                                     ok           ok           ok
task             Display peon home directory                                     ok           ok           ok
task             Install packages                                       python3  failed       changed      changed
task             Install packages                                       git      changed      changed      changed
task             Create /home/ec2-user/repos directory                                        changed      changed
task             Test for /home/ec2-user/repos/toys directory                                 changed      changed
task             Clone toys repository                                                        changed      changed
task             Create /home/ec2-user/bin symlink                                            changed      changed
task             Test for /home/ec2-user/.bash_profile                                        ok           ok
task             Use /home/ec2-user/.bash_profile                                             ok           ok
task             Test for /home/ec2-user/.bash_login                                          skipping     skipping
task             Use /home/ec2-user/.bash_login                                               skipping     skipping
task             Test for toys changes to /home/ec2-user/.bash_profile                        changed      changed
task             Make changes to /home/ec2-user/.bash_profile                                 changed      changed
task             Make changes to /home/ec2-user/.bashrc                                       fatal        fatal
2020-10-18 10:42:01,721 WARNING /home/mrbruno/bin/ansible-tasks:142 Ansible playbooks have ended
$ grep ^fa install-toys.txt 
failed: [aws-amazon1] (item=python3) => {"ansible_loop_var": "item", "changed": false, "item": "python3", "msg": "No package matching 'python3' found available, installed or updated", "rc": 126, "results": ["No package matching 'python3' found available, installed or updated"]}
fatal: [aws-amazon2]: FAILED! => {"changed": true, "cmd": "cat '/home/ec2-user/repos/toys/misc/.bash_rc' >> '/home/ec2-user/.bashrc'", "delta": "0:00:00.003764", "end": "2020-10-18 13:42:04.663519", "msg": "non-zero return code", "rc": 1, "start": "2020-10-18 13:42:04.659755", "stderr": "cat: /home/ec2-user/repos/toys/misc/.bash_rc: No such file or directory", "stderr_lines": ["cat: /home/ec2-user/repos/toys/misc/.bash_rc: No such file or directory"], "stdout": "", "stdout_lines": []}
fatal: [aws-rh8]: FAILED! => {"changed": true, "cmd": "cat '/home/ec2-user/repos/toys/misc/.bash_rc' >> '/home/ec2-user/.bashrc'", "delta": "0:00:00.005289", "end": "2020-10-18 13:42:04.813624", "msg": "non-zero return code", "rc": 1, "start": "2020-10-18 13:42:04.808335", "stderr": "cat: /home/ec2-user/repos/toys/misc/.bash_rc: No such file or directory", "stderr_lines": ["cat: /home/ec2-user/repos/toys/misc/.bash_rc: No such file or directory"], "stdout": "", "stdout_lines": []}
$ 

This is not really a bug in my script but something I might want to fix to adapt to ansible-playbook. It should be an easy fix to normalize the status to fatal or failed... or maybe something else? I don't think there's really a distinction so there's no reason for them to be different. On the other hand, If I change the status, could that confuse things if I try to correlate the output of ansible-tasks back with the original input file? I don't think I usually do that but it's possible that changing the status could become problematic.

I'm using Ansible 2.9.6 and here's the output file: install-toys.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant