2016-06-08 20:59:47 +00:00
|
|
|
require_relative "../facts"
|
|
|
|
require_relative "../pip/pip"
|
2015-12-07 14:44:20 +00:00
|
|
|
|
|
|
|
module VagrantPlugins
|
|
|
|
module Ansible
|
|
|
|
module Cap
|
|
|
|
module Guest
|
|
|
|
module Fedora
|
|
|
|
module AnsibleInstall
|
|
|
|
|
2017-01-06 13:19:44 +00:00
|
|
|
def self.ansible_install(machine, install_mode, ansible_version, pip_args)
|
ansible_local: Add the :pip_args_only install mode
With the introduction of `pip_args` option, you can easily extend the
`:pip` installation mode behaviour. But some interesting/advanced usages
are still not possible because of the auto-generated parts ("ansible"
package, version selection, and the `--upgrade` flag).
By adding this "pip_args_only" install mode, it will be for instance
possible to:
- install unofficial releases, like release candidates published at
https://releases.ansible.com/
- install more pip packages (e.g. via a `requirements.txt` file), with
hash validation, etc.
Note that there is no config validation that requires `pip_args` option
to be defined when the :pip_args_only mode is selected. This would be
more elegant, and user friendly to raise a configuration error, but this
can wait. At least, running with an empty `pip_args` won't lead to any
command crash, since the rather dummy "pip install" shows an helper
notice and terminates with a zero (0) exit code.
This change is thought as a complement to the changes originally
proposed in pull request GH-8170.
2017-03-23 22:10:56 +00:00
|
|
|
case install_mode
|
|
|
|
when :pip
|
2016-06-08 20:59:47 +00:00
|
|
|
pip_setup machine
|
ansible_local: Add the :pip_args_only install mode
With the introduction of `pip_args` option, you can easily extend the
`:pip` installation mode behaviour. But some interesting/advanced usages
are still not possible because of the auto-generated parts ("ansible"
package, version selection, and the `--upgrade` flag).
By adding this "pip_args_only" install mode, it will be for instance
possible to:
- install unofficial releases, like release candidates published at
https://releases.ansible.com/
- install more pip packages (e.g. via a `requirements.txt` file), with
hash validation, etc.
Note that there is no config validation that requires `pip_args` option
to be defined when the :pip_args_only mode is selected. This would be
more elegant, and user friendly to raise a configuration error, but this
can wait. At least, running with an empty `pip_args` won't lead to any
command crash, since the rather dummy "pip install" shows an helper
notice and terminates with a zero (0) exit code.
This change is thought as a complement to the changes originally
proposed in pull request GH-8170.
2017-03-23 22:10:56 +00:00
|
|
|
Pip::pip_install machine, "ansible", ansible_version, pip_args, true
|
|
|
|
when :pip_args_only
|
|
|
|
pip_setup machine
|
|
|
|
Pip::pip_install machine, "", "", pip_args, false
|
2015-12-07 14:44:20 +00:00
|
|
|
else
|
ansible_local: Add the :pip_args_only install mode
With the introduction of `pip_args` option, you can easily extend the
`:pip` installation mode behaviour. But some interesting/advanced usages
are still not possible because of the auto-generated parts ("ansible"
package, version selection, and the `--upgrade` flag).
By adding this "pip_args_only" install mode, it will be for instance
possible to:
- install unofficial releases, like release candidates published at
https://releases.ansible.com/
- install more pip packages (e.g. via a `requirements.txt` file), with
hash validation, etc.
Note that there is no config validation that requires `pip_args` option
to be defined when the :pip_args_only mode is selected. This would be
more elegant, and user friendly to raise a configuration error, but this
can wait. At least, running with an empty `pip_args` won't lead to any
command crash, since the rather dummy "pip install" shows an helper
notice and terminates with a zero (0) exit code.
This change is thought as a complement to the changes originally
proposed in pull request GH-8170.
2017-03-23 22:10:56 +00:00
|
|
|
rpm_package_manager = Facts::rpm_package_manager(machine)
|
|
|
|
|
2016-06-09 17:16:47 +00:00
|
|
|
machine.communicate.sudo "#{rpm_package_manager} -y install ansible"
|
2015-12-07 14:44:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-06-08 20:59:47 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def self.pip_setup(machine)
|
2016-06-09 17:16:47 +00:00
|
|
|
rpm_package_manager = Facts::rpm_package_manager(machine)
|
|
|
|
|
|
|
|
machine.communicate.sudo "#{rpm_package_manager} install -y curl gcc gmp-devel libffi-devel openssl-devel python-crypto python-devel python-dnf python-setuptools redhat-rpm-config"
|
2016-06-08 20:59:47 +00:00
|
|
|
Pip::get_pip machine
|
2015-12-07 14:44:20 +00:00
|
|
|
end
|
2015-12-07 21:30:13 +00:00
|
|
|
|
2015-12-07 14:44:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|