Small fixes.

This commit is contained in:
Robert de Bock 2019-01-26 06:42:12 +01:00
parent 629d08724e
commit 57d9030bf5
14 changed files with 281 additions and 94 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
id_rsa id_rsa
roles/* roles/*
files/ssh_keys files/ssh_keys
.vagrant

View File

@ -0,0 +1 @@
1.5:49e82318-88e2-4fa3-9c6a-5c3a5a4183a2

View File

@ -0,0 +1 @@
1000

View File

@ -0,0 +1 @@
49e82318-88e2-4fa3-9c6a-5c3a5a4183a2

View File

@ -0,0 +1 @@
1d3ed013c0f54f5ea1aa9619bcfd4ea9

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA03Sj1kb4IY2/xqaosJ4lmtBGR1RQSSpTsz/QciPuRzA8usLJ
p1/66/BO/DuZoGjoKFwS7T6yVNm5xNWiEYUlNgfW1U4U6jguo7DFjZ6Rg6w1vKfh
M6N/0u7xBdk9jvTLTVfmzY0nJXR2YyuiOxwD3MR2EY/E9bwS5Ji8A66aqQFZwQTK
6HpslwpCD6GlXOmf74m/D6oMFOD5ZV0QestimGRge9IIxa07Q5wa/2sLHErxqK6i
PadDH+10OPZledBtTjqJ1SO+M+E1SSTH36sNZNRLdmSh9jPNnhONdjvYy/5UuwjD
vN45j0geJ1xNBRff+We7PrluSuQecyICGIg4pwIDAQABAoIBADH43r9FBl7noOrR
eAxFU53CmtlAk7i2yBEUg651z1oDjFaWshFcHXCk2gXCEAxYvoTLPa3To1FqIvzh
f+ukC6c5Mww157tyi5Mjs4xEbR8xE4ICKraJbSvsTAmVzXZ7Y5BjtafeM+ImI9RL
+4r8k+0YgM6lq2ZnjA96CPTVzrchrJt8isjuS3F45Oiy19DNMJXGcLHJVlU3Lm69
8A77Mf8ertXtVJohAgEK4hnmDrMA4GqghvPtu8Wh3GmC91pP0fCIICnYi4x3iKLq
l94a5usxBcozkL5iqfhFm1mBDCDuSHpKoKrNY/fZU3oiTpgctzKPY0xtXqtkuh1d
MSAgxAECgYEA6ir+mXLAsT84RHTujnwBzuL17an58mytR6+rBFgIJ/WiwzFtMvfj
noL0De6mQNtATIelxemJBbfAY9RVmjLrJ3080NsH9ZmvaUIBaFHwmLJBUa01cVZO
lBhfOzYJJus9kFoGq7VOro3DMe/qICbCrBT26lt4jMiFg9sOmDR9ycsCgYEA5yuP
FM6zDEXD3l8ROskFadwQiZeBa6oYITcT6yD9ZQs1N+zWYVEiAb5T5l/5Ava8CwWD
z0vXohyUK7WQYhDTnZy5vn+Er6j0F8GH9JEe3mHIHdTuNzQz5YG+k1LFHTeW05N4
IKrEMQCBj9yjwACGqy1S1bebJM1rvGklKFkqoRUCgYAXnxytuACuIJV5el4yK1o3
V3e9cL8Q8FuOdq8GsiaoeUPg8tR0JsNkUwtxeFh3BGb5EVnsnAFBfWa/60RzWJ2W
DzEaVG36HXWvZYQk1NczYA/swE86zp0AnXDF1U6ZCXPdYud3XMPCIfTFzdDNS3up
xjeeLnn7oaKuSWOwgOMLfwKBgFVh41EeH0ezJOsnVefOg69b1sfbK7QmeQ8blsHL
x4vgneFwGqaLHvJh5/85B3Iuy7mOaebQ7m4z/A5A23k9GcwnLPvNgaaX0sBLfPm5
+BrPJujN0saVA24Lg+ZKNf/anly7JS17pUcsFq6aIekyyIrFDMlfLXBkZxyKAW1r
sbEZAoGAb9jvdsjeAL4US0LkK82+y2UQ4hxPOIvsrUyO3F1ULvy2JYUojw/TBlzP
wP7YN1PHAba7LnhGY6qWDUoTJrftpjQO2EXxtMWGU8M/YtMByicpb3ahKUM6mH9l
HWQQgu/Di5IycZ5OUR8/Xp2BdC6Oh6OT2vte26wsFHC9yxg+hAQ=
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
/home/robertdb/Documents/github.com/robertdebock/ansible-development-environment

10
Vagrantfile vendored Normal file
View File

@ -0,0 +1,10 @@
Vagrant.configure("2") do |config|
config.vm.define "fedora29" do |fedora28|
fedora28.vm.box = "fedora/29-cloud-base"
fedora28.vm.synced_folder '.', '/vagrant', disabled: true
fedora28.vm.provider :libvirt do |domain|
domain.memory = 4096
domain.cpus = 4
end
end
end

View File

@ -2,6 +2,6 @@
roles_path=roles roles_path=roles
retry_files_enabled=no retry_files_enabled=no
inventory=inventory inventory=inventory
stdout_callback = yaml stdout_callback=yaml
callback_whitelist = profile_roles callback_whitelist=profile_roles

View File

@ -15,6 +15,7 @@ users_user_list:
sudo_options: "ALL=(ALL) NOPASSWD: ALL" sudo_options: "ALL=(ALL) NOPASSWD: ALL"
authorized_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCWswOogkZz/ihQA0lENCwDwSzmtmBWtFwzIzDlfa+eb4rBt6rZBg7enKeMqYtStI/NDneBwZUFBDIMu5zJTbvg7A60/WDhWXZmU21tZnm8K7KREFYOUndc6h//QHig6IIaIwwBZHF1NgXLtZ0qrUUlNU5JSEhDJsObMlPHtE4vFP8twPnfc7hxAnYma5+knU6qTMCDvhBE5tGJdor4UGeAhu+SwSVDloYtt1vGTmnFn8M/OD/fRMksusPefxyshJ37jpB4jY/Z9vzaNHwcj33prwl1b/xRfxr/+KRJsyq+ZKs9u2TVw9g4p+XLdfDtzZ8thR2P3x3MFrZOdFmCbo/5" authorized_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCWswOogkZz/ihQA0lENCwDwSzmtmBWtFwzIzDlfa+eb4rBt6rZBg7enKeMqYtStI/NDneBwZUFBDIMu5zJTbvg7A60/WDhWXZmU21tZnm8K7KREFYOUndc6h//QHig6IIaIwwBZHF1NgXLtZ0qrUUlNU5JSEhDJsObMlPHtE4vFP8twPnfc7hxAnYma5+knU6qTMCDvhBE5tGJdor4UGeAhu+SwSVDloYtt1vGTmnFn8M/OD/fRMksusPefxyshJ37jpB4jY/Z9vzaNHwcj33prwl1b/xRfxr/+KRJsyq+ZKs9u2TVw9g4p+XLdfDtzZ8thR2P3x3MFrZOdFmCbo/5"
manage_ssh_key: yes manage_ssh_key: yes
copy_private_key: yes
firewall_services: firewall_services:
- name: ssh - name: ssh
@ -32,92 +33,181 @@ git_user_email: robert@meinit.nl
git_repository_destination: /home/robertdb/Documents/github.com/robertdebock git_repository_destination: /home/robertdb/Documents/github.com/robertdebock
git_repositories: git_repositories:
- name: ssh://git@github.com/robertdebock/ansible-role-ansible.git - repo: ssh://git@github.com/robertdebock/ansible-role-ansible.git
- name: ssh://git@github.com/robertdebock/ansible-role-ansible_lint.git dest: ansible-role-ansible
- name: ssh://git@github.com/robertdebock/ansible-role-apt_autostart.git - repo: ssh://git@github.com/robertdebock/ansible-role-ansible_lint.git
- name: ssh://git@github.com/robertdebock/ansible-role-ara.git dest: ansible-role-ansible_lint
- name: ssh://git@github.com/robertdebock/ansible-role-artifactory.git - repo: ssh://git@github.com/robertdebock/ansible-role-apt_autostart.git
- name: ssh://git@github.com/robertdebock/ansible-role-at.git dest: ansible-role-apt_autostart
- name: ssh://git@github.com/robertdebock/ansible-role-awx.git - repo: ssh://git@github.com/robertdebock/ansible-role-ara.git
- name: ssh://git@github.com/robertdebock/ansible-role-backup.git dest: ansible-role-ara
- name: ssh://git@github.com/robertdebock/ansible-role-bootstrap.git - repo: ssh://git@github.com/robertdebock/ansible-role-artifactory.git
- name: ssh://git@github.com/robertdebock/ansible-role-buildtools.git dest: ansible-role-artifactory
- name: ssh://git@github.com/robertdebock/ansible-role-ca.git - repo: ssh://git@github.com/robertdebock/ansible-role-at.git
- name: ssh://git@github.com/robertdebock/ansible-role-cargo.git dest: ansible-role-at
- name: ssh://git@github.com/robertdebock/ansible-role-clamav.git - repo: ssh://git@github.com/robertdebock/ansible-role-awx.git
- name: ssh://git@github.com/robertdebock/ansible-role-cloud9.git dest: ansible-role-awx
- name: ssh://git@github.com/robertdebock/ansible-role-cntlm.git - repo: ssh://git@github.com/robertdebock/ansible-role-backup.git
- name: ssh://git@github.com/robertdebock/ansible-role-common.git dest: ansible-role-backup
- name: ssh://git@github.com/robertdebock/ansible-role-cve_2018_19788.git - repo: ssh://git@github.com/robertdebock/ansible-role-bootstrap.git
- name: ssh://git@github.com/robertdebock/ansible-role-dhcpd.git dest: ansible-role-bootstrap
- name: ssh://git@github.com/robertdebock/ansible-role-digitalocean-agent.git - repo: ssh://git@github.com/robertdebock/ansible-role-buildtools.git
- name: ssh://git@github.com/robertdebock/ansible-role-dns.git dest: ansible-role-buildtools
- name: ssh://git@github.com/robertdebock/ansible-role-docker.git - repo: ssh://git@github.com/robertdebock/ansible-role-ca.git
- name: ssh://git@github.com/robertdebock/ansible-role-dovecot.git dest: ansible-role-ca
- name: ssh://git@github.com/robertdebock/ansible-role-epel.git - repo: ssh://git@github.com/robertdebock/ansible-role-cargo.git
- name: ssh://git@github.com/robertdebock/ansible-role-fail2ban.git dest: ansible-role-cargo
- name: ssh://git@github.com/robertdebock/ansible-role-firewall.git - repo: ssh://git@github.com/robertdebock/ansible-role-clamav.git
- name: ssh://git@github.com/robertdebock/ansible-role-git.git dest: ansible-role-clamav
- name: ssh://git@github.com/robertdebock/ansible-role-glusterfs.git - repo: ssh://git@github.com/robertdebock/ansible-role-cloud9.git
- name: ssh://git@github.com/robertdebock/ansible-role-go.git dest: ansible-role-cloud9
- name: ssh://git@github.com/robertdebock/ansible-role-gotop.git - repo: ssh://git@github.com/robertdebock/ansible-role-cntlm.git
- name: ssh://git@github.com/robertdebock/ansible-role-haproxy.git dest: ansible-role-cntlm
- name: ssh://git@github.com/robertdebock/ansible-role-haveged.git - repo: ssh://git@github.com/robertdebock/ansible-role-common.git
- name: ssh://git@github.com/robertdebock/ansible-role-httpd.git dest: ansible-role-common
- name: ssh://git@github.com/robertdebock/ansible-role-investigate.git - repo: ssh://git@github.com/robertdebock/ansible-role-cve_2018_19788.git
- name: ssh://git@github.com/robertdebock/ansible-role-irslackd.git dest: ansible-role-cve_2018_19788
- name: ssh://git@github.com/robertdebock/ansible-role-java.git - repo: ssh://git@github.com/robertdebock/ansible-role-dhcpd.git
- name: ssh://git@github.com/robertdebock/ansible-role-jenkins.git dest: ansible-role-dhcpd
- name: ssh://git@github.com/robertdebock/ansible-role-locale.git - repo: ssh://git@github.com/robertdebock/ansible-role-digitalocean-agent.git
- name: ssh://git@github.com/robertdebock/ansible-role-lynis.git dest: ansible-role-digitalocean-agent
- name: ssh://git@github.com/robertdebock/ansible-role-mediawiki.git - repo: ssh://git@github.com/robertdebock/ansible-role-dns.git
- name: ssh://git@github.com/robertdebock/ansible-role-memcached.git dest: ansible-role-dns
- name: ssh://git@github.com/robertdebock/ansible-role-mitogen.git - repo: ssh://git@github.com/robertdebock/ansible-role-docker.git
- name: ssh://git@github.com/robertdebock/ansible-role-molecule.git dest: ansible-role-docker
- name: ssh://git@github.com/robertdebock/ansible-role-mssql.git - repo: ssh://git@github.com/robertdebock/ansible-role-dovecot.git
- name: ssh://git@github.com/robertdebock/ansible-role-mysql.git dest: ansible-role-dovecot
- name: ssh://git@github.com/robertdebock/ansible-role-natrouter.git - repo: ssh://git@github.com/robertdebock/ansible-role-epel.git
- name: ssh://git@github.com/robertdebock/ansible-role-nginx.git dest: ansible-role-epel
- name: ssh://git@github.com/robertdebock/ansible-role-npm.git - repo: ssh://git@github.com/robertdebock/ansible-role-fail2ban.git
- name: ssh://git@github.com/robertdebock/ansible-role-ntp.git dest: ansible-role-fail2ban
- name: ssh://git@github.com/robertdebock/ansible-role-openssh.git - repo: ssh://git@github.com/robertdebock/ansible-role-firewall.git
- name: ssh://git@github.com/robertdebock/ansible-role-openvas.git dest: ansible-role-firewall
- name: ssh://git@github.com/robertdebock/ansible-role-owncloud.git - repo: ssh://git@github.com/robertdebock/ansible-role-git.git
- name: ssh://git@github.com/robertdebock/ansible-role-packer.git dest: ansible-role-git
- name: ssh://git@github.com/robertdebock/ansible-role-php.git - repo: ssh://git@github.com/robertdebock/ansible-role-glusterfs.git
- name: ssh://git@github.com/robertdebock/ansible-role-phpmyadmin.git dest: ansible-role-glusterfs
- name: ssh://git@github.com/robertdebock/ansible-role-postfix.git - repo: ssh://git@github.com/robertdebock/ansible-role-go.git
- name: ssh://git@github.com/robertdebock/ansible-role-python-pip.git dest: ansible-role-go
- name: ssh://git@github.com/robertdebock/ansible-role-reboot.git - repo: ssh://git@github.com/robertdebock/ansible-role-gotop.git
- name: ssh://git@github.com/robertdebock/ansible-role-redis.git dest: ansible-role-gotop
- name: ssh://git@github.com/robertdebock/ansible-role-release.git - repo: ssh://git@github.com/robertdebock/ansible-role-haproxy.git
- name: ssh://git@github.com/robertdebock/ansible-role-restore.git dest: ansible-role-haproxy
- name: ssh://git@github.com/robertdebock/ansible-role-revealmd.git - repo: ssh://git@github.com/robertdebock/ansible-role-haveged.git
- name: ssh://git@github.com/robertdebock/ansible-role-roundcubemail.git dest: ansible-role-haveged
- name: ssh://git@github.com/robertdebock/ansible-role-rsyslog.git - repo: ssh://git@github.com/robertdebock/ansible-role-httpd.git
- name: ssh://git@github.com/robertdebock/ansible-role-ruby.git dest: ansible-role-httpd
- name: ssh://git@github.com/robertdebock/ansible-role-rundeck.git - repo: ssh://git@github.com/robertdebock/ansible-role-investigate.git
- name: ssh://git@github.com/robertdebock/ansible-role-scl.git dest: ansible-role-investigate
- name: ssh://git@github.com/robertdebock/ansible-role-selinux.git - repo: ssh://git@github.com/robertdebock/ansible-role-irslackd.git
- name: ssh://git@github.com/robertdebock/ansible-role-skeleton.git dest: ansible-role-irslackd
- name: ssh://git@github.com/robertdebock/ansible-role-snort.git - repo: ssh://git@github.com/robertdebock/ansible-role-java.git
- name: ssh://git@github.com/robertdebock/ansible-role-spamassassin.git dest: ansible-role-java
- name: ssh://git@github.com/robertdebock/ansible-role-squid.git - repo: ssh://git@github.com/robertdebock/ansible-role-jenkins.git
- name: ssh://git@github.com/robertdebock/ansible-role-sudo-pair.git dest: ansible-role-jenkins
- name: ssh://git@github.com/robertdebock/ansible-role-terraform.git - repo: ssh://git@github.com/robertdebock/ansible-role-locale.git
- name: ssh://git@github.com/robertdebock/ansible-role-tftpd.git dest: ansible-role-locale
- name: ssh://git@github.com/robertdebock/ansible-role-tomcat.git - repo: ssh://git@github.com/robertdebock/ansible-role-lynis.git
- name: ssh://git@github.com/robertdebock/ansible-role-travis.git dest: ansible-role-lynis
- name: ssh://git@github.com/robertdebock/ansible-role-update.git - repo: ssh://git@github.com/robertdebock/ansible-role-mediawiki.git
- name: ssh://git@github.com/robertdebock/ansible-role-users.git dest: ansible-role-mediawiki
- name: ssh://git@github.com/robertdebock/ansible-role-vagrant.git - repo: ssh://git@github.com/robertdebock/ansible-role-memcached.git
- name: ssh://git@github.com/robertdebock/ansible-role-xinetd.git dest: ansible-role-memcached
- name: ssh://git@github.com/robertdebock/ansible-role-zabbix.git - repo: ssh://git@github.com/robertdebock/ansible-role-mitogen.git
- name: ssh://git@github.com/robertdebock/ansible-role-zabbix_agent.git dest: ansible-role-mitogen
- name: ssh://git@github.com/robertdebock/ansible-role-zabbix_proxy.git - repo: ssh://git@github.com/robertdebock/ansible-role-molecule.git
- name: ssh://git@github.com/robertdebock/ansible-role-zabbix_repository.git dest: ansible-role-molecule
- name: ssh://git@github.com/robertdebock/ansible-role-zabbix_server.git - repo: ssh://git@github.com/robertdebock/ansible-role-mssql.git
- name: ssh://git@github.com/robertdebock/ansible-role-zabbix_web.git dest: ansible-role-mssql
- name: ssh://git@github.com/robertdebock/ansible-tools.git - repo: ssh://git@github.com/robertdebock/ansible-role-mysql.git
- name: ssh://git@github.com/robertdebock/drawings.git dest: ansible-role-mysql
- name: ssh://git@github.com/robertdebock/robertdebock.github.io.git - repo: ssh://git@github.com/robertdebock/ansible-role-natrouter.git
dest: ansible-role-natrouter
- repo: ssh://git@github.com/robertdebock/ansible-role-nginx.git
dest: ansible-role-nginx
- repo: ssh://git@github.com/robertdebock/ansible-role-npm.git
dest: ansible-role-npm
- repo: ssh://git@github.com/robertdebock/ansible-role-ntp.git
dest: ansible-role-ntp
- repo: ssh://git@github.com/robertdebock/ansible-role-openssh.git
dest: ansible-role-openssh
- repo: ssh://git@github.com/robertdebock/ansible-role-openvas.git
dest: ansible-role-openvas
- repo: ssh://git@github.com/robertdebock/ansible-role-owncloud.git
dest: ansible-role-owncloud
- repo: ssh://git@github.com/robertdebock/ansible-role-packer.git
dest: ansible-role-packer
- repo: ssh://git@github.com/robertdebock/ansible-role-php.git
dest: ansible-role-php
- repo: ssh://git@github.com/robertdebock/ansible-role-phpmyadmin.git
dest: ansible-role-phpmyadmin
- repo: ssh://git@github.com/robertdebock/ansible-role-postfix.git
dest: ansible-role-postfix
- repo: ssh://git@github.com/robertdebock/ansible-role-python-pip.git
dest: ansible-role-python_pip
- repo: ssh://git@github.com/robertdebock/ansible-role-reboot.git
dest: ansible-role-reboot
- repo: ssh://git@github.com/robertdebock/ansible-role-redis.git
dest: ansible-role-redis
- repo: ssh://git@github.com/robertdebock/ansible-role-release.git
dest: ansible-role-release
- repo: ssh://git@github.com/robertdebock/ansible-role-restore.git
dest: ansible-role-restore
- repo: ssh://git@github.com/robertdebock/ansible-role-revealmd.git
dest: ansible-role-revealmd
- repo: ssh://git@github.com/robertdebock/ansible-role-roundcubemail.git
dest: ansible-role-roundcubemail
- repo: ssh://git@github.com/robertdebock/ansible-role-rsyslog.git
dest: ansible-role-rsyslog
- repo: ssh://git@github.com/robertdebock/ansible-role-ruby.git
dest: ansible-role-ruby
- repo: ssh://git@github.com/robertdebock/ansible-role-rundeck.git
dest: ansible-role-rundeck
- repo: ssh://git@github.com/robertdebock/ansible-role-scl.git
dest: ansible-role-scl
- repo: ssh://git@github.com/robertdebock/ansible-role-selinux.git
dest: ansible-role-selinux
- repo: ssh://git@github.com/robertdebock/ansible-role-skeleton.git
dest: ansible-role-skeleton
- repo: ssh://git@github.com/robertdebock/ansible-role-snort.git
dest: ansible-role-snort
- repo: ssh://git@github.com/robertdebock/ansible-role-spamassassin.git
dest: ansible-role-spamassassin
- repo: ssh://git@github.com/robertdebock/ansible-role-squid.git
dest: ansible-role-squid
- repo: ssh://git@github.com/robertdebock/ansible-role-sudo-pair.git
dest: ansible-role-sudo_pair
- repo: ssh://git@github.com/robertdebock/ansible-role-terraform.git
dest: ansible-role-terraform
- repo: ssh://git@github.com/robertdebock/ansible-role-tftpd.git
dest: ansible-role-tftpd
- repo: ssh://git@github.com/robertdebock/ansible-role-tomcat.git
dest: ansible-role-tomcat
- repo: ssh://git@github.com/robertdebock/ansible-role-travis.git
dest: ansible-role-travis
- repo: ssh://git@github.com/robertdebock/ansible-role-update.git
dest: ansible-role-update
- repo: ssh://git@github.com/robertdebock/ansible-role-users.git
dest: ansible-role-users
- repo: ssh://git@github.com/robertdebock/ansible-role-vagrant.git
dest: ansible-role-vagrant
- repo: ssh://git@github.com/robertdebock/ansible-role-xinetd.git
dest: ansible-role-xinetd
- repo: ssh://git@github.com/robertdebock/ansible-role-zabbix.git
dest: ansible-role-zabbix
- repo: ssh://git@github.com/robertdebock/ansible-role-zabbix_agent.git
dest: ansible-role-zabbix_agent
- repo: ssh://git@github.com/robertdebock/ansible-role-zabbix_proxy.git
dest: ansible-role-zabbix_proxy
- repo: ssh://git@github.com/robertdebock/ansible-role-zabbix_repository.git
dest: ansible-role-zabbix_repository
- repo: ssh://git@github.com/robertdebock/ansible-role-zabbix_server.git
dest: ansible-role-zabbix_server
- repo: ssh://git@github.com/robertdebock/ansible-role-zabbix_web.git
dest: ansible-role-zabbix_web
- repo: ssh://git@github.com/robertdebock/ansible-tools.git
dest: ansible-tools
- repo: ssh://git@github.com/robertdebock/drawings.git
dest: drawings
- repo: ssh://git@github.com/robertdebock/robertdebock.github.io.git
dest: robertdebock.github.io

View File

@ -1 +1 @@
fedora-s-2vcpu-2gb-ams3-01 ansible_host=142.93.228.212 #fedora-s-1vcpu-2gb-fra1-01 ansible_host=167.99.141.134

52
inventory/vagant.py Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env python
# Adapted from Mark Mandel's implementation
# https://github.com/ansible/ansible/blob/devel/plugins/inventory/vagrant.py
import argparse
import json
import paramiko
import subprocess
import sys
def parse_args():
parser = argparse.ArgumentParser(description="Vagrant inventory script")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--list', action='store_true')
group.add_argument('--host')
return parser.parse_args()
def list_running_hosts():
cmd = "vagrant status --machine-readable"
status = subprocess.check_output(cmd.split()).rstrip()
hosts = []
for line in status.split('\n'):
(_, host, key, value) = line.split(',',3)
if key == 'state' and value == 'running':
hosts.append(host)
return hosts
def get_host_details(host):
cmd = "vagrant ssh-config {}".format(host)
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
config = paramiko.SSHConfig()
config.parse(p.stdout)
c = config.lookup(host)
return {'ansible_ssh_host': c['hostname'],
'ansible_ssh_port': c['port'],
'ansible_ssh_user': c['user'],
'ansible_ssh_private_key_file': c['identityfile'][0]}
def main():
args = parse_args()
if args.list:
hosts = list_running_hosts()
json.dump({'vagrant': hosts}, sys.stdout)
else:
details = get_host_details(args.host)
json.dump(details, sys.stdout)
if __name__ == '__main__':
main()

View File

@ -9,19 +9,20 @@
- robertdebock.bootstrap - robertdebock.bootstrap
- robertdebock.update - robertdebock.update
- robertdebock.fail2ban - robertdebock.fail2ban
- robertdebock.openssh
- robertdebock.firewall - robertdebock.firewall
- robertdebock.digitalocean_agent - robertdebock.digitalocean_agent
- robertdebock.common - robertdebock.common
- robertdebock.docker
- robertdebock.users - robertdebock.users
- robertdebock.postfix - robertdebock.postfix
- robertdebock.docker
- robertdebock.vagrant - robertdebock.vagrant
- robertdebock.investigate - robertdebock.investigate
- robertdebock.ansible - robertdebock.ansible
- robertdebock.ansible_lint - robertdebock.ansible_lint
- robertdebock.buildtools - robertdebock.buildtools
- robertdebock.python_pip
- robertdebock.molecule - robertdebock.molecule
- robertdebock.ara - robertdebock.ara
- robertdebock.ruby - robertdebock.ruby
- robertdebock.travis - robertdebock.travis
- robertdebock.git