Created
March 24, 2019 14:00
-
-
Save ernesen/233fb83ad846e865c5218f2d4a424c06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is where we configure the instance with ansible-playbook | |
# Jenkins requires Java to be installed | |
provisioner "local-exec" { | |
command = <<EOT | |
sleep 30; | |
>java.ini; | |
echo "[java]" | tee -a java.ini; | |
echo "${aws_instance.jenkins-ci.public_ip} ansible_user=${var.ansible_user} ansible_ssh_private_key_file=${var.private_key}" | tee -a java.ini; | |
export ANSIBLE_HOST_KEY_CHECKING=False; | |
ansible-playbook -u ${var.ansible_user} --private-key ${var.private_key} -i java.ini ../playbooks/install_java.yaml | |
EOT | |
} | |
# This is where we configure the instance with ansible-playbook | |
provisioner "local-exec" { | |
command = <<EOT | |
sleep 600; | |
>jenkins-ci.ini; | |
echo "[jenkins-ci]" | tee -a jenkins-ci.ini; | |
echo "${aws_instance.jenkins-ci.public_ip} ansible_user=${var.ansible_user} ansible_ssh_private_key_file=${var.private_key}" | tee -a jenkins-ci.ini; | |
export ANSIBLE_HOST_KEY_CHECKING=False; | |
ansible-playbook -u ${var.ansible_user} --private-key ${var.private_key} -i jenkins-ci.ini ../playbooks/install_jenkins.yaml | |
EOT | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment