imfreedom/teamcity-ansible

d83811da1689
Parents
Children a532e415c4e3
Initial revision, skipped some secrets for now
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/agent.yml Thu Oct 31 02:08:01 2019 -0500
@@ -0,0 +1,11 @@
+---
+- hosts: all
+ vars_files:
+ - vars/secrets.yml
+ roles:
+ - role: docker
+ - role: convey
+ convey_version: 0.13.1
+ convey_sha256_checksum: c5f1d5c7d5da5ec61d325659e77e74a205f62929f2abca82b949c22164f2e5b6
+ - role: mercurial
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/convey/tasks/main.yml Thu Oct 31 02:08:01 2019 -0500
@@ -0,0 +1,27 @@
+---
+- name: precondition - convey_version
+ fail: msg="ERROR -required variable 'convey_version' missing."
+ when: convey_version is not defined
+- name: precondition - convey_sha256_checksum
+ fail: msg="ERROR -required variable 'convey_sha256_checksum' missing."
+ when: convey_sha256_checksum is not defined
+
+# internal vars
+- name: set internal var for convey_filename
+ set_fact:
+ convey_filename: "convey-{{convey_version}}-{{ansible_system|lower}}-amd64"
+- name: set internal var for convey_url
+ set_fact:
+ convey_url: "https://bitbucket.org/rw_grim/convey/downloads/{{convey_filename}}"
+- name: set install directory
+ set_fact:
+ convey_install_dir: "/usr/local/bin"
+
+# download the jar
+- name: download convey
+ get_url:
+ url: "{{convey_url}}"
+ dest: "{{convey_install_dir}}/convey"
+ sha256sum: "{{convey_sha256_checksum}}"
+ mode: "0755"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/docker/tasks/main.yml Thu Oct 31 02:08:01 2019 -0500
@@ -0,0 +1,39 @@
+---
+- name: Install Dependencies
+ apt:
+ name:
+ - apt-transport-https
+ - ca-certificates
+ state: present
+ force_apt_get: true
+ when: ansible_facts['os_family'] == "Debian"
+
+- name: Add Docker apt-key
+ apt_key:
+ url: https://download.docker.com/linux/ubuntu/gpg
+ id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
+ state: present
+ when: ansible_facts['os_family'] == "Debian"
+
+- name: Add Docker repository
+ apt_repository:
+ repo: "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"
+ state: present
+ filename: "docker"
+ update_cache: true
+ when: ansible_facts['os_family'] == "Debian"
+
+- name: Install Docker (Debian)
+ apt:
+ name:
+ - docker-ce
+ state: present
+ force_apt_get: true
+ when: ansible_facts['os_family'] == "Debian"
+
+- name: Install Docker (Darwin)
+ homebrew_cask:
+ name: docker
+ state: present
+ when: ansible_facts['system'] == "Darwin"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/mercurial/tasks/main.yml Thu Oct 31 02:08:01 2019 -0500
@@ -0,0 +1,43 @@
+---
+- name: Install Dependencies
+ apt:
+ name:
+ - python
+ - libpython-dev
+ - python-pip
+ - python-setuptools
+ - gcc
+ state: present
+ force_apt_get: true
+ when: ansible_facts['os_family'] == "Debian"
+
+- name: remove mercurial package
+ apt:
+ name:
+ - mercurial
+ - mercurial-common
+ state: absent
+ purge: yes
+ force: yes
+ force_apt_get: true
+ when: ansible_facts['os_family'] == "Debian"
+
+- name: install mercurial and evolve
+ pip:
+ name:
+ - mercurial
+ - hg-evolve
+
+- name: create system config directory
+ file:
+ path: /etc/mercurial
+ state: directory
+ mode: '0755'
+
+- name: turn evolve on
+ copy:
+ dest: /etc/mercurial/hgrc
+ content: |
+ [extensions]
+ evolve =
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/teamcity/tasks/main.yml Thu Oct 31 02:08:01 2019 -0500
@@ -0,0 +1,10 @@
+# vi:et:ts=2 sw=2 sts=2
+---
+- name: precondition: teamcity server
+ fail: msg="ERROR - required variable 'teamcity_server' missing"
+ when: teamcity_server is not defined
+
+- name: set internal var for buildAgent.zip
+ set_fact:
+ teamcity_build_agent_zip: "{{teamcity_server}}update/buildAgent.zip"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/run Thu Oct 31 02:08:01 2019 -0500
@@ -0,0 +1,5 @@
+#!/bin/sh -ex
+
+ansible-playbook -b agent.yml -i hosts --vault-password-file=secrets/ansible_vault_password.txt $@
+
+