From 97d81b0ba4f396ba68c6b7de1d25f59ff9ddbf57 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 26 Mar 2018 15:46:05 +0530 Subject: [PATCH 1/4] Install python3.6 in centos --- playbooks/roles/common/tasks/redhat_family.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/playbooks/roles/common/tasks/redhat_family.yml b/playbooks/roles/common/tasks/redhat_family.yml index dfde2433..8604c0ae 100644 --- a/playbooks/roles/common/tasks/redhat_family.yml +++ b/playbooks/roles/common/tasks/redhat_family.yml @@ -1,5 +1,12 @@ --- +- name: Install IUS repo for python 3.6 + become: yes + become_user: root + yum: + name: https://centos7.iuscommunity.org/ius-release.rpm + state: present + - name: "Setup prerequisites using yum" become: yes become_user: root @@ -23,6 +30,7 @@ - ntp - openssl-devel - postfix + - python36u - python-devel - python-setuptools - python-pip From 1eed28eadef56eeb2d3be85b33f3427eb1eef1f6 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 26 Mar 2018 16:55:31 +0530 Subject: [PATCH 2/4] Handle python3 version for centos --- playbooks/install.py | 13 +++++++++++++ playbooks/roles/bench/tasks/main.yml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/playbooks/install.py b/playbooks/install.py index fbced0d4..067421bd 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -82,6 +82,14 @@ def install_bench(args): if args.user == 'root': raise Exception('Please run this script as a non-root user with sudo privileges, but without using sudo or pass --user=USER') + # Python executable + if not args.production: + dist_name, dist_version = get_distribution_info() + if dist_name is 'centos': + args.python = 'python3.6' + else: + args.python = 'python3' + # create user if not exists extra_vars = vars(args) extra_vars.update(frappe_user=args.user) @@ -371,6 +379,11 @@ def parse_commandline_args(): parser.add_argument('--admin-password', dest='admin_password', help='Set admin password') parser.add_argument('--bench-name', dest='bench_name', help='Create bench with specified name. Default name is frappe-bench') + # Python interpreter to be used + parser.add_argument('--python', dest='python', default='python', + help=argparse.SUPPRESS + ) + args = parser.parse_args() return args diff --git a/playbooks/roles/bench/tasks/main.yml b/playbooks/roles/bench/tasks/main.yml index 0f2ed3c2..b6230e80 100644 --- a/playbooks/roles/bench/tasks/main.yml +++ b/playbooks/roles/bench/tasks/main.yml @@ -29,7 +29,7 @@ register: bench_stat - name: python3 bench init for develop - command: bench init {{ bench_path }} --frappe-branch {{ branch }} --python python3 + command: bench init {{ bench_path }} --frappe-branch {{ branch }} --python {{ python }} args: creates: "{{ bench_path }}" when: not bench_stat.stat.exists and not production From f37768cef63264ddac6af4138387cb3e9ec2bc67 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 26 Mar 2018 18:26:16 +0530 Subject: [PATCH 3/4] minor fix --- playbooks/install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/install.py b/playbooks/install.py index 067421bd..ec5cc157 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -85,7 +85,7 @@ def install_bench(args): # Python executable if not args.production: dist_name, dist_version = get_distribution_info() - if dist_name is 'centos': + if dist_name=='centos': args.python = 'python3.6' else: args.python = 'python3' From d0303a6a8431f4441296b8268b8f19a698aaa628 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 26 Mar 2018 19:27:14 +0530 Subject: [PATCH 4/4] update ansible version --- playbooks/install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/install.py b/playbooks/install.py index ec5cc157..8abec392 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -59,7 +59,7 @@ def install_bench(args): }) success = run_os_command({ - 'pip': "sudo pip install ansible==2.4.1" + 'pip': "sudo pip install ansible==2.5.0" }) if not success: