Is that means ansible modules are in same version with ansible
Ansible modules - these modules ship with ansible
If not then how to check which version of ansible modules I have?
Q: Are ansible modules the same version with ansible?
A: Looking at the ansible repository -> tag stable-v2.0.
https://github.com/ansible/ansible/tree/stable-2.0/lib/ansible/modules
Since ansible/modules/core is a submodule-reference to the ansible-modules repository found here. This means that when an ansible developer do a git clone --recursive to checkout the entire set of code, git will checkout codes from ansible and ansible-modules repositories to make up the "entire set of code".
So when a developer goes on to build the binary from the full ansible source code, I would assume that only one distinct version number is given to it.
Therefore, short answer is; yes. They share the same version number.
There's 99% probability that you have it the same version as Ansible "kernel", unless you installed Ansible from sources and updated modules subtrees manually.
ansible-modules-core and ansible-modules-extras were split from main ansible repo for some time, but later merged again. You can read about it here.
But Ansible packages has been always released as self-contained, so if your modules' versions are the same as Ansible version in ansible --version command.
Related
Our CI pipeline publishes wheels for branches that have a version of
<base version>-dev<timestamp>+<branch name>.p<pipeline id>
So if I am working on cool-stuff on in the xyzzy branch, it might upload a wheel for version 1.2.3.dev202211221111+xyzzy.p1234
Somebody else, working in the foobar branch, might cause 1.2.3.dev202211221115+foobar.p1235 to be created.
How can I get pip to install the latest version from the xyzzy branch? I tried pip install cool-stuff>1.2.3.dev*+xyzzy but it complained that it could not find a matching version (even though the available versions that it listed included a +xyzzy tag.)
pip install cool-stuff==1.2.3.dev202211221111+xyzzy.p1234 did work, but I would prefer not have have to update the time stamp and pipeline number each time. I am hoping to put cool-stuff >= <magic> in my config file and just run pip install -e . whenever I need new dependencies.
What format do I need to use here?
As far as I know, it is not possible. I can not think of a workable solution that would be based on the version string only. The "local" part of the version string (in other words the part after the plus sign +) can not be used to differentiate between two releases as you intend to.
If I were in your situation, I think I would investigate a solution where the CI/CD pipelines generate distributions with a name customized according to the git branch. For example in your case the pipelines should generate wheels for Library-foobar or Library-xyzzy, depending on what branch is currently being worked on (while still keeping the same top-level import names of course). This assumes that you can customize your pipelines and processes deeply enough to support such a workflow.
I'm running Ansible version 2.9.14 and I've already downloaded the "cisco.ios" Ansible collection. However, when I look in my directory, "ansible_collections/cisco/ios/plugins/modules" I don't seem to have a .py file for ios_ospf_interfaces. Consequently when I include a task in a playbook that references this module the task produces an error.
I tried to install the cisco.ios collection again, but my system reported it already had this collection and didn't do anything further. So how can I get this particular module on my system?
Thanks!
Existing Ansible Modules On My System
(credit for this answer goes to mdaniel)
When using the standard command, "ansible-galaxy collection install cisco.ios" it's possible that you may not receive the latest version of this collection.
In this instance, the version of the collection that was installed on my system was 1.1.0 and yet to obtain the "ios_ospf_interfaces" module I needed 1.2.0
To verify the current version of the cisco.ios module the command is:
ansible-galaxy collection install -vv cisco.ios:==1.2.0
If the output displays that you are running an earlier version of this collection, repeat the command above but add the argument, "--force" at the end to force it to update to version 1.2.0
I am updating my CentOS role to patch systems after Frozen repos have been configured and non-Frozen repos are removed. I am finding that, if use the logic below, it restores the CentOS repos after ansible already removed them:
- name: Patch the System
yum:
name: '*'
update_cache: yes
state: latest
If I remove the task above, the CentOS repos don't regenerate. What am I missing? Is there additional logic or a more efficient way to patch systems?
Resolved issue by breaking out "find and removing non-frozen repo files" into separate task file that is called unconditional before patching and conditional after patching (when task reports a change)
What this does is that it checks if there are updates available (it is comparable with apt-get update) and then install/updates all(*) packages to the latest version
I have found this DNSimple ansible module:
http://docs.ansible.com/ansible/dnsimple_module.html
but can not find anywhere on that page to download and install it? How do I go about downloading and installing ansible modules like this. Thanks.
The accepted answer solved the questioner's problem but didn't address the broader scope of the question.
How to install an Ansible module? The documentation is currently vague as to how to achieve this simple requirement!
An excellent general guide to writing modules (I've no connection to the author) can be found here.
The quickest way is to simply have a folder called library/ in the same folder as your playbook. Inside this folder, place the python script for the Ansible Module. You should now have a corresponding task available to your playbook.
If you want to share your module across multiple projects, then you can add an entry to /etc/ansible/ansible.cfg pointing to a shared library location, eg:
library = /usr/share/ansible/library
The module itself is part of ansible since version 1.6 (as stated here). To use it, you need to have dnsimple on your host machine (also stated in the above description). Install it with sudo pip install dnsimple
It is important to know that base ansible modules are not installed by default on devel version, which is the default installed version when you build from source.
Only few modules are present for developpment purpose.
So when you'll run your playbook it'll complain about not found module with following error message
couldn't resolve module/action 'xxx'
If you have no choice but building for source, don't forget to checkout the stable branch to install all basic ansible modules!
When I try to use the Ansible's Composer module and paste the following task into my playbook.yml file I get an error.
playbook.yml
- name: Composer Install Site Dependencies
composer: command=install working_dir=/var/www/html
Error:
ERROR: composer is not a legal parameter in an Ansible task or handler
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
After some investigation I ran "anisble-doc --list" on the command line to see the available modules and "composer" is not listed. I am running Ansible version 1.5.4, do I have to add it separately?
As #user272735 indicated in the comments, this is an unreleased module- it's slated for the 1.6 release, which is under "active development". (admittedly it was originally slated for 1.4) You have a couple of options:
install ansible from the bleeding edge. See "running from source". (obviously, this is scary)
ninja-patch the file into your locally installed tree. (obviously, this is scary)
add the file into your local Ansible repo.
As "developing modules" says, a fourth option is to specify your library path via ANSIBLE_LIBRARY or --module-path. HOWEVER, this overrides your global library/module path. That isn't what you want to do unless you are providing every module.
adding into your repo
I'm assuming your repo is named "ansible" and is set up properly, like this:
ansible/
ansible/roles/
ansible/group_vars/
In that case, simply add a library directory at the top (the 'best practices' discusses this but not in the expected section):
ansible/
ansible/roles/
ansible/group_vars/
ansible/library/
Inside there, add the composer file in there. That makes its path/file the following:
ansible/library/composer
Note it is not composer.py or anything else. Also, it doesn't seem to need the +x bit, so no fussy worries there.
Once you do that, you can run Ansible commands as you'd expect. The composer module will simply be there.