diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..b555288 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,42 @@ +pipeline { + agent { + docker { + image 'git.dreamfall.space/thrrgilag/kiln:latest' + label 'docker-build' + } + } + stages { + stage('Build site') { + steps { + mattermostSend "Site build started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)" + sh 'kiln build' + } + post { + success { + mattermostSend color: "good", message: "Site build success - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)" + } + failure { + mattermostSend color: "danger", message: "Site build failure - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)" + } + } + } + stage('Deploy site') { + steps { + mattermostSend "Site deploy started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)" + ansiblePlaybook( + playbook: 'main.yaml', + inventory: 'hosts.ini', + credentialsId: 'onedrop-vetinari' + ) + } + post { + success { + mattermostSend color: "good", message: "Site deploy success - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)" + } + failure { + mattermostSend color: "danger", message: "Site deploy failure - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)" + } + } + } + } +} diff --git a/hosts.ini b/hosts.ini new file mode 100644 index 0000000..85f1a81 --- /dev/null +++ b/hosts.ini @@ -0,0 +1,2 @@ +[web] +vetinari.dreamfall.space diff --git a/main.yaml b/main.yaml new file mode 100644 index 0000000..6ebadb2 --- /dev/null +++ b/main.yaml @@ -0,0 +1,11 @@ +--- +- name: Deploy morgan.mcmillian.dev site + hosts: web + vars: + html_location: /var/www/html/morgan.mcmillian.dev + + tasks: + - name: Sync html directory + ansible.posix.synchronize: + src: public/html/ + dest: "{{ html_location }}/"