From 972e6c0d87d09cca4397fc8eba0885de04046673 Mon Sep 17 00:00:00 2001 From: Jan Beilicke Date: Wed, 21 Apr 2021 22:44:52 +0200 Subject: [PATCH] Updates Ansible to 3.3.0 --- README.md | 2 +- Vagrantfile | 15 +++++++++++++-- provisioning/playbook.yml | 10 +++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 541bf79..fa5c9cb 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To provide a lightweight experience, the VM uses [XFCE](https://xfce.org/) as a - Docker 19.03.5 - Docker Compose 1.25.0 -- Ansible 2.9.4 +- Ansible 3.3.0 ## Prerequisites diff --git a/Vagrantfile b/Vagrantfile index f330849..643ff47 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -74,9 +74,20 @@ Vagrant.configure(2) do |config| dev.vm.provision "ansible_local" do |ansible| #ansible.verbose = "vvv" ansible.compatibility_mode = "2.0" - ansible.install_mode = "pip" + ansible.install_mode = "pip_args_only" ansible.pip_install_cmd = "sudo apt install -y python3-distutils && curl https://bootstrap.pypa.io/get-pip.py | sudo python3" - ansible.version = "2.10.8" + # The following will not work properly since the split of Ansible into ansible-base (soon ansible-core) + # and the Ansible collections and modules both together resembling Ansible. + # `ansible --version` will yield the ansible-base version and this command is used by ansible_local. + # It is not suitable to figure out which Ansible distribution/bundle was installed. + # To workaround the wrongful mismatch result when installing Ansible through Vagrant, + # we have to leave ansible.version empty/unset and use ansible.pip_args to provide the desired version. + # + # See also: + # - https://www.ansible.com/blog/ansible-3.0.0-qa + # - https://github.com/hashicorp/vagrant/issues/12204 + #ansible.version = "3.3.0" + ansible.pip_args = "ansible==3.3.0" # Will install ansible-base==2.10.8, ansible --version will yield 2.10.8 ansible.playbook = "provisioning/playbook.yml" #ansible.inventory_path = "provisioning/inventory" ansible.galaxy_role_file = "provisioning/requirements.yml" diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml index ad1dd4a..2e6f86e 100644 --- a/provisioning/playbook.yml +++ b/provisioning/playbook.yml @@ -9,7 +9,7 @@ - jotbe.dev_tools vars: - ansible_version: "2.9.4" + ansible_version: "3.3.0" pip_install_packages: - name: docker - name: docker-compose @@ -30,6 +30,10 @@ raw: test -e /usr/bin/pip3 || (apt update && apt install -y --force-yes python3-pip) changed_when: false + - name: Install Ansible + raw: which ansible || pip3 install ansible=={{ ansible_version }} + changed_when: false + tasks: - block: - name: Provide VBoxGuestAdditions patch @@ -42,10 +46,6 @@ ignore_errors: yes when: virtualbox_host_version | default("") == "6.1.18" - - name: Install Ansible - raw: test -e /usr/local/bin/ansible || pip3 install ansible={{ ansible_version }} - changed_when: false - - name: Disable motd-news lineinfile: path: /etc/default/motd-news