...
cd <to the correct directory where terraformfilelive.tf >
#terraform init ( only the first time, will download provider module )
terraform plan
terraform apply ( type "yes" to confirm )
terraform destroy ( at the end and type "yes" to confirm)
...
ssh-keygen # will create a pair of private key ( id_rsa) and a public key ( id_rsa.pub )
chmod 0600 .ssh/id_rsa # safety reason!!!
#test: ssh localhost
#ssh-copy-id localhost ( or IP@) # copy the public key to ".ssh/authorized_keys"
Code Block |
---|
title | instance.yaml for BMSinstall contrail on AWS |
---|
collapse | true |
---|
|
[centos@centos7_new ~]$ more /tmp/contrail-ansible-deployer/config/instances.yaml
provider_config:
bms:
instances:
bms1:
provider: bms
ip: 192.168.1.100
global_configuration:
CONTAINER_REGISTRY: opencontrailnightly
contrail_configuration:
CONTRAIL_VERSION: latest
|
Code Block |
---|
title | install contrail on AWS |
---|
collapse | true |
---|
|
In the case the installation is done "locally": log into the VM in AWS, and then do the installation from here: the VM AWS
In the case the installation is done "locally": log into the VM in AWS, and then do the installation from here: the VM AWS
--------------------------------------------------------------------------------------------------------------------------------
1- On the Local PC: Terraform >>>> create the VM on AWS ( with the key )
2- # On the Local PC: Ansible push the configuration steps to the VM on AWS >>>> Manually log into the AWS' VM and run the commands
1- Log as "centos" user ( same as the VM on AWS, just make it easier )
2- upload the key on the local PC ( same key as on the VM AWS, make it easier to log into it )
3- # ssh-keygen ( .ssh/id_rsa is the default, passphrase cont... ) # not needed becuase I will use the same key as AWS
ssh-agent bash
ssh-add ~/.ssh/TerraformKeyPair.pem
# ssh-add -l or ssh-add -L #just to check
more .ssh/authorized_keys >>> can see the terraformapukey ( to log into the VM remotely : home to AWS DC)
vi .ssh/authorized_keys # add the key from "ssh-add -L "
ssh localhost # just to check that the key has been copy and works
exit
#ssh-copy-id <10.0.1.104>
#Centos
#sudo yum install -y ansible-2.4.2.0
#sudo yum install git -y
#Ubuntu
sudo pip install ansible==2.4.2.0
sudo apt-get install git -y
git clone http://github.com/Juniper/contrail-ansible-deployer
cd contrail-ansible-deployer
ansible-playbook -e orchestrator=kubernetes -i inventory/ playbooks/provision_instances.yml
ansible-playbook -e orchestrator=kubernetes -i inventory/ playbooks/configure_instances.yml
ansible-playbook -e orchestrator=kubernetes -i inventory/ playbooks/install_contrail.yml
ansible-playbook -e orchestrator=kubernetes -i inventory/ playbooks/install_k8s.yml
-------------------------------------------------------------------------------------------
#ansible-playbook -i inventory/ -e orchestrator=kubernetes -e '{"instances":{"bms1":{"ip":"10.0.1.104","provider":"bms"}}}' playbooks/configure_instances.yml
#ansible-------
playbook -i inventory/ -e orchestrator=kubernetes -e '{"instances":{"bms1":{"ip":"10.0.1.104","provider":"bms"}}}' playbooks/install_contrail.yml
#ansible-playbook -i inventory/ -e orchestrator=kubernetes -e '{"instances":{"bms1":{"ip":"10192.0168.1.104100","provider":"bms"}}}' playbooks/configureinstall_instancesk8s.yml
#ansibleansible-playbook -i inventory/ -e orchestrator=kubernetes -e '{"instances":{"bms1":{"ip":"10.0.1.104localhost","provider":"bms"}}}' playbooks/installconfigure_contrailinstances.yml
#ansibleansible-playbook -i inventory/ -e orchestrator=kubernetes -e '{"instances":{"bms1":{"ip":"192.168.1.100localhost","provider":"bms"}}}' playbooks/install_k8scontrail.yml
ansible-playbook -i inventory/ -e orchestrator=kubernetes -e '{"instances":{"bms1":{"ip":"localhost","provider":"bms"}}}' playbooks/configure_instances.yml
ansible-playbook -i inventory/ -e orchestrator=kubernetes -e '{"instances":{"bms1":{"ip":"localhost","provider":"bms"}}}' playbooks/install_contrail.yml
ansible-playbook -i inventory/ -e orchestrator=kubernetes -e '{"instances":{"bms1":{"ip":"localhost","provider":"bms"}}}' playbooks/install_k8s.yml
"}}}' playbooks/install_k8s.yml
|
Code Block |
---|
title | instance.yaml for BMS |
---|
collapse | true |
---|
|
[centos@centos7_new ~]$ more /tmp/contrail-ansible-deployer/config/instances.yaml
Will be move to >>>> more /etc/ansible/roles/contrail50/files/instances.yaml
provider_config:
bms:
instances:
bms1:
provider: bms
ip: 192.168.1.100
global_configuration:
CONTAINER_REGISTRY: opencontrailnightly
contrail_configuration:
CONTRAIL_VERSION: latest |
Code Block |
---|
title | ansible hosts file |
---|
collapse | true |
---|
|
[centos@centos7_new ansible]$ more /etc/ansible/hosts
[centos7_new]
localhost ansible_connection=local
[web]
[aws]
35.162.40.232
|
...