Browse Source

Python2 trick

python3_trick
Vladimir Smagin 1 year ago
parent
commit
34b1b80800
4 changed files with 52 additions and 12 deletions
  1. 13
    0
      inventory.ini
  2. 29
    0
      project.yml
  3. 4
    12
      readme.md
  4. 6
    0
      roles/python2/tasks/main.yml

+ 13
- 0
inventory.ini View File

@@ -0,0 +1,13 @@
[project:children]
project-balancers
project-nodes

[project-balancers]
project-balancer0 ansible_host=srv-balancer0.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
project-balancer1 ansible_host=srv-balancer1.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"

[project-nodes]
project-node0 ansible_host=srv-node0.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
project-node1 ansible_host=srv-node1.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
project-node2 ansible_host=srv-node2.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
project-node3 ansible_host=srv-node3.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"

+ 29
- 0
project.yml View File

@@ -0,0 +1,29 @@
---
- name: Checkout python2
hosts: project
vars:
ansible_python_interpreter: /usr/bin/python3
roles:
- python2

- name: Configure platform
hosts: project
roles:
- system
- nginx

- name: Configure balancers
hosts: project-balancers
roles:
- certbot
- nginx-balancer

- name: Configure nodes
hosts: project-nodes
roles:
- mongodb
- nginx-node
- php-fpm
- deploy



+ 4
- 12
readme.md View File

@@ -1,13 +1,5 @@
# My useful ansible playbooks
# Install required for Ansible python 2.7

Security management:

- [Centralized SSH keys management](https://git.blindage.org/21h/ansible-library/src/branch/centralized-keys)

System and monitoring:

- [Create systemd and upstart scripts](https://git.blindage.org/21h/ansible-library/src/branch/sys-systemd-and-upstart)

Web deployment:

- [PHP 7.1 FPM + Nginx](https://git.blindage.org/21h/ansible-library/src/branch/web-nginx-php-fpm7.1)
This playbook shows you a trick to install python 2.7 into fresh created python3-only hosts.
For example Ubuntu 16.04 or 18.04 doesnt have python2 libs on-board. Look at first task run
with addition var to use Python3 for installing Python2 and next tasks with default Ansible interpreter.

+ 6
- 0
roles/python2/tasks/main.yml View File

@@ -0,0 +1,6 @@
---
- name: Install python2
apt: name=python state=present

- name: Install python pip
apt: name=python-pip state=present

Loading…
Cancel
Save