Created
January 22, 2023 10:11
-
-
Save meisterluk/348571e59727de74b69f6f2c8f12613b to your computer and use it in GitHub Desktop.
I put many efforts into getting ansible-runner working. It just does not work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The status file: | |
import ansible # tested with 6.7.0 | |
import ansible_runner # tested with 2.3.1 | |
[…] | |
r = ansible_runner.run( | |
private_data_dir="ansible/web", | |
playbook='../playbook.yml', | |
inventory=inv_file, | |
host_pattern=[host_pattern], | |
limit=host_pattern, | |
role='status', | |
tags=['status'], | |
verbosity=verbosity | |
) | |
[…] | |
with host_pattern=["www"] | |
meisterluk@euler ~/Labortablo/proj_ansibilize_www/src % find ansible | |
ansible | |
ansible/web | |
ansible/web/roles | |
ansible/web/roles/deploy_web | |
ansible/web/roles/deploy_web/tasks | |
ansible/web/roles/deploy_web/tasks/main.yml | |
ansible/web/roles/status | |
ansible/web/roles/status/tasks | |
ansible/web/roles/status/tasks/main.yml | |
ansible/web/roles/status/files | |
ansible/web/roles/status/files/status_print.sh | |
ansible/web/playbook.yml | |
ansible/web/project | |
ansible/web/project/main.json | |
meisterluk@euler ~/Labortablo/proj_ansibilize_www/src % ./status --log-level DEBUG www | |
2023-01-22 11:04:07,283,DEBUG: start at 2023-01-22T10:04:07.283922 UTC | |
2023-01-22 11:04:07,284,DEBUG: host_pattern = 'www' | |
2023-01-22 11:04:07,284,DEBUG: inv_file = '/home/meisterluk/infrastructure/ansible-setup/inventory.yml' | |
2023-01-22 11:04:07,284,DEBUG: project_dir = '../ansible/web/' | |
2023-01-22 11:04:07,284,DEBUG: playbook_filepath = '../ansible/web/playbook.yml' | |
ansible-playbook [core 2.13.7] | |
config file = /home/meisterluk/infrastructure/ansible-setup/ansible.cfg | |
configured module search path = ['/home/meisterluk/infrastructure/ansible-setup/ansible-modules'] | |
ansible python module location = /home/meisterluk/Labortablo/proj_ansibilize_www/src/venv/lib/python3.8/site-packages/ansible | |
ansible collection location = /home/meisterluk/.ansible/collections:/usr/share/ansible/collections | |
executable location = /home/meisterluk/Labortablo/proj_ansibilize_www/src/venv/bin/ansible-playbook | |
python version = 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0] | |
jinja version = 3.1.2 | |
libyaml = True | |
Using /home/meisterluk/infrastructure/ansible-setup/ansible.cfg as config file | |
ERROR! the playbook: ansible/web/project/main.json could not be found | |
2023-01-22 11:04:07,878,INFO: Finished playbook … | |
exitcode of playbook: 1 failed | |
2023-01-22 11:04:07,882,DEBUG: end at 2023-01-22T10:04:07.882458 UTC | |
meisterluk@euler ~/Labortablo/proj_ansibilize_www/src % ls -la ansible/web/project/main.json | |
-rw-r--r-- 1 meisterluk meisterluk 49 Jan 22 10:46 ansible/web/project/main.json | |
meisterluk@euler ~/Labortablo/proj_ansibilize_www/src % cat ansible/web/project/main.json | |
[{"hosts": "all", "roles": [{"name": "status"}]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment