Configure the python interpreter based on OS
CentOS has python 2.x installed and Ubuntu 16.04 has python 3.x. Hosts belong to the group centos or ubuntu. Inventory example attached.
This commit is contained in:
parent
5a9646d194
commit
c536dfe3d4
|
@ -6,6 +6,8 @@ group_vars/explorer
|
||||||
group_vars/validator
|
group_vars/validator
|
||||||
group_vars/netstat
|
group_vars/netstat
|
||||||
group_vars/moc
|
group_vars/moc
|
||||||
|
group_vars/ubuntu
|
||||||
|
group_vars/centos
|
||||||
|
|
||||||
roles/bootnode/vars/main.yml
|
roles/bootnode/vars/main.yml
|
||||||
roles/explorer/vars/main.yml
|
roles/explorer/vars/main.yml
|
||||||
|
|
|
@ -5,9 +5,10 @@ Vagrant.configure("2") do |config|
|
||||||
|
|
||||||
servers = [ "validator", "explorer", "moc", "bootnode", "netstat" ]
|
servers = [ "validator", "explorer", "moc", "bootnode", "netstat" ]
|
||||||
|
|
||||||
if ENV["poa_platform"] == "ubuntu"
|
platform_os = ENV["poa_platform"]
|
||||||
|
if platform_os == "ubuntu"
|
||||||
platform = "ubuntu/xenial64"
|
platform = "ubuntu/xenial64"
|
||||||
elsif ENV["poa_platform"] == "centos"
|
elsif platform_os == "centos"
|
||||||
platform = "centos/7"
|
platform = "centos/7"
|
||||||
else
|
else
|
||||||
platform = "ubuntu/xenial64"
|
platform = "ubuntu/xenial64"
|
||||||
|
@ -26,8 +27,9 @@ Vagrant.configure("2") do |config|
|
||||||
"explorer" => ["explorer"],
|
"explorer" => ["explorer"],
|
||||||
"netstat" => ["netstat"],
|
"netstat" => ["netstat"],
|
||||||
"moc" => ["moc"],
|
"moc" => ["moc"],
|
||||||
"bootnode" => ["bootnode"]
|
"bootnode" => ["bootnode"],
|
||||||
}
|
}
|
||||||
|
ansible.groups[platform_os] = [ "validator", "explorer", "netstat", "moc", "bootnode" ]
|
||||||
end
|
end
|
||||||
|
|
||||||
node.vm.provision :shell do |shell|
|
node.vm.provision :shell do |shell|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
access_key: "INSERT KEY HERE"
|
---
|
||||||
secret_key: "INSERT SECRET HERE"
|
ssh_root:
|
||||||
|
- "{{ lookup('file', 'files/admins.pub') }}"
|
||||||
|
|
||||||
awskeypair_name: "keypairname"
|
awskeypair_name: "keypairname"
|
||||||
image: "ami-0b383171"
|
image: "ami-0b383171"
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# CentsOS-specific variables
|
||||||
|
|
||||||
|
ansible_python_interpreter: /usr/bin/python
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Ubuntu-specific variables
|
||||||
|
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
|
@ -9,12 +9,15 @@
|
||||||
# - A hostname/ip can be a member of multiple groups
|
# - A hostname/ip can be a member of multiple groups
|
||||||
|
|
||||||
[bootnode]
|
[bootnode]
|
||||||
1.1.1.1 ansible_user=ubuntu | centos
|
node01.example.com
|
||||||
|
|
||||||
[moc]
|
[moc]
|
||||||
|
node02.example.com
|
||||||
|
|
||||||
[netstat]
|
[netstat]
|
||||||
|
|
||||||
[validator]
|
[validator]
|
||||||
|
node03.example.com
|
||||||
|
|
||||||
[explorer]
|
[explorer]
|
||||||
|
|
||||||
|
@ -24,3 +27,10 @@ moc
|
||||||
netstat
|
netstat
|
||||||
validator
|
validator
|
||||||
explorer
|
explorer
|
||||||
|
|
||||||
|
[centos]
|
||||||
|
node03.example.com
|
||||||
|
|
||||||
|
[ubuntu]
|
||||||
|
node01.example.com
|
||||||
|
node02.example.com
|
||||||
|
|
Loading…
Reference in New Issue