Git Product home page Git Product logo

ansible-playbook-shim's Introduction

Specializing in SRE/DevOps, Project management, Mobile, Microservices, and Backend systems. Providing end-to-end IT solutions and full-stack development services.

If you need support in the related fields for your project, I'm more than willing to provide assistance or join your tech team. B2B contracting is a viable option.

DevOps Engineering
Mobile Development
Backend

ansible-playbook-shim's People

Contributors

rivaros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

40a gtback

ansible-playbook-shim's Issues

Throws exception when attempting to provision via vagrant

==> default: Running provisioner: ansible...
"Windows Ansible Shim in Action..."

Parameters received: --user=vagrant --connection=ssh --timeout=30 --limit=default --inventory-file=C:/projects/myProject/.vagrant/provisioners/ansible/inventory playbook.yml
cp: cannot create regular file ΓÇÿ/home/SenG/.ssh/vagrant/default/private_keyΓÇÖ: Permission denied

PLAY [all] ********************************************************************

GATHERING FACTS ***************************************************************
2 [main] python2.7 9136 child_info_fork::abort: address space needed by '_speedups.dll' (0x510000) is already occupied
2 [main] python2.7 5952 child_info_fork::abort: address space needed by '_speedups.dll' (0x510000) is already occupied
fatal: [default] => Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/ansible/runner/init.py", line 586, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/usr/lib/python2.7/site-packages/ansible/runner/init.py", line 789, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/usr/lib/python2.7/site-packages/ansible/runner/init.py", line 1036, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
File "/usr/lib/python2.7/site-packages/ansible/runner/action_plugins/normal.py", line 62, in run
return self.runner._execute_module(conn, tmp, module_name, module_args, inject=inject, complex_args=complex_args)
File "/usr/lib/python2.7/site-packages/ansible/runner/init.py", line 551, in _execute_module
res = self._low_level_exec_command(conn, cmd, tmp, become=self.become, sudoable=sudoable, in_data=in_data)
File "/usr/lib/python2.7/site-packages/ansible/runner/init.py", line 1174, in _low_level_exec_command
in_data=in_data)
File "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/ssh.py", line 306, in exec_command
(p, stdin) = self._run(ssh_cmd, in_data)
File "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/ssh.py", line 124, in _run
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1223, in _execute_child
self.pid = os.fork()
OSError: [Errno 11] Resource temporarily unavailable

TASK: [update apt cache] ******************************************************
FATAL: no hosts matched or all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/home/SenG/playbook.retry

default : ok=0 changed=0 unreachable=1 failed=0

Inventory path issues after upgrading to Ansible 2

I'm not sure if this is an issue with the shim itself, or is an inherent issue in Ansible 2 (or even something specific to my environment). It could even be a Cygwin issue. I am still running Vagrant 1.7.4, but according to a co-worker, upgrading to Vagrant 1.8.1 doesn't fix the issue.

After upgrading to Ansible 2.0.0.2, my plays were suddenly not getting run; instead, I was seeing messages like:

[WARNING]: provided hosts list is empty, only localhost is available

and

PLAY [<name of play>] **********************************************
skipping: no hosts matched

As I looked into this, I realized that Ansible, running in Cygwin, was looking for a file using its Windows file path:

--inventory-file=C:/path/to/code/.vagrant/provisioners/ansible/inventory

I was able to work around the issue with the following change (replacing C: with /cygdrive/c):

diff --git a/ansible-playbook-shim.sh b/ansible-playbook-shim.sh
index 9bf7804..5968d77 100755
--- a/ansible-playbook-shim.sh
+++ b/ansible-playbook-shim.sh
@@ -36,6 +36,8 @@ ANSIBLE_SSH_ARGS=`echo $ANSIBLE_SSH_ARGS | sed -E "s|-o ControlPersist=([^ ]*)||
 export ANSIBLE_SSH_ARGS=$ANSIBLE_SSH_ARGS

 # Finally run ansible-playbook with original parameters
-ansible-playbook $@
+ARGS=`echo $@ | sed -E 's!C:!/cygdrive/c!'`
+echo "New Args: " $ARGS
+ansible-playbook $ARGS

This may not be the optimal solution (for example, if the inventory is not on the C: drive), and could only be happening because of some aspect of my environment, but wanted to at least see what you thought. I also find it strange that, even with the original version of the shim (without the modification above), Ansible 1.9.4 runs my playbook just fine, both before and after the modification to the shim; it doesn't seem to care either way between C: and /cygdrive/c

In any event, I wanted to share my workaround in case anyone else had the same problem, and see if there's a general solution the shim could use.

Call to zsh fails with ansible.extra_vars in Json format

Quite a specific scenario, but ansible vagrant allows you to configure certain additional args in a Json format like that:

d.vm.provision :ansible do |ansible|
ansible.playbook = 'my-playbook.yml'
ansible.extra_vars = {
some_var: "a long list with white space",
some_other_var: "value"
}
end

I have worked around this by adding those lines to the ugly quotation block, but don't know, whether this is a solves-all-problems solution:

set v_params=%v_params:{\\\"=\"`{\\\"%
set v_params=%v_params:\\\"}=\\\"}`\"%

Any better ideas on that one?

Cannot create regular file upon "vagrant provision"

I'm getting the following error when running vagrant provision command.

==> default: Running provisioner: ansible...
"Windows Ansible Shim in Action..."
Parameters received: --user=vagrant --connection=ssh --timeout=30 --limit=default --inventory-file=C:/projects/VirtualPups/.vagrant/provisioners/ansible/inventory playbook.yml
cp: cannot create regular file ΓÇÿ/home/SenG/.ssh/vagrant/default/private_keyΓÇÖ: Permission denied

PLAY [all] ********************************************************************

GATHERING FACTS ***************************************************************
ok: [default]

TASK: [update apt cache] ******************************************************
ok: [default]

TASK: [install apache] ********************************************************
ok: [default]

TASK: [install mysql] *********************************************************
ok: [default]

TASK: [install php] ***********************************************************
ok: [default]

PLAY RECAP ********************************************************************
default : ok=5 changed=0 unreachable=0 failed=0

To my surprise, it pass through ansible and execute the tasks, despite being this error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.