Browse Source

Install Python2 which ansible requires

This is achieved through a command of type `raw` that ansible simply
tells to run it as-is via SSH. With other words, raw commands only
require SSH to be working on a remote machine and are executed as
argument to `ssh <remote-machine> '<raw-cmd>'`.
Gathering facts must be deactivated because it would take place before
`pre_tasks` and fail since /usr/bin/python[2] is probably not available on the
machine.

The solution was shamlessly copied from https://github.com/maqpie/deploy-drone/blob/master/setup-server.yml#L13
remove-logs
Andreas Linz 3 years ago
parent
commit
c9f7f3224f
2 changed files with 8 additions and 4 deletions
  1. +2
    -4
      Vagrantfile
  2. +6
    -0
      playbook.yml

+ 2
- 4
Vagrantfile View File

@ -67,10 +67,8 @@ Vagrant.configure("2") do |config|
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y python
SHELL
#config.vm.provision "shell", inline: <<-SHELL
#SHELL
config.vm.provision "ansible" do |ansible|
ansible.playbook = "vagrant_playbook.yml"

+ 6
- 0
playbook.yml View File

@ -1,5 +1,6 @@
---
- hosts: all
gather_facts: false # see pre_tasks
vars:
user_name: alinz
user_email: admin@klingt.net
@ -22,3 +23,8 @@
- caddy
- klingt.net
- goaccess
pre_tasks:
- name: Setup Python 2.x
become: true
raw: test -e /usr/bin/python2 || (apt -y update && apt install -y python-minimal)
- setup: # gather facts

Loading…
Cancel
Save