Using ansible 2.1.0.0
I’d like to have a role that lists private source control repositories like this in the meta/main.yml:
dependencies:
- src: ‘git+git@mygitlab.example.com:/anisble/myrole.git,v1.0.0’
Is this possible? I got this idea from this post: https://opencredo.com/reusing-ansible-roles-with-private-git-repos-and-dependencies/
When I try this running ansible 2.1.0.0, I get:
ERROR! role definitions must contain a role name
The error appears to have been in ‘/vagrant/roles/mainrole/meta/main.yml’: line 157, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
dependencies:
- src: ‘git+git@mygitlab.example.com:/anisble/myrole.git,v1.0.0’
^ here
This one looks easy to fix. It seems that there is a value started
with a quote, and the YAML parser is expecting to see the line ended
with the same kind of quote. For instance:
when: “ok” in result.stdout
Could be written as:
when: ‘“ok” in result.stdout’
Or equivalently:
when: “‘ok’ in result.stdout”
If I add the extra quotes: (- “src: ‘git+git@mygitlab.example.com:/anisble/myrole.git,v1.0.0’”)
[DEPRECATION WARNING]: The comma separated role spec format, use the
yaml/explicit format instead…
This feature will be removed in a future
release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
ERROR! the role ‘myrole’ was not found in /vagrant/roles:/vagrant:/etc/ansible/roles:/vagrant/roles
When I run it with ansible version 1.9.6 I get:
ERROR: cannot find role in /vagrant/roles/myrole.git or /vagrant/myrole.git or /etc/ansible/roles/myrole.git
I know I can pull these separately with ansible-galaxy install -r requirements.yml, but I’d rather skip that step so I can do this all at once with a single ansible-pull command.
Thanks,
Brian