Initial commit.
This commit is contained in:
commit
fbd792baf6
|
|
@ -0,0 +1,2 @@
|
||||||
|
id_rsa
|
||||||
|
roles/*
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
# Ansible development environment
|
||||||
|
|
||||||
|
Setup a machine to write Ansible roles. Includes:
|
||||||
|
- [ansible](https://github.com/ansible)
|
||||||
|
- [ansible-lint](https://github.com/ansible/ansible-lint)
|
||||||
|
- [molecule](https://molecule.readthedocs.io/en/latest/)
|
||||||
|
- [travis (cli)](https://github.com/travis-ci/travis.rb)
|
||||||
|
- [ara](https://github.com/openstack/ara)
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
In some directory, maybe `Documents` run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/robertdebock/ansible-development-environment
|
||||||
|
cd ansible-development-environment
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Download all required roles:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ansible-galaxy install --role-file roles/requirements.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
Now change a few files:
|
||||||
|
|
||||||
|
- `files/gitconfig` should contain your details.
|
||||||
|
- `files/id_rsa` should contain an ssh-key used to commit to GitHub.
|
||||||
|
- `inventory/hosts` should contain your machine.
|
||||||
|
- `inventory/group_vars/all.yml` should contain your details.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Simply run `./playbook.yml`. Preparing your system will take about 15 minutes or so.
|
||||||
|
|
||||||
|
## Code
|
||||||
|
|
||||||
|
You are now ready to code! Have fun using these commands:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# See if your code meets all rules.
|
||||||
|
ansible-lint .
|
||||||
|
# Test all scenarios.
|
||||||
|
molecule test
|
||||||
|
# Test a specific scenario.
|
||||||
|
molecule test --scenario-name fedora-latest
|
||||||
|
```
|
||||||
|
|
||||||
|
You can see the playbook runs on https://localhost:9191/
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
[defaults]
|
||||||
|
roles_path=roles
|
||||||
|
retry_files_enabled=no
|
||||||
|
inventory=inventory
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
[user]
|
||||||
|
email = robert@meinit.nl
|
||||||
|
name = Robert de Bock
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
---
|
||||||
|
bootstrap_wait_for_host: yes
|
||||||
|
|
||||||
|
users_group_list:
|
||||||
|
- name: robertdb
|
||||||
|
|
||||||
|
users_user_list:
|
||||||
|
- name: robertdb
|
||||||
|
comment: Robert de Bock
|
||||||
|
group: robertdb
|
||||||
|
groups: wheel
|
||||||
|
cron_allow: yes
|
||||||
|
sudo_options: "ALL=(ALL) NOPASSWD: ALL"
|
||||||
|
password: "$1$QbmM32Kz$nzFTRRxti0ZZ2oSC6ii8p1"
|
||||||
|
authorized_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCWswOogkZz/ihQA0lENCwDwSzmtmBWtFwzIzDlfa+eb4rBt6rZBg7enKeMqYtStI/NDneBwZUFBDIMu5zJTbvg7A60/WDhWXZmU21tZnm8K7KREFYOUndc6h//QHig6IIaIwwBZHF1NgXLtZ0qrUUlNU5JSEhDJsObMlPHtE4vFP8twPnfc7hxAnYma5+knU6qTMCDvhBE5tGJdor4UGeAhu+SwSVDloYtt1vGTmnFn8M/OD/fRMksusPefxyshJ37jpB4jY/Z9vzaNHwcj33prwl1b/xRfxr/+KRJsyq+ZKs9u2TVw9g4p+XLdfDtzZ8thR2P3x3MFrZOdFmCbo/5"
|
||||||
|
|
||||||
|
repository_base: "ssh://git@github.com/robertdebock"
|
||||||
|
repository_destination: /home/robertdb/github.com/robertdebock
|
||||||
|
|
||||||
|
repositories:
|
||||||
|
- ansible-role-ansible
|
||||||
|
- ansible-role-ansible_lint
|
||||||
|
- ansible-role-apt_autostart
|
||||||
|
- ansible-role-ara
|
||||||
|
- ansible-role-artifactory
|
||||||
|
- ansible-role-at
|
||||||
|
- ansible-role-awx
|
||||||
|
- ansible-role-backup
|
||||||
|
- ansible-role-bootstrap
|
||||||
|
- ansible-role-buildtools
|
||||||
|
- ansible-role-ca
|
||||||
|
- ansible-role-cargo
|
||||||
|
- ansible-role-clamav
|
||||||
|
- ansible-role-cloud9
|
||||||
|
- ansible-role-cntlm
|
||||||
|
- ansible-role-common
|
||||||
|
- ansible-role-cve_2018_19788
|
||||||
|
- ansible-role-dhcpd
|
||||||
|
- ansible-role-digitalocean-agent
|
||||||
|
- ansible-role-dns
|
||||||
|
- ansible-role-docker
|
||||||
|
- ansible-role-dovecot
|
||||||
|
- ansible-role-epel
|
||||||
|
- ansible-role-fail2ban
|
||||||
|
- ansible-role-firewall
|
||||||
|
- ansible-role-git
|
||||||
|
- ansible-role-glusterfs
|
||||||
|
- ansible-role-go
|
||||||
|
- ansible-role-gotop
|
||||||
|
- ansible-role-haproxy
|
||||||
|
- ansible-role-haveged
|
||||||
|
- ansible-role-httpd
|
||||||
|
- ansible-role-investigate
|
||||||
|
- ansible-role-irslackd
|
||||||
|
- ansible-role-java
|
||||||
|
- ansible-role-jenkins
|
||||||
|
- ansible-role-lynis
|
||||||
|
- ansible-role-mediawiki
|
||||||
|
- ansible-role-memcached
|
||||||
|
- ansible-role-mitogen
|
||||||
|
- ansible-role-molecule
|
||||||
|
- ansible-role-mssql
|
||||||
|
- ansible-role-mysql
|
||||||
|
- ansible-role-natrouter
|
||||||
|
- ansible-role-nginx
|
||||||
|
- ansible-role-npm
|
||||||
|
- ansible-role-ntp
|
||||||
|
- ansible-role-openssh
|
||||||
|
- ansible-role-openvas
|
||||||
|
- ansible-role-owncloud
|
||||||
|
- ansible-role-packer
|
||||||
|
- ansible-role-php
|
||||||
|
- ansible-role-phpmyadmin
|
||||||
|
- ansible-role-postfix
|
||||||
|
- ansible-role-python-pip
|
||||||
|
- ansible-role-reboot
|
||||||
|
- ansible-role-redis
|
||||||
|
- ansible-role-release
|
||||||
|
- ansible-role-restore
|
||||||
|
- ansible-role-revealmd
|
||||||
|
- ansible-role-roundcubemail
|
||||||
|
- ansible-role-rsyslog
|
||||||
|
- ansible-role-ruby
|
||||||
|
- ansible-role-rundeck
|
||||||
|
- ansible-role-scl
|
||||||
|
- ansible-role-selinux
|
||||||
|
- ansible-role-skeleton
|
||||||
|
- ansible-role-snort
|
||||||
|
- ansible-role-spamassassin
|
||||||
|
- ansible-role-squid
|
||||||
|
- ansible-role-sudo-pair
|
||||||
|
- ansible-role-terraform
|
||||||
|
- ansible-role-tftpd
|
||||||
|
- ansible-role-tomcat
|
||||||
|
- ansible-role-travis
|
||||||
|
- ansible-role-update
|
||||||
|
- ansible-role-users
|
||||||
|
- ansible-role-xinetd
|
||||||
|
- ansible-role-zabbix
|
||||||
|
- ansible-role-zabbix_agent
|
||||||
|
- ansible-role-zabbix_proxy
|
||||||
|
- ansible-role-zabbix_repository
|
||||||
|
- ansible-role-zabbix_server
|
||||||
|
- ansible-role-zabbix_web
|
||||||
|
- ansible-tools
|
||||||
|
- drawings
|
||||||
|
- robertdebock.github.io
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
fedora-s-1vcpu-2gb-ams3-01 ansible_host=167.99.46.114
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
#!/usr/bin/env ansible-playbook
|
||||||
|
---
|
||||||
|
- name: setup an ansible development environment
|
||||||
|
hosts: all
|
||||||
|
become: yes
|
||||||
|
gather_facts: no
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- robertdebock.bootstrap
|
||||||
|
- robertdebock.update
|
||||||
|
- robertdebock.fail2ban
|
||||||
|
- robertdebock.openssh
|
||||||
|
- robertdebock.digitalocean_agent
|
||||||
|
- robertdebock.common
|
||||||
|
- robertdebock.users
|
||||||
|
- robertdebock.postfix
|
||||||
|
- robertdebock.docker
|
||||||
|
- robertdebock.investigate
|
||||||
|
- robertdebock.ansible
|
||||||
|
- robertdebock.ansible_lint
|
||||||
|
- robertdebock.buildtools
|
||||||
|
- robertdebock.molecule
|
||||||
|
- robertdebock.ara
|
||||||
|
- robertdebock.ruby
|
||||||
|
- robertdebock.travis
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: copy private key
|
||||||
|
copy:
|
||||||
|
src: id_rsa
|
||||||
|
dest: /home/robertdb/.ssh/id_rsa
|
||||||
|
mode: "0400"
|
||||||
|
owner: robertdb
|
||||||
|
group: robertdb
|
||||||
|
|
||||||
|
- name: copy git configuration
|
||||||
|
copy:
|
||||||
|
src: gitconfig
|
||||||
|
dest: /home/robertdb/.gitconfig
|
||||||
|
|
||||||
|
- name: create repository_destination
|
||||||
|
file:
|
||||||
|
path: "{{ repository_destination }}"
|
||||||
|
state: directory
|
||||||
|
owner: robertdb
|
||||||
|
group: robertdb
|
||||||
|
|
||||||
|
- name: clone all roles
|
||||||
|
git:
|
||||||
|
repo: "{{ repository_base }}/{{ item }}.git"
|
||||||
|
dest: "{{ repository_destination }}/{{ item }}"
|
||||||
|
accept_hostkey: yes
|
||||||
|
key_file: /home/robertdb/.ssh/id_rsa
|
||||||
|
with_items: "{{ repositories }}"
|
||||||
|
become_user: robertdb
|
||||||
Loading…
Reference in New Issue