-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,025 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,3 +147,7 @@ raw-test-output/ | |
|
||
# Ignore visual studio code folder | ||
.vscode | ||
|
||
#Ignore vagrant staging files | ||
*.box | ||
*.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
install_local_packages: false | ||
primary_network_iface: eth0 | ||
ssh_users: vagrant | ||
securedrop_app_install_from_repo: true | ||
allow_direct_access: true |
18 changes: 18 additions & 0 deletions
18
molecule/vagrant_packager/box_files/Vagrantfile.app-staging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
|
||
config.ssh.insert_key = false | ||
config.vm.hostname = "app-staging" | ||
|
||
config.vm.box = "bento/ubuntu-14.04" | ||
|
||
config.vm.provider "libvirt" do |lv, override| | ||
lv.memory = 1024 | ||
override.vm.synced_folder './', '/vagrant', type: 'nfs', disabled: false | ||
end | ||
|
||
config.vm.network "private_network", ip: "10.0.1.2" | ||
|
||
end |
15 changes: 15 additions & 0 deletions
15
molecule/vagrant_packager/box_files/Vagrantfile.mon-staging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
|
||
config.ssh.insert_key = false | ||
|
||
config.vm.provider "libvirt" do |lv, override| | ||
lv.memory = 1024 | ||
override.vm.synced_folder './', '/vagrant', type: 'nfs', disabled: false | ||
end | ||
|
||
config.vm.network "private_network", ip: "10.0.1.3" | ||
|
||
end |
20 changes: 20 additions & 0 deletions
20
molecule/vagrant_packager/box_files/vagrant_app-staging.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Molecule managed | ||
|
||
--- | ||
instance: | ||
interfaces: [] | ||
name: app-staging | ||
raw_config_args: | ||
- 'vm.synced_folder ''./'', ''/vagrant'', disabled: true' | ||
- 'vm.network ''private_network'', ip: ''10.0.1.2''' | ||
- ssh.insert_key = false | ||
platform: | ||
box: bento/ubuntu-14.04 | ||
box_url: null | ||
box_version: null | ||
provider: | ||
name: libvirt | ||
options: | ||
cpus: 2 | ||
memory: 1024 | ||
raw_config_args: null |
20 changes: 20 additions & 0 deletions
20
molecule/vagrant_packager/box_files/vagrant_mon-staging.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Molecule managed | ||
|
||
--- | ||
instance: | ||
interfaces: [] | ||
name: mon-staging | ||
raw_config_args: | ||
- 'vm.synced_folder ''./'', ''/vagrant'', disabled: true' | ||
- 'vm.network ''private_network'', ip: ''10.0.1.3''' | ||
- ssh.insert_key = false | ||
platform: | ||
box: bento/ubuntu-14.04 | ||
box_url: null | ||
box_version: null | ||
provider: | ||
name: libvirt | ||
options: | ||
cpus: 2 | ||
memory: 1024 | ||
raw_config_args: null |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
- import_playbook: sd_clone.yml | ||
|
||
- name: Create | ||
hosts: localhost | ||
connection: local | ||
vars: | ||
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" | ||
molecule_instance_config: "{{ lookup('env', 'MOLECULE_INSTANCE_CONFIG') }}" | ||
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" | ||
tasks: | ||
|
||
- name: Create molecule instance(s) | ||
molecule_vagrant: | ||
instance_name: "{{ item.name }}" | ||
instance_interfaces: "{{ item.interfaces | default(omit) }}" | ||
instance_raw_config_args: "{{ item.instance_raw_config_args | default(omit) }}" | ||
|
||
platform_box: "{{ item.box }}" | ||
platform_box_version: "{{ item.box_version | default(omit) }}" | ||
platform_box_url: "{{ item.box_url | default(omit) }}" | ||
|
||
provider_name: "{{ molecule_yml.driver.provider.name }}" | ||
provider_memory: "{{ item.memory | default(omit) }}" | ||
provider_cpus: "{{ item.cpus | default(omit) }}" | ||
provider_raw_config_args: "{{ item.raw_config_args | default(omit) }}" | ||
force_stop: yes | ||
|
||
state: up | ||
register: server | ||
with_items: "{{ molecule_yml.platforms }}" | ||
|
||
# Mandatory configuration for Molecule to function. | ||
|
||
- name: Populate instance config dict | ||
set_fact: | ||
instance_conf_dict: { | ||
'instance': "{{ item.Host }}", | ||
'address': "{{ item.HostName }}", | ||
'user': "{{ item.User }}", | ||
'port': "{{ item.Port }}", | ||
'identity_file': "{{ item.IdentityFile }}", } | ||
with_items: "{{ server.results }}" | ||
register: instance_config_dict | ||
when: server.changed | bool | ||
|
||
- name: Convert instance config dict to a list | ||
set_fact: | ||
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}" | ||
when: server.changed | bool | ||
|
||
- name: Dump instance config | ||
copy: | ||
# NOTE(retr0h): Workaround for Ansible 2.2. | ||
# https://github.com/ansible/ansible/issues/20885 | ||
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" | ||
dest: "{{ molecule_instance_config }}" | ||
when: server.changed | bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
|
||
- name: Destroy | ||
hosts: localhost | ||
connection: local | ||
vars: | ||
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" | ||
molecule_instance_config: "{{ lookup('env',' MOLECULE_INSTANCE_CONFIG') }}" | ||
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" | ||
molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}" | ||
tasks: | ||
- name: Destroy molecule instance(s) | ||
molecule_vagrant: | ||
instance_name: "{{ item.name }}" | ||
platform_box: "{{ item.box }}" | ||
provider_name: "{{ molecule_yml.driver.provider.name }}" | ||
force_stop: "{{ item.force_stop | default(True) }}" | ||
|
||
state: destroy | ||
register: server | ||
with_items: "{{ molecule_yml.platforms }}" | ||
|
||
- name: Destroy locally cloned git folder | ||
file: | ||
state: absent | ||
path: "{{ molecule_ephemeral_directory }}/sd-orig" | ||
|
||
# Mandatory configuration for Molecule to function. | ||
|
||
- name: Populate instance config | ||
set_fact: | ||
instance_conf: {} | ||
|
||
- name: Dump instance config | ||
copy: | ||
# NOTE(retr0h): Workaround for Ansible 2.2. | ||
# https://github.com/ansible/ansible/issues/20885 | ||
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" | ||
dest: "{{ molecule_instance_config }}" | ||
when: server.changed | bool |
Oops, something went wrong.