-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to recommended Ansible 2.x arguments with backwards compatible aliases #6570
Comments
This is an attempt to solve #7665. Revert the change applied by f56a6e0 (#12310), as the inventory generated by Vagrant still rely on the legacy `_ssh` setting names for backwards compatibility reasons. See also hashicorp/vagrant#6570
This is an attempt to solve #7665. Revert the change applied by f56a6e0 (#12310), as the inventory generated by Vagrant still rely on the legacy `_ssh` setting names for backwards compatibility reasons. See also hashicorp/vagrant#6570
Issue description updated after #6927 report. |
Changes: - Add "config" unit tests for `ansible_local` (guest) - Share some "config" examples between both ansible provisioners - Move `config_host.rb` specific examples to `config/host.rb` - Add a requirement to "../helpers" in `config/guest.rb` in order to be able to run the related unit tests References: - This is the first part of GH-6633 resolution - This change is a handy prerequisite for GH-6570 Not addressed yet: - FIXME (guest.rb): Some test-double stubs are currently not working as expected, and the related checks are commented out for the moment (no idea why, but this is not urgent to be fixed because of GH-7335 rejection. See also GH-6984) - FIXME (shared.rb): The guest-based config should actually NOT return an error when the extra_vars file cannot be found, but only display a a warning (similarly to the changes done for GH-6764, see 4e451c6)
Changes: - Add "config" unit tests for `ansible_local` (guest) - Share some "config" examples between both ansible provisioners - Move `config_host.rb` specific examples to `config/host.rb` - Add a requirement to "../helpers" in `config/guest.rb` in order to be able to run the related unit tests References: - This is the first part of GH-6633 resolution - This change is a handy prerequisite for GH-6570 Not addressed yet: - FIXME (guest.rb): Some test-double stubs are currently not working as expected, and the related checks are commented out for the moment (no idea why, but this is not urgent to be fixed because of GH-7335 rejection. See also GH-6984) - FIXME (shared.rb): The guest-based config should actually NOT return an error when the extra_vars file cannot be found, but only display a a warning (similarly to the changes done for GH-6763, see 4e451c6)
Changes: - Add "config" unit tests for `ansible_local` (guest) - Share some "config" examples between both ansible provisioners - Move `config_host.rb` specific examples to `config/host.rb` - Add a requirement to "../helpers" in `config/guest.rb` in order to be able to run the related unit tests References: - This is the first part of GH-6633 resolution - This change is a handy prerequisite for GH-6570 Not addressed yet: - FIXME (guest.rb): Some test-double stubs are currently not working as expected, and the related checks are commented out for the moment (no idea why, but this is not urgent to be fixed because of GH-7335 rejection. See also GH-6984) - FIXME (shared.rb): The guest-based config should actually NOT return an error when the extra_vars file cannot be found, but only display a a warning (similarly to the changes done for GH-6763, see 4e451c6)
I confirm that I'll provide a fix for this within the next weeks. The roadmap will be following:
Questions to @chrisroberts:
|
@gildegoma Hi! Yes, feel free to assign me when it's ready for review. The 1.9.0 release will be happening shortly, so I'm going to move this into the 1.9 bucket and will pull it into the 1.9.1 milestone once it's created. |
I'm still seeing Ansible's sudo deprecation error with Vagrant 1.9.1:
|
With this change, it is now possible to get rid of many deprecation messages successively introduced in Ansible 1.9, and 2.0. More interesting, the generated inventory will contain the recommended variable names (e.g. `ansible_host` instead of `ansible_ssh_host`) when the compatibility mode is set to '2.0'. Details: - Add `compatibility_mode` option to control the Ansible parameters format to be used. The value corresponds to the minimal version supported. For the moment, possible values are '1.8' (corresponding to Vagrant's former behaviour) or '2.0'. Note that a dynamic inventory generated in compatibility mode '2.0' is not supported by Ansible 1.x. On the other hand, Ansible 2.x so far supports inventory format generated by the compatibility mode '1.8'. - Add compatibility mode auto-detection, based on the available Ansible version. This is the default behaviour in order to bring a maximum of user friendliness. The drawback of this approach is to let potential compatibility breaking risks, for `ansible` provisioner setups that already integrate Ansible 2.x **AND** rely on the existence of the generated `_ssh` variable names. Thanks to the vagrant warnings (and its release notes), I argue that it is worth to offer auto-detection by default, which offers a sweet transition to most users. - Add `become`, `become_user` and `ask_become_pass` options and their backwards compatible aliases. The legacy options are now deprecated. Note that we intentionally didn't provide a '1.9' compatibility mode, as it would add extra-complexity for practically no added-value. To my knowledge, the Ansible 2.x series haven't introduced yet any major changes or deprecations that would motivate to introduce a higher version compatibility mode (to be confirmed/verified). Resolve GH-6570 Still Pending: - Optimization: Reduce the number of `ansible` command executions. Currently two exec calls will be performed when the compatibility mode auto-detection is enabled (i.e. by default). We could make the provisioner a little bit smarter to only execute `ansible` only once in any situation (by combining "presence" and "version" checks). - User-friendliness: Add better validator on `compatibility_mode` option, and shows a warning or an error instead of the silent fallback on the auto-detection modus. - Test coverage: All the added behaviours are not fully covered yet.
Before this change, only the ansible_local provisioner supported this option (for ansible version requirement, and pip installation). Now, the ansible host-based provisioner can also require a exact ansible version. Resolve #8914 Note: this has been added as part of #6570 resolution, since the introduction of the `compatibility_mode` auto-detection made both provisioners made capable to detect ansible version. Pending: optimize the code to avoid duplicated executions of "ansible --version" command.
The PR #8913 will hopefully soon be merged to resolve the changes requested here. @vagrant-ansible-community: If you're interested in these additions, please have a look at the upcoming documentation. Feedbacks are still welcome, but any "major change" proposal needs to be reported within the next days since the next release is around the corner. Thank you for sharing your thoughts in this thread of the Vagrant mailing list instead of this GitHub issue. |
With this change, it is now possible to get rid of many deprecation messages successively introduced in Ansible 1.9, and 2.0. More interesting, the generated inventory will contain the recommended variable names (e.g. `ansible_host` instead of `ansible_ssh_host`) when the compatibility mode is set to '2.0'. Details: - Add `compatibility_mode` option to control the Ansible parameters format to be used. The value corresponds to the minimal version supported. For the moment, possible values are '1.8' (corresponding to Vagrant's former behaviour) or '2.0'. Note that a dynamic inventory generated in compatibility mode '2.0' is not supported by Ansible 1.x. On the other hand, Ansible 2.x so far supports inventory format generated by the compatibility mode '1.8'. - Add compatibility mode auto-detection, based on the available Ansible version. This is the default behaviour in order to bring a maximum of user friendliness. The drawback of this approach is to let potential compatibility breaking risks, for `ansible` provisioner setups that already integrate Ansible 2.x **AND** rely on the existence of the generated `_ssh` variable names. Thanks to the vagrant warnings (and its release notes), I argue that it is worth to offer auto-detection by default, which offers a sweet transition to most users. - Add `become`, `become_user` and `ask_become_pass` options and their backwards compatible aliases. The legacy options are now deprecated. Note that we intentionally didn't provide a '1.9' compatibility mode, as it would add extra-complexity for practically no added-value. To my knowledge, the Ansible 2.x series haven't introduced yet any major changes or deprecations that would motivate to introduce a higher version compatibility mode (to be confirmed/verified). Resolve GH-6570 Still Pending: - Optimization: Reduce the number of `ansible` command executions. Currently two exec calls will be performed when the compatibility mode auto-detection is enabled (i.e. by default). We could make the provisioner a little bit smarter to only execute `ansible` only once in any situation (by combining "presence" and "version" checks). - User-friendliness: Add better validator on `compatibility_mode` option, and shows a warning or an error instead of the silent fallback on the auto-detection modus. - Test coverage: All the added behaviours are not fully covered yet.
Before this change, only the ansible_local provisioner supported this option (for ansible version requirement, and pip installation). Now, the ansible host-based provisioner can also require a exact ansible version. Resolve #8914 Note: this has been added as part of #6570 resolution, since the introduction of the `compatibility_mode` auto-detection made both provisioners made capable to detect ansible version. Pending: optimize the code to avoid duplicated executions of "ansible --version" command.
With this change, it is now possible to get rid of many deprecation messages successively introduced in Ansible 1.9, and 2.0. More interesting, the generated inventory will contain the recommended variable names (e.g. `ansible_host` instead of `ansible_ssh_host`) when the compatibility mode is set to '2.0'. Details: - Add `compatibility_mode` option to control the Ansible parameters format to be used. The value corresponds to the minimal version supported. For the moment, possible values are '1.8' (corresponding to Vagrant's former behaviour) or '2.0'. Note that a dynamic inventory generated in compatibility mode '2.0' is not supported by Ansible 1.x. On the other hand, Ansible 2.x so far supports inventory format generated by the compatibility mode '1.8'. - Add compatibility mode auto-detection, based on the available Ansible version. This is the default behaviour in order to bring a maximum of user friendliness. The drawback of this approach is to let potential compatibility breaking risks, for `ansible` provisioner setups that already integrate Ansible 2.x **AND** rely on the existence of the generated `_ssh` variable names. Thanks to the vagrant warnings (and its release notes), I argue that it is worth to offer auto-detection by default, which offers a sweet transition to most users. - Add `become`, `become_user` and `ask_become_pass` options and their backwards compatible aliases. The legacy options are now deprecated. Note that we intentionally didn't provide a '1.9' compatibility mode, as it would add extra-complexity for practically no added-value. To my knowledge, the Ansible 2.x series haven't introduced yet any major changes or deprecations that would motivate to introduce a higher version compatibility mode (to be confirmed/verified). Resolve hashicorpGH-6570 Still Pending: - Optimization: Reduce the number of `ansible` command executions. Currently two exec calls will be performed when the compatibility mode auto-detection is enabled (i.e. by default). We could make the provisioner a little bit smarter to only execute `ansible` only once in any situation (by combining "presence" and "version" checks). - User-friendliness: Add better validator on `compatibility_mode` option, and shows a warning or an error instead of the silent fallback on the auto-detection modus. - Test coverage: All the added behaviours are not fully covered yet.
Before this change, only the ansible_local provisioner supported this option (for ansible version requirement, and pip installation). Now, the ansible host-based provisioner can also require a exact ansible version. Resolve hashicorp#8914 Note: this has been added as part of hashicorp#6570 resolution, since the introduction of the `compatibility_mode` auto-detection made both provisioners made capable to detect ansible version. Pending: optimize the code to avoid duplicated executions of "ansible --version" command.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
ask_become_pass
(aliased asask_sudo_pass
)become
(aliased assudo
)become_user
(aliased assudo_user
)ansible_user
,ansible_host
andansible_port
)Deprecation warnings should also be activated for all these aliases.
Notes:
ansible_user
) were introduced in Ansible 2.0Open Questions:
ansible_host
instead ofansible_ssh_host
)ansible-1.8
andansible-2.0
Possible Roadmap:
compatibility_level
default value to "ansible-2.0" to encourage users to upgrade.Note: Depending on the situation (ansible 1.9 and 2.x adoption and evolution by the time of releasing Vagrant 1.9), we also could consider introducing the two breaking changes at the same time (i.e. directly in Vagrant 1.9.0)
The text was updated successfully, but these errors were encountered: