There is a lot to say here ![]()
I can“t be root
Thatās an important distinction here, though you might not need it if your CI user is in local ādockerā group on remote node and doesnāt need to write on root-owned parts of your filesystem.
Iām thinking you might as well copy your wars directly in your Wildfly container and avoid using volumes / mounts altogether.
From your screenshot:
-
You use ācommandā module to execute ansible locally on what seems to be your Wildfy remote host to copy local files to your Wildfly server. Please donāt do that
. I donāt know where you run your command from but itās becoming a bit confusing, and will surely also induce weird behaviors, which will be harder to troubleshoot.
Iām guessing you do that because you donāt have your wars files locally, though in the end the command will be run from your Jenkins pipeline, so on the same node, in the same workspace.
Thatās still not the way to go, but it could be more efficient this way:ansible -i /etc/ansible/hosts.yml wildfly -m command -a 'ansible -c local localhost -m copy -a...', or better:ansible -i /etc/ansible/hosts.yml wildfly -m command -a 'mv <srcFiles> <dstFolder>/', or use a playbook like this instead:- hosts: wildfly gather_facts: false tasks: - name: Synchronize folders locally ansible.posix.synchronize: src: <srcPathOnRemoteHost> dest: <destPathOnRemoteHost> delegate_to: wildfly # Then perhaps delete files in src directory; synchronize module might even have a paramater for that, I don't knowAnd run it with:
ansible-playbook -i /etc/ansible/hosts.yml -l wildfly <yourPlaybookPath> -
I donāt understand how youāre running a second command without a commands separator or operator (still in your first
ansible -m commandcommand). And I realize now there is a second task I havenāt put in my playbook example above. Oh well⦠-
I see you can run
sudo docker cpso it seems you have sudo permissions to rundockeror full root access throughsudo, though you said you didnāt. No biggie, just wondering. -
Error message about ssh password is misleading; I think you just need to either connect through ssh manually to this host prior, add his hostkeys manually or disable hostkeys checking in Ansible config altogether (not best practice, but hey !). See a post I made on another thread earlier tonight on this: Headless Ansible - #5 by ptn
I will have to study a lot docker, yaml, ansible, scripts, arameo language, german language, chinese language and UFO language⦠hahahahahaha.
I love your quirkiness haha !
Itās getting late here (and Iām getting really hungry), so please allow me one day or two (or more depending on whatās on my plate) and Iāll get back to you with an example playbook you could adapt to your needs.
Have a nice evening !