Reputation: 3
I'm fairly new to Ansible but have got a fairly comprehensive playbook for our sites initial setup for new customers or for redeploying a customer site.
Ansible Revision = 2.0.0.2
Host = Ubuntu 16.04 up to date
Remote Host = CentOS 7 up to date from minimal install
The latter is where I'm having an issue, I export out of our SVN repo and this works fine.
name: Export from subversion
subversion: repo=svn+ssh://svnserver/file/path/svn/repo/trunk dest={{site_dir}} username=svn export=True
When I add
name: Export from subversion
subversion: repo=svn+ssh://svnserver/file/path/svn/repo/trunk dest={{site_dir}} username=svn export=True revision={{svn_rev}}
I get this error:
FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1489135585.97-151625467432517/subversion\", line 2194, in \r\n main()\r\n File \"/root/.ansible/tmp/ansible-tmp-1489135585.97-151625467432517/subversion\", line 231, in main\r\n svn.export(force=force)\r\n File \"/root/.ansible/tmp/ansible-tmp-1489135585.97-151625467432517/subversion\", line 149, in export\r\n self._exec(cmd)\r\n File \"/root/.ansible/tmp/ansible-tmp-1489135585.97-151625467432517/subversion\", line 127, in _exec\r\n rc, out, err = self.module.run_command(bits, check_rc)\r\n File \"/root/.ansible/tmp/ansible-tmp-1489135585.97-151625467432517/subversion\", line 2019, in run_command\r\n args = [ os.path.expandvars(os.path.expanduser(x)) for x in args ]\r\n File \"/usr/lib64/python2.7/posixpath.py\", line 261, in expanduser\r\n if not path.startswith('~'):\r\nAttributeError: 'int' object has no attribute 'startswith'\r\n", "msg": "MODULE FAILURE", "parsed": false}
Now if I enter the revision manually save revision=7840
it works as expected.
Also if I debug the variable
debug: msg={{svn_rev}}
It again outputs the correct revision.
Just wondering if anyone could point me in the right direction as I am a little bit stumped at the moment. Is this likely to be a bug with the subversion module?
Upvotes: 0
Views: 388
Reputation: 68559
The module clearly expects a string value, so define svn_rev
as a string:
vars:
svn_rev: "7840"
Or convert it to a string.
You have not specified in the question how you get the value, so you need to follow up yourself.
You might also consider filling an issue or PR on GitHub, because a common sense would be to convert the value inside the module.
Upvotes: 0