Browse Source

Python2 trick

Vladimir Smagin 3 weeks 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 @@
1
+[project:children]
2
+project-balancers
3
+project-nodes
4
+
5
+[project-balancers]
6
+project-balancer0 ansible_host=srv-balancer0.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
7
+project-balancer1 ansible_host=srv-balancer1.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
8
+
9
+[project-nodes]
10
+project-node0 ansible_host=srv-node0.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
11
+project-node1 ansible_host=srv-node1.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
12
+project-node2 ansible_host=srv-node2.project.com ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
13
+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 @@
1
+---
2
+- name: Checkout python2
3
+  hosts: project
4
+  vars:
5
+    ansible_python_interpreter: /usr/bin/python3
6
+  roles:
7
+    - python2
8
+
9
+- name: Configure platform
10
+  hosts: project
11
+  roles:
12
+    - system
13
+    - nginx
14
+
15
+- name: Configure balancers
16
+  hosts: project-balancers
17
+  roles:
18
+    - certbot
19
+    - nginx-balancer
20
+
21
+- name: Configure nodes
22
+  hosts: project-nodes
23
+  roles:
24
+    - mongodb
25
+    - nginx-node
26
+    - php-fpm
27
+    - deploy
28
+
29
+

+ 4
- 12
readme.md View File

@@ -1,13 +1,5 @@
1
-# My useful ansible playbooks
1
+# Install required for Ansible python 2.7
2 2
 
3
-Security management:
4
-
5
-- [Centralized SSH keys management](https://git.blindage.org/21h/ansible-library/src/branch/centralized-keys)
6
-
7
-System and monitoring:
8
-
9
-- [Create systemd and upstart scripts](https://git.blindage.org/21h/ansible-library/src/branch/sys-systemd-and-upstart)
10
-
11
-Web deployment:
12
-
13
-- [PHP 7.1 FPM + Nginx](https://git.blindage.org/21h/ansible-library/src/branch/web-nginx-php-fpm7.1)
3
+This playbook shows you a trick to install python 2.7 into fresh created python3-only hosts. 
4
+For example Ubuntu 16.04 or 18.04 doesnt have python2 libs on-board. Look at first task run 
5
+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 @@
1
+---
2
+- name: Install python2
3
+  apt: name=python state=present
4
+
5
+- name: Install python pip
6
+  apt: name=python-pip state=present

Loading…
Cancel
Save