From ae3d025f0592d855451400bdb2c197a17b9b8347 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 5 Nov 2019 13:22:12 -0500 Subject: [PATCH] 0.1.0-DEV-20191105-132205 ------------------------- * INITIAL: - initial play commit --- .gitignore | 4 ++ .gitlab-ci.yml | 83 ++++++++++++++++++++++++++++++++++++++++++ ansible.cfg | 13 +++++++ deploy_proxy_sites.yml | 8 ++++ host_vars/.keep | 0 roles/requirements.yml | 6 +++ 6 files changed, 114 insertions(+) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 ansible.cfg create mode 100644 deploy_proxy_sites.yml create mode 100644 host_vars/.keep create mode 100644 roles/requirements.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a5c824 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +facts.d/* +inventory/hosts +scripts/* +site_notes.txt \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..365e52a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,83 @@ +# CI Mark that build is executed in CI environment +# GITLAB_CI Mark that build is executed in GitLab CI environment +# CI_SERVER Mark that build is executed in CI environment +# CI_SERVER_NAME CI server that is used to coordinate builds +# CI_SERVER_VERSION Not yet defined +# CI_SERVER_REVISION Not yet defined +# CI_BUILD_REF The commit revision for which project is built +# CI_BUILD_BEFORE_SHA The first commit that were included in push request +# CI_BUILD_REF_NAME The branch or tag name for which project is built +# CI_BUILD_ID The unique id of the current build that GitLab CI uses internally +# CI_BUILD_REPO The URL to clone the Git repository +# CI_PROJECT_ID The unique id of the current project that GitLab CI uses internally +# CI_PROJECT_DIR The full path where the repository is cloned and where the build is ran + + +variables: + ANSIBLE_ROLE: "zen_rev_proxy" + ANSIBLE_ROLE_PATH: "${CI_PROJECT_DIR}" + ANSIBLE_EXTRA_VARS: "" + + +stages: + - check_versions + - lint_playbook + - test_deploy + + +### BEGIN TEMPLATES ### +.tags_template: &tags_template + tags: + - zen-ci-deb-workstation + + +.zen_ci_deb_template: &zen_ci_deb_template + variables: + DOCKER_IMG_TAG: "latest" + + +.check_version_template: &check_version_template + <<: *tags_template + stage: check_versions + script: + - /usr/bin/hostname + - "cd ${ANSIBLE_PLAY_PATH} && git log -1" + - "ansible --version" + - "ansible-lint --version" + + +.lint_playbook_template: &lint_playbook_template + <<: *tags_template + stage: lint_playbook + script: + - "ansible-lint -v ${ANSIBLE_PLAY_PATH}/*.yml" + + +.test_deploy_template: &test_deploy_template + <<: *tags_template + stage: test_deploy + script: + - pwd + - ls -ltr + - ansible-galaxy install -r roles/requirements.yml + - ansible-playbook -v --connection=local ${ANSIBLE_EXTRA_VARS} ${ANSIBLE_PLAY} + - /bin/ls -l /etc/nginx/conf.d + - /usr/sbin/nginx -c /etc/nginx/nginx.conf -t +### END TEMPLATES ### + + +### BEGIN JOBS ### +Check Versioning Info: + <<: *zen_ci_deb_template + <<: *check_version_template + + +Lint Playbook: + <<: *zen_ci_deb_template + <<: *lint_playbook_template + + +Test Deploy: + <<: *zen_ci_deb_template + <<: *test_deploy_template +### END JOBS ### diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..e85a745 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,13 @@ +[defaults] +inventory = inventory/hosts +# roles_path = roles/ +remote_tmp = /tmp/.ansible-${USER}/tmp +gathering = smart +gather_timeout = 30 +fact_caching = jsonfile +fact_caching_connection = facts.d +fact_caching_timeout = 600 +retry_files_enabled = False +forks = 8 +timeout = 30 +host_key_checking = False diff --git a/deploy_proxy_sites.yml b/deploy_proxy_sites.yml new file mode 100644 index 0000000..3acd95c --- /dev/null +++ b/deploy_proxy_sites.yml @@ -0,0 +1,8 @@ +--- +- hosts: all + become: yes + gather_facts: yes + + + roles: + - role: zen_rev_proxy diff --git a/host_vars/.keep b/host_vars/.keep new file mode 100644 index 0000000..e69de29 diff --git a/roles/requirements.yml b/roles/requirements.yml new file mode 100644 index 0000000..e73c41b --- /dev/null +++ b/roles/requirements.yml @@ -0,0 +1,6 @@ +--- + +- name : zen_rev_proxy + src : https://git.thezengarden.net/zen/ansible/roles/zen_rev_proxy.git + scm : git + version : master