├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── Vagrantfile ├── defaults └── main.yml ├── handlers └── main.yml ├── logo.png ├── meta └── main.yml ├── molecule └── default │ ├── .molecule │ ├── Dockerfile_centos_7 │ ├── ansible.cfg │ ├── ansible_inventory.yml │ └── state.yml │ ├── Dockerfile.j2 │ ├── INSTALL.rst │ ├── create.yml │ ├── destroy.yml │ ├── molecule.yml │ ├── playbook.yml │ ├── prepare.yml │ └── tests │ ├── test_docker.py │ └── test_mongodb.py ├── requirements.txt ├── tasks ├── deb_init.yml ├── deb_update_cache.yml ├── docker-ce │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── elasticsearch │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── grafana │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── influxdb │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── jenkins │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── kubernetes │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── main.yml ├── mongodb │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── nginx │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── nodejs │ ├── main.yml │ └── setup_deb.yml ├── postgresql │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── prometheus │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── python │ ├── main.yml │ └── setup_deb.yml ├── sublime-text │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── vscode │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml └── yarn │ ├── main.yml │ ├── setup_deb.yml │ └── setup_yum.yml ├── templates ├── docker-ce │ ├── docker-ce.deb.repo.j2 │ └── docker-ce.yum.repo.j2 ├── elasticsearch │ ├── elasticsearch.deb.repo.j2 │ └── elasticsearch.yum.repo.j2 ├── grafana │ ├── grafana.deb.repo..j2 │ └── grafana.yum.repo.j2 ├── influxdb │ ├── influxdb.deb.repo.j2 │ └── influxdb.yum.repo.j2 ├── jenkins │ ├── jenkins.deb.repo.j2 │ └── jenkins.yum.repo.j2 ├── kubernetes │ ├── kubernetes.deb.repo.j2 │ └── kubernetes.yum.repo.j2 ├── mongodb │ ├── mongodb.deb.repo.j2 │ └── mongodb.yum.repo.j2 ├── nginx │ ├── nginx.deb.repo.j2 │ └── nginx.yum.repo.j2 ├── nodejs │ └── nodejs.deb.repo.j2 ├── postgresql │ └── postgresql.deb.repo.j2 ├── prometheus │ ├── prometheus.deb.repo.j2 │ └── prometheus.yum.repo.j2 ├── python │ └── python.deb.repo.j2 ├── sublime-text │ ├── sublime-text.deb.repo.j2 │ └── sublime-text.yum.repo.j2 ├── vscode │ ├── vscode.deb.repo.j2 │ └── vscode.yum.repo.j2 └── yarn │ ├── yarn.deb.repo.j2 │ └── yarn.yum.repo.j2 └── test.yml /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | .vagrant/ 9 | 10 | # Distribution / packaging 11 | .Python 12 | env/ 13 | bin/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # Installer logs 28 | pip-log.txt 29 | pip-delete-this-directory.txt 30 | 31 | # Unit test / coverage reports 32 | htmlcov/ 33 | .tox/ 34 | .coverage 35 | .cache 36 | nosetests.xml 37 | coverage.xml 38 | 39 | # Translations 40 | *.mo 41 | 42 | # Mr Developer 43 | .mr.developer.cfg 44 | .project 45 | .pydevproject 46 | 47 | # Rope 48 | .ropeproject 49 | 50 | # Django stuff: 51 | *.log 52 | *.pot 53 | 54 | # Sphinx documentation 55 | docs/_build/ 56 | 57 | *.deb 58 | *.rpm 59 | .yamllint 60 | .cache/ 61 | .molecule/ 62 | .retry -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | install: 3 | - pip install -r requirements.txt 4 | script: molecule test 5 | notifications: 6 | webhooks: https://galaxy.ansible.com/api/v1/notifications/ -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 1.1 - 12.04.2018 2 | ================= 3 | 4 | * Add NodeJS, Yarn 5 | * Playbook idempotence fixes 6 | * Fix Distro Release detection on Kali Linux, Elementary OS, Linux Mint 7 | 8 | 9 | 1.0 - 20.10.2017 10 | ================= 11 | 12 | * Initial release 13 | 14 | 15 | 0.3 - 14.10.2017 16 | ================= 17 | 18 | * Convert to an Ansible Galaxy playbook 19 | 20 | 0.2.5 - 09.11.2014 21 | ================= 22 | 23 | * Install script cleanup 24 | 25 | 0.2.3 - 05.11.2014 26 | ================= 27 | 28 | * Pretty print available packages 29 | * Clone only the master branch 30 | 31 | 0.2.2 - 05.11.2014 32 | ================= 33 | 34 | * List available packages 35 | 36 | 0.2.1 - 05.11.2014 37 | ================= 38 | 39 | * Update Edgium base path 40 | 41 | 0.2 - 05.11.2014 42 | ================= 43 | 44 | * Cleanup 45 | 46 | 47 | 0.1 - 02.09.2014 48 | ================= 49 | 50 | * First public verion -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Martin Rusev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ![](logo.png) 3 | 4 | Devopsium 5 | ====== 6 | 7 | [![Build Status](https://travis-ci.org/martinrusev/devopsium.svg?branch=master)](https://travis-ci.org/martinrusev/devopsium) 8 | 9 | Devopsium is an Ansible playbook for rapid dev localhost setup. It gives you the option to install the latest and greatest software from the official repositories 10 | with a couple of lines of code 11 | 12 | 13 | ```bash 14 | ansible-galaxy install martinrusev.devopsium 15 | 16 | # vim repository_setup_playbook.yml 17 | - hosts: localhost 18 | become: yes 19 | become_user: root 20 | roles: 21 | - martinrusev.devopsium 22 | vars: 23 | devopsium_repositories: 24 | - postgresql 25 | - docker-ce 26 | - python 27 | - kubernetes 28 | - vscode 29 | 30 | $ ansible-playbook repository_setup_playbook.yml 31 | $ sudo apt install kubectl vscode postgresql-10 docker-ce python3.6 prometheus 32 | ``` 33 | 34 | 35 | - [Motivation](#motivation) 36 | - [Requirements](#requirements) 37 | - [Installation](#installation) 38 | - [Usage](#usage) 39 | - [Available Repositories](#available-repositories) 40 | - [DevOps Tools](#devops-tools) 41 | - [Programming Languages](#programming-languages) 42 | - [Databases](#databases) 43 | - [Web Servers](#web-servers) 44 | - [Text Editors](#text-editors) 45 | 46 | 47 | ## Motivation 48 | 49 | The packages available in our Distro are not always up to date with the latest and greatest provided by the software creators. 50 | To install the latest desirable version, we usually go over the following routine: 51 | 52 | - We dig into Wikis, official Documentation, StackOverflow and find the officially supported repository 53 | - We create `/etc/apt/sources.list.d/package.list`, `yum/repos.d/package.list` files 54 | - We import repository keys `http://repo.package.com/gpg.key` 55 | - We update our local package cache and install the corresponding package 56 | 57 | Devopsium is an Ansible playbook that aims to solve this problem by providing a standardized way to sync your local repos 58 | with the officially maintained by the package creators or the community repositories. 59 | 60 | It is heavily inspired by Red Hat Sofware Collections 61 | 62 | ## Requirements 63 | 64 | Devopsium requires Ansible 2.2 or higher. 65 | 66 | 67 | ## Installation 68 | 69 | To install Devopsium run the following command: 70 | 71 | ``` 72 | ansible-galaxy install martinrusev.devopsium 73 | ``` 74 | 75 | ## Usage 76 | 77 | ```bash 78 | # vim repository_setup_playbook.yml 79 | - hosts: localhost 80 | become: yes 81 | become_user: root 82 | roles: 83 | - martinrusev.devopsium 84 | vars: 85 | devopsium_repositories: 86 | - postgresql 87 | - docker-ce 88 | - python 89 | - kubernetes 90 | - vscode 91 | 92 | $ ansible-playbook repository_setup_playbook.yml --ask-sudo-pass 93 | $ sudo apt install kubectl vscode postgresql-10 docker-ce python3.6 prometheus 94 | 95 | ``` 96 | 97 | ## Available Repositories 98 | 99 | ### DevOps tools 100 | 101 | | Name | Packages available for install after sync | Supported Distros | 102 | | ---------------------- |:--------------------------:| -----------------------:| 103 | | grafana | `grafana` | Ubuntu/Debian/RHEL| 104 | | prometheus | `prometheus` ,`prometheus-alertmanager`, `prometheus-pushgateway` | Ubuntu/Debian/RHEL| 105 | | docker-ce | `docker-ce` | Ubuntu/Debian/RHEL | 106 | | kubernetes | `kubelet`, `kubeadm`, `kubectl` | Ubuntu/Debian/RHEL | 107 | | jenkins | `jenkins` | Ubuntu/Debian/RHEL | 108 | 109 | 110 | ### Programming Languages & Tools 111 | 112 | | Name | Packages available for install after sync | Supported Distros | 113 | | ---------------------- |:--------------------------:| -----------------------:| 114 | | python | `python3.6` | Ubuntu | 115 | | nodejs8 | `nodejs` | Ubuntu | 116 | | yarn | `yarn` | Ubuntu/Debian | 117 | 118 | ### Databases 119 | 120 | | Name | Packages available for install after sync | Supported Distros | 121 | | ---------------------- |:--------------------------:| -----------------------:| 122 | | postgresql | `postgresql-` `9.2, 9.3, 9.4, 9.5, 9.6, 10`| Ubuntu/Debian | 123 | | mongodb | `mongodb-org-server` | Ubuntu/Debian/RHEL | 124 | | influxdb | `influxdb`, `telegraf`, `kapacitor`, `chronograf` | Ubuntu/Debian/RHEL | 125 | | elasticsearch | `elasticsearch`, `filebeat`, `metricbeat`, `kibana` | Ubuntu/Debian/RHEL | 126 | 127 | ### Web Servers 128 | 129 | | Name | Packages available for install after sync | Supported Distros | 130 | | ---------------------- |:--------------------------:| -----------------------:| 131 | | nginx | `nginx` | Ubuntu/Debian/RHEL | 132 | 133 | 134 | ### Text Editors 135 | 136 | | Name | Packages available for install after sync | Supported Distros | 137 | | ---------------------- |:--------------------------:| -----------------------:| 138 | | sublime-text | `sublime-text` | Ubuntu/Debian/RHEL | 139 | | vscode | `code` | Ubuntu/Debian/RHEL | 140 | 141 | 142 | 143 | ## Repository Setup References 144 | 145 | - Grafana - https://packagecloud.io/grafana 146 | - PostgreSQL - https://wiki.postgresql.org/wiki/Apt 147 | - MongoDB - https://docs.mongodb.com/manual/administration/install-on-linux 148 | - Docker - https://docs.docker.com/engine/installation/linux/docker-ce 149 | - InfluxDB - https://docs.influxdata.com/influxdb/v1.3/introduction/installation 150 | - ElasticSearch - https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html 151 | - Nginx - https://nginx.org/en/linux_packages.html 152 | - Kubernetes - https://kubernetes.io/docs/setup/independent/install-kubeadm/ 153 | - Jenkins - https://jenkins.io/download/ 154 | - Sublime Text - https://www.sublimetext.com/docs/3/linux_repositories.html 155 | - VSCode - https://code.visualstudio.com/docs/setup/linux 156 | - NodeJS - https://github.com/jtyr/prometheus-deb 157 | - Yarn - https://yarnpkg.com/lang/en/docs/install/ 158 | - Prometheus - https://github.com/lest/prometheus-rpm / https://github.com/jtyr/prometheus-deb 159 | 160 | ## Contributing 161 | 162 | If you happen to come accros a bug, please create and issue providing as much information as possible. 163 | If you want to add more packages, please fork the project and submit a Pull Request. All contributions are most welcome. 164 | 165 | ## License 166 | 167 | MIT 168 | 169 | ## Author Information 170 | 171 | Martin Rusev (https://amon.cx) 172 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | VAGRANTFILE_API_VERSION = "2" 5 | 6 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 7 | 8 | config.vm.define "main", primary: true do |node| 9 | node.vm.box = "ubuntu/xenial64" 10 | #node.vm.box = "debian/jessie64" 11 | #node.vm.box = "debian/wheezy64" 12 | # node.vm.box = "bento/centos-7.2" 13 | #node.vm.box = "bento/centos-6.7" 14 | 15 | node.vm.provision "ansible" do |ansible| 16 | ansible.playbook = "test.yml" 17 | ansible.become = true 18 | ansible.extra_vars = { 19 | ansible_python_interpreter: "/usr/bin/python3" 20 | } 21 | #ansible.verbose = "vvv" 22 | end 23 | end 24 | 25 | end -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | alt_distribution_releases: 3 | - { name: "sana", distro: "debian", release: "jessie", description: "Kali Linux"} 4 | - { name: "kali-rolling", distro: "debian", release: "jessie" , description: "Kali Linux"} 5 | - { name: "qiana", distro: "ubuntu", release: "trusty" , description: "Linux Mint 17.0"} 6 | - { name: "rebecca", distro: "ubuntu", release: "trusty" , description: "Linux Mint 17.1"} 7 | - { name: "rafaela", distro: "ubuntu", release: "trusty" , description: "Linux Mint 17.2"} 8 | - { name: "rosa", distro: "ubuntu", release: "trusty" , description: "Linux Mint 17.3"} 9 | - { name: "sarah", distro: "ubuntu", release: "xenial" , description: "Linux Mint 18.0"} 10 | - { name: "serena", distro: "ubuntu", release: "xenial" , description: "Linux Mint 18.1"} 11 | - { name: "sonya", distro: "ubuntu", release: "xenial" , description: "Linux Mint 18.2"} 12 | - { name: "sylvia", distro: "ubuntu", release: "xenial" , description: "Linux Mint 18.3"} 13 | - { name: "freya", distro: "ubuntu", release: "xenial" , description: "elementaryOS 0.3"} 14 | - { name: "loki", distro: "ubuntu", release: "xenial" , description: "elementaryOS 0.4"} -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinrusev/devopsium/ff267f3c99d64501a00ea46611796dff448f3066/logo.png -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: Martin Rusev 4 | description: Ansible Role for syncing official/community repositories for popular packages 5 | license: MIT 6 | min_ansible_version: 2.2 7 | platforms: 8 | - name: EL 9 | versions: 10 | - 6 11 | - 7 12 | - name: Ubuntu 13 | versions: 14 | - xenial 15 | - trusty 16 | - name: Debian 17 | versions: 18 | - wheezy 19 | - jessie 20 | galaxy_tags: 21 | - development 22 | - system 23 | 24 | dependencies: [] 25 | -------------------------------------------------------------------------------- /molecule/default/.molecule/Dockerfile_centos_7: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | FROM centos:7 4 | 5 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 6 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf bash && dnf clean all; \ 7 | elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 8 | elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ 9 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi 10 | -------------------------------------------------------------------------------- /molecule/default/.molecule/ansible.cfg: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | [ssh_connection] 4 | control_path = %(directory)s/%%h-%%p-%%r 5 | scp_if_ssh = True 6 | [defaults] 7 | host_key_checking = False 8 | ansible_managed = Ansible managed: Do NOT edit this file manually! 9 | retry_files_enabled = False 10 | nocows = 1 11 | -------------------------------------------------------------------------------- /molecule/default/.molecule/ansible_inventory.yml: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | --- 4 | all: 5 | hosts: 6 | centos: &id001 7 | ansible_connection: docker 8 | ubuntu: &id002 9 | ansible_connection: docker 10 | ungrouped: 11 | hosts: 12 | centos: *id001 13 | ubuntu: *id002 14 | vars: {} 15 | -------------------------------------------------------------------------------- /molecule/default/.molecule/state.yml: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | --- 4 | converged: false 5 | created: false 6 | driver: null 7 | prepared: null 8 | -------------------------------------------------------------------------------- /molecule/default/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | FROM {{ item.image }} 4 | 5 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 6 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf bash && dnf clean all; \ 7 | elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 8 | elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ 9 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi 10 | -------------------------------------------------------------------------------- /molecule/default/INSTALL.rst: -------------------------------------------------------------------------------- 1 | ******* 2 | Install 3 | ******* 4 | 5 | Requirements 6 | ============ 7 | 8 | * Docker Engine 9 | * docker-py 10 | 11 | Install 12 | ======= 13 | 14 | .. code-block:: bash 15 | 16 | $ sudo pip install docker-py 17 | -------------------------------------------------------------------------------- /molecule/default/create.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create 3 | hosts: localhost 4 | connection: local 5 | gather_facts: False 6 | no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" 7 | vars: 8 | molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" 9 | molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}" 10 | molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}" 11 | molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" 12 | tasks: 13 | - name: Create Dockerfiles from image names 14 | template: 15 | src: "{{ molecule_scenario_directory }}/Dockerfile.j2" 16 | dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}" 17 | with_items: "{{ molecule_yml.platforms }}" 18 | register: platforms 19 | 20 | - name: Discover local Docker images 21 | docker_image_facts: 22 | name: "molecule_local/{{ item.item.name }}" 23 | with_items: "{{ platforms.results }}" 24 | register: docker_images 25 | 26 | - name: Build an Ansible compatible image 27 | docker_image: 28 | path: "{{ molecule_ephemeral_directory }}" 29 | name: "molecule_local/{{ item.item.image }}" 30 | dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}" 31 | force: "{{ item.item.force | default(True) }}" 32 | with_items: "{{ platforms.results }}" 33 | when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0 34 | 35 | - name: Create molecule instance(s) 36 | docker_container: 37 | name: "{{ item.name }}" 38 | hostname: "{{ item.name }}" 39 | image: "molecule_local/{{ item.image }}" 40 | state: started 41 | recreate: False 42 | log_driver: syslog 43 | command: "{{ item.command | default('sleep infinity') }}" 44 | privileged: "{{ item.privileged | default(omit) }}" 45 | volumes: "{{ item.volumes | default(omit) }}" 46 | capabilities: "{{ item.capabilities | default(omit) }}" 47 | with_items: "{{ molecule_yml.platforms }}" 48 | -------------------------------------------------------------------------------- /molecule/default/destroy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Destroy 3 | hosts: localhost 4 | connection: local 5 | gather_facts: False 6 | # no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" 7 | vars: 8 | molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" 9 | molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" 10 | tasks: 11 | - name: Destroy molecule instance(s) 12 | docker_container: 13 | name: "{{ item.name }}" 14 | state: absent 15 | force_kill: "{{ item.force_kill | default(True) }}" 16 | with_items: "{{ molecule_yml.platforms }}" 17 | -------------------------------------------------------------------------------- /molecule/default/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | enabled: False 9 | platforms: 10 | # - name: centos 11 | # image: centos:7 12 | - name: ubuntu 13 | image: ubuntu:16.04 14 | provisioner: 15 | name: ansible 16 | lint: 17 | name: ansible-lint 18 | scenario: 19 | name: default 20 | test_sequence: 21 | - destroy 22 | - dependency 23 | - syntax 24 | - create 25 | - prepare 26 | - converge 27 | - verify 28 | - destroy 29 | verifier: 30 | name: testinfra -------------------------------------------------------------------------------- /molecule/default/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Converge 3 | hosts: all 4 | roles: 5 | - role: devopsium 6 | vars: 7 | - devopsium_repositories: 8 | - docker-ce 9 | - mongodb 10 | - yarn 11 | - postgresql -------------------------------------------------------------------------------- /molecule/default/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: all 4 | gather_facts: False 5 | tasks: [] 6 | -------------------------------------------------------------------------------- /molecule/default/tests/test_docker.py: -------------------------------------------------------------------------------- 1 | import testinfra.utils.ansible_runner 2 | 3 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 4 | '.molecule/ansible_inventory').get_hosts('all') 5 | 6 | 7 | def test_mongodb_repo_file(host): 8 | if host.system_info.distribution is 'debian': 9 | repo_file = '/etc/apt/sources.list.d/docker-ce.list' 10 | else: 11 | repo_file = '/etc/yum.repos.d/docker-ce.repo' 12 | 13 | f = host.file(repo_file) 14 | 15 | assert f.exists 16 | 17 | if host.system_info.distribution is 'debian': 18 | f.content_string == "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" -------------------------------------------------------------------------------- /molecule/default/tests/test_mongodb.py: -------------------------------------------------------------------------------- 1 | import testinfra.utils.ansible_runner 2 | 3 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 4 | '.molecule/ansible_inventory').get_hosts('all') 5 | 6 | 7 | def test_mongodb_repo_file(host): 8 | if host.system_info.distribution is 'debian': 9 | repo_file = '/etc/apt/sources.list.d/mongodb-org-3.4.list' 10 | else: 11 | repo_file = '/etc/yum.repos.d/mongodb-org-3.4.repo' 12 | 13 | f = host.file(repo_file) 14 | 15 | assert f.exists 16 | 17 | if host.system_info.distribution is 'debian': 18 | f.content_string == "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ansible 2 | molecule 3 | docker-py -------------------------------------------------------------------------------- /tasks/deb_init.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Distro Release Lookup" 4 | set_fact: 5 | devopsium_distro_release: "{{ alt_distribution_releases | selectattr(\"name\", \"search\", ansible_distribution_release) | map(attribute='release') | list | join('') }}" 6 | devopsium_distro: "{{ alt_distribution_releases | selectattr(\"name\", \"search\", ansible_distribution_release) | map(attribute='distro') | list | join('') }}" 7 | 8 | - name: "Set distro release if missing" 9 | set_fact: 10 | devopsium_distro_release: "{{ansible_distribution_release}}" 11 | when: devopsium_distro_release == "" 12 | 13 | - name: "Set distro if missing" 14 | set_fact: 15 | devopsium_distro: "{{ansible_distribution}}" 16 | when: devopsium_distro == "" 17 | 18 | - debug: 19 | msg: "Detected Distro: {{devopsium_distro|lower}} {{devopsium_distro_release}}" 20 | 21 | 22 | - name: install apt dependencies 23 | apt: 24 | name: "{{item}}" 25 | state: present 26 | with_items: 27 | - apt-transport-https 28 | - ca-certificates 29 | - curl 30 | - software-properties-common -------------------------------------------------------------------------------- /tasks/deb_update_cache.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Update cache 4 | apt: 5 | update_cache: yes -------------------------------------------------------------------------------- /tasks/docker-ce/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/docker-ce/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Docker CE DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | state: present 9 | url: https://download.docker.com/linux/ubuntu/gpg 10 | 11 | 12 | - name: add repo 13 | template: 14 | src: docker-ce/docker-ce.deb.repo.j2 15 | dest: /etc/apt/sources.list.d/docker-ce.list 16 | -------------------------------------------------------------------------------- /tasks/docker-ce/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Docker CE RPM Repositories setup" 5 | 6 | - name: add repo 7 | template: 8 | src: docker-ce/docker-ce.yum.repo.j2 9 | dest: /etc/yum.repos.d/docker-ce.repo 10 | -------------------------------------------------------------------------------- /tasks/elasticsearch/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/elasticsearch/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "ElasticSearch DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | state: present 9 | url: https://artifacts.elastic.co/GPG-KEY-elasticsearch 10 | 11 | 12 | - name: cleanup existing repo 13 | file: 14 | dest: /etc/apt/sources.list.d/elastic-5.x.list 15 | state: absent 16 | 17 | - name: add repo 18 | lineinfile: 19 | dest: /etc/apt/sources.list.d/elastic-5.x.list 20 | create: yes 21 | line: 'deb https://artifacts.elastic.co/packages/5.x/apt stable main' 22 | -------------------------------------------------------------------------------- /tasks/elasticsearch/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "ElasticSearch RPM Repositories setup" 5 | 6 | 7 | - name: import rpm key 8 | rpm_key: 9 | state: present 10 | key: https://artifacts.elastic.co/GPG-KEY-elasticsearch 11 | 12 | - name: add repo 13 | template: 14 | src: elasticsearch/elasticsearch.yum.repo.j2 15 | dest: /etc/yum.repos.d/elasticsearch.repo 16 | -------------------------------------------------------------------------------- /tasks/grafana/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/grafana/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Grafana DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | state: present 9 | url: https://packagecloud.io/gpg.key 10 | 11 | - name: add repo 12 | template: 13 | src: grafana/grafana.deb.repo.j2 14 | dest: /etc/apt/sources.list.d/grafana_stable.list 15 | -------------------------------------------------------------------------------- /tasks/grafana/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Grafana RPM Repositories setup" 5 | 6 | - name: add repo 7 | template: 8 | src: grafana/grafana.yum.repo.j2 9 | dest: /etc/yum.repos.d/grafana.repo 10 | 11 | - name: import rpm keys 12 | rpm_key: 13 | state: present 14 | key: "{{ item }}" 15 | with_items: 16 | - https://packagecloud.io/gpg.key 17 | - https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana 18 | -------------------------------------------------------------------------------- /tasks/influxdb/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/influxdb/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "InfluxDB DEB Repositories setup" 5 | 6 | 7 | - name: add key 8 | apt_key: 9 | state: present 10 | url: https://repos.influxdata.com/influxdb.key 11 | 12 | 13 | - name: add repo 14 | template: 15 | src: influxdb/influxdb.deb.repo.j2 16 | dest: /etc/apt/sources.list.d/influxdb.list -------------------------------------------------------------------------------- /tasks/influxdb/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "InfluxDB RPM Repositories setup" 5 | 6 | - name: add repo 7 | template: 8 | src: influxdb/influxdb.yum.repo.j2 9 | dest: /etc/yum.repos.d/influxdb.repo 10 | 11 | - name: import rpm key 12 | rpm_key: 13 | state: present 14 | key: https://repos.influxdata.com/influxdb.key 15 | -------------------------------------------------------------------------------- /tasks/jenkins/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/jenkins/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Jenkins DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | state: present 9 | url: https://pkg.jenkins.io/debian-stable/jenkins.io.key 10 | 11 | 12 | - name: add repo 13 | template: 14 | src: jenkins/jenkins.deb.repo.j2 15 | dest: /etc/apt/sources.list.d/jenkins.list -------------------------------------------------------------------------------- /tasks/jenkins/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Jenkins RPM Repositories setup" 5 | 6 | - name: add repo 7 | template: 8 | src: jenkins/jenkins.yum.repo.j2 9 | dest: /etc/yum.repos.d/jenkins.repo 10 | 11 | - name: import rpm keys 12 | rpm_key: 13 | state: present 14 | key: "{{ item }}" 15 | with_items: 16 | - https://pkg.jenkins.io/redhat/jenkins.io.key 17 | -------------------------------------------------------------------------------- /tasks/kubernetes/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/kubernetes/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Kubernetes DEB Repositories setup" 5 | 6 | 7 | - name: add key 8 | apt_key: 9 | state: present 10 | url: https://packages.cloud.google.com/apt/doc/apt-key.gpg 11 | 12 | - name: add repo 13 | template: 14 | src: kubernetes/kubernetes.deb.repo.j2 15 | dest: /etc/apt/sources.list.d/kubernetes.list 16 | -------------------------------------------------------------------------------- /tasks/kubernetes/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Kubernetes RPM Repositories setup" 5 | 6 | - name: add repo 7 | template: 8 | src: kubernetes/kubernetes.yum.repo.j2 9 | dest: /etc/yum.repos.d/kubernetes.repo 10 | 11 | - name: import rpm keys 12 | rpm_key: 13 | state: present 14 | key: "{{ item }}" 15 | with_items: 16 | - https://packages.cloud.google.com/yum/doc/yum-key.gpg 17 | - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg 18 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include_tasks: deb_init.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 5 | 6 | - include: "{{item}}/main.yml" 7 | with_items: 8 | - "{{devopsium_repositories}}" 9 | 10 | - include_tasks: deb_update_cache.yml 11 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' -------------------------------------------------------------------------------- /tasks/mongodb/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/mongodb/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "MongoDB DEB Repositories setup" 5 | 6 | 7 | - name: add key 8 | apt_key: 9 | state: present 10 | keyserver: keyserver.ubuntu.com 11 | id: 0C49F3730359A14518585931BC711F9BA15703C6 12 | 13 | 14 | - name: add repo 15 | template: 16 | src: mongodb/mongodb.deb.repo.j2 17 | dest: /etc/apt/sources.list.d/mongodb-3.4.list -------------------------------------------------------------------------------- /tasks/mongodb/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "MongoDB RPM Repositories setup" 5 | 6 | - name: add repo 7 | template: 8 | src: mongodb/mongodb.yum.repo.j2 9 | dest: /etc/yum.repos.d/mongodb-org-3.4.repo 10 | -------------------------------------------------------------------------------- /tasks/nginx/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/nginx/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Nginx DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | state: present 9 | url: https://nginx.org/keys/nginx_signing.key 10 | 11 | - name: add repo 12 | template: 13 | src: nginx/nginx.deb.repo.j2 14 | dest: /etc/apt/sources.list.d/nginx.list 15 | -------------------------------------------------------------------------------- /tasks/nginx/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Nginx RPM Repositories setup" 5 | 6 | 7 | - name: import rpm key 8 | rpm_key: 9 | state: present 10 | key: https://nginx.org/keys/nginx_signing.key 11 | 12 | - name: add repo 13 | template: 14 | src: nginx/nginx.yum.repo.j2 15 | dest: /etc/yum.repos.d/nginx.repo 16 | -------------------------------------------------------------------------------- /tasks/nodejs/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/nodejs/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "NodeJS DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key 9 | state: present 10 | 11 | - name: add repo 12 | template: 13 | src: nodejs/nodejs.deb.repo.j2 14 | dest: /etc/apt/sources.list.d/nodesource.list -------------------------------------------------------------------------------- /tasks/postgresql/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/postgresql/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "PostgreSQL DEB Repositories setup" 5 | 6 | 7 | - name: add key 8 | apt_key: 9 | url: https://www.postgresql.org/media/keys/ACCC4CF8.asc 10 | state: present 11 | 12 | - name: add repo 13 | template: 14 | src: postgresql/postgresql.deb.repo.j2 15 | dest: /etc/apt/sources.list.d/postgresql.list -------------------------------------------------------------------------------- /tasks/postgresql/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /tasks/prometheus/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/prometheus/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Prometheus DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | state: present 9 | url: https://packagecloud.io/prometheus-deb/release/gpgkey 10 | 11 | - name: add repo 12 | template: 13 | src: prometheus/prometheus.deb.repo.j2 14 | dest: /etc/apt/sources.list.d/prometheus.list 15 | -------------------------------------------------------------------------------- /tasks/prometheus/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Prometheus RPM Repositories setup" 5 | 6 | 7 | - name: add repo 8 | template: 9 | src: prometheus/prometheus.yum.repo.j2 10 | dest: /etc/yum.repos.d/prometheus.repo 11 | -------------------------------------------------------------------------------- /tasks/python/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # - include: setup_yum.yml 4 | # when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/python/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Python DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | state: present 9 | keyserver: keyserver: keyserver.ubuntu.com 10 | id: F23C5A6CF475977595C89F51BA6932366A755776 11 | 12 | - name: add repo 13 | template: 14 | src: python/python.deb.repo.j2 15 | dest: /etc/apt/sources.list.d/python.list 16 | -------------------------------------------------------------------------------- /tasks/sublime-text/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/sublime-text/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Sublime Text DEB Repositories setup" 5 | 6 | 7 | - name: add key 8 | apt_key: 9 | state: present 10 | url: https://download.sublimetext.com/sublimehq-pub.gpg 11 | 12 | - name: add repo 13 | template: 14 | src: sublime-text/sublime-text.deb.repo.j2 15 | dest: /etc/apt/sources.list.d/sublime3.list 16 | -------------------------------------------------------------------------------- /tasks/sublime-text/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Sublime Text RPM Repositories setup" 5 | 6 | - name: add repo 7 | template: 8 | src: sublime-text/sublime-text.yum.repo.j2 9 | dest: /etc/yum.repos.d/sublime3.repo 10 | 11 | - name: import rpm keys 12 | rpm_key: 13 | state: present 14 | key: "{{ item }}" 15 | with_items: 16 | - https://download.sublimetext.com/sublimehq-rpm-pub.gpg 17 | -------------------------------------------------------------------------------- /tasks/vscode/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/vscode/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "VSCode DEB Repositories setup" 5 | 6 | 7 | - name: add key 8 | apt_key: 9 | state: present 10 | url: https://packages.microsoft.com/keys/microsoft.asc 11 | keyring: /etc/apt/trusted.gpg.d/microsoft.gpg 12 | 13 | - name: add repo 14 | template: 15 | src: vscode/vscode.deb.repo.j2 16 | dest: /etc/apt/sources.list.d/vscode.list -------------------------------------------------------------------------------- /tasks/vscode/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "VSCode RPM Repositories setup" 5 | 6 | - name: add repo 7 | template: 8 | src: vscode/vscode.yum.repo.j2 9 | dest: /etc/yum.repos.d/vscode.repo 10 | 11 | - name: import rpm keys 12 | rpm_key: 13 | state: present 14 | key: "{{ item }}" 15 | with_items: 16 | - https://packages.microsoft.com/keys/microsoft.asc 17 | -------------------------------------------------------------------------------- /tasks/yarn/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: setup_yum.yml 4 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'RedHat' 5 | 6 | - include: setup_deb.yml 7 | when: hostvars[inventory_hostname]['ansible_os_family'] == 'Debian' 8 | -------------------------------------------------------------------------------- /tasks/yarn/setup_deb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Yarn DEB Repositories setup" 5 | 6 | - name: add key 7 | apt_key: 8 | state: present 9 | url: https://dl.yarnpkg.com/debian/pubkey.gpg 10 | 11 | 12 | - name: add repo 13 | template: 14 | src: yarn/yarn.deb.repo.j2 15 | dest: /etc/apt/sources.list.d/yarn.list -------------------------------------------------------------------------------- /tasks/yarn/setup_yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: 4 | msg: "Yarn RPM Repositories setup" 5 | 6 | 7 | - name: add repo 8 | template: 9 | src: yarn/yarn.yum.repo.j2 10 | dest: /etc/yum.repos.d/yarn.repo 11 | -------------------------------------------------------------------------------- /templates/docker-ce/docker-ce.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb [arch=amd64] https://download.docker.com/linux/{{devopsium_distro|lower}} {{devopsium_distro_release}} stable -------------------------------------------------------------------------------- /templates/docker-ce/docker-ce.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [docker-ce-stable] 2 | name=Docker CE Stable - $basearch 3 | baseurl=https://download.docker.com/linux/centos/7/$basearch/stable 4 | enabled=1 5 | gpgcheck=1 6 | gpgkey=https://download.docker.com/linux/centos/gpg 7 | -------------------------------------------------------------------------------- /templates/elasticsearch/elasticsearch.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb https://artifacts.elastic.co/packages/5.x/apt stable main -------------------------------------------------------------------------------- /templates/elasticsearch/elasticsearch.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [elasticsearch-5.x] 2 | name=Elasticsearch repository for 5.x packages 3 | baseurl=https://artifacts.elastic.co/packages/5.x/yum 4 | gpgcheck=1 5 | gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch 6 | enabled=1 7 | autorefresh=1 8 | type=rpm-md -------------------------------------------------------------------------------- /templates/grafana/grafana.deb.repo..j2: -------------------------------------------------------------------------------- 1 | deb https://packagecloud.io/grafana/stable/debian/ jessie main -------------------------------------------------------------------------------- /templates/grafana/grafana.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [grafana] 2 | name=grafana 3 | baseurl=https://packagecloud.io/grafana/stable/el/6/$basearch 4 | repo_gpgcheck=0 5 | enabled=1 6 | gpgcheck=1 7 | gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana 8 | sslverify=1 9 | sslcacert=/etc/pki/tls/certs/ca-bundle.crt -------------------------------------------------------------------------------- /templates/influxdb/influxdb.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb https://repos.influxdata.com/{{devopsium_distro|lower}} {{devopsium_distro_release}} stable -------------------------------------------------------------------------------- /templates/influxdb/influxdb.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [influxdb] 2 | name = InfluxDB Repository - RHEL \$releasever 3 | baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable 4 | enabled = 1 5 | gpgcheck = 1 6 | gpgkey = https://repos.influxdata.com/influxdb.key -------------------------------------------------------------------------------- /templates/jenkins/jenkins.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb https://pkg.jenkins.io/debian-stable binary/ -------------------------------------------------------------------------------- /templates/jenkins/jenkins.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [jenkins] 2 | name=Jenkins 3 | baseurl=http://pkg.jenkins.io/redhat 4 | gpgcheck=1 -------------------------------------------------------------------------------- /templates/kubernetes/kubernetes.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb http://apt.kubernetes.io/ kubernetes-xenial main -------------------------------------------------------------------------------- /templates/kubernetes/kubernetes.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [kubernetes] 2 | name=Kubernetes 3 | baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 4 | enabled=1 5 | gpgcheck=1 6 | repo_gpgcheck=1 7 | gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg -------------------------------------------------------------------------------- /templates/mongodb/mongodb.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/{{devopsium_distro|lower}} {{devopsium_distro_release}}/mongodb-org/3.4 multiverse -------------------------------------------------------------------------------- /templates/mongodb/mongodb.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [mongodb-org-3.4] 2 | name=MongoDB Repository 3 | baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/ 4 | gpgcheck=1 5 | enabled=1 6 | gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc -------------------------------------------------------------------------------- /templates/nginx/nginx.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb http://nginx.org/packages/{{devopsium_distro|lower}}/ {{devopsium_distro_release}} nginx -------------------------------------------------------------------------------- /templates/nginx/nginx.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [nginx] 2 | name=nginx repo 3 | baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/ 4 | gpgcheck=0 5 | enabled=1 -------------------------------------------------------------------------------- /templates/nodejs/nodejs.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb https://deb.nodesource.com/node_8.x {{devopsium_distro_release}} main -------------------------------------------------------------------------------- /templates/postgresql/postgresql.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb http://apt.postgresql.org/pub/repos/apt/ {{ devopsium_distro_release }}-pgdg main -------------------------------------------------------------------------------- /templates/prometheus/prometheus.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb https://packagecloud.io/prometheus-deb/release/ubuntu/ xenial main -------------------------------------------------------------------------------- /templates/prometheus/prometheus.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [prometheus] 2 | name=prometheus 3 | baseurl=https://packagecloud.io/prometheus-rpm/release/el/7/$basearch 4 | repo_gpgcheck=1 5 | enabled=1 6 | gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey 7 | https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm 8 | gpgcheck=1 9 | sslverify=1 10 | sslcacert=/etc/pki/tls/certs/ca-bundle.crt 11 | metadata_expire=300 -------------------------------------------------------------------------------- /templates/python/python.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu {{devopsium_distro_release}} main -------------------------------------------------------------------------------- /templates/sublime-text/sublime-text.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb https://download.sublimetext.com/ apt/stable/ -------------------------------------------------------------------------------- /templates/sublime-text/sublime-text.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [sublime-text] 2 | name=Sublime Text - x86_64 - Stable 3 | baseurl=https://download.sublimetext.com/rpm/stable/x86_64 4 | enabled=1 5 | gpgcheck=1 6 | gpgkey=https://download.sublimetext.com/sublimehq-rpm-pub.gpg -------------------------------------------------------------------------------- /templates/vscode/vscode.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main -------------------------------------------------------------------------------- /templates/vscode/vscode.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [code] 2 | name=Visual Studio Code 3 | baseurl=https://packages.microsoft.com/yumrepos/vscode 4 | enabled=1 5 | gpgcheck=1 6 | gpgkey=https://packages.microsoft.com/keys/microsoft.asc -------------------------------------------------------------------------------- /templates/yarn/yarn.deb.repo.j2: -------------------------------------------------------------------------------- 1 | deb https://dl.yarnpkg.com/debian/ stable main -------------------------------------------------------------------------------- /templates/yarn/yarn.yum.repo.j2: -------------------------------------------------------------------------------- 1 | [yarn] 2 | name=Yarn Repository 3 | baseurl=https://dl.yarnpkg.com/rpm/ 4 | enabled=1 5 | gpgcheck=1 6 | gpgkey=https://dl.yarnpkg.com/rpm/pubkey.gpg -------------------------------------------------------------------------------- /test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ test_hosts|default('all') }}" 3 | become: yes 4 | become_method: sudo 5 | tasks: 6 | - include: 'tasks/main.yml' 7 | vars: 8 | - devopsium_repositories: 9 | - grafana 10 | - postgresql 11 | - mongodb 12 | - docker-ce 13 | - influxdb 14 | - nodejs 15 | - yarn --------------------------------------------------------------------------------