Add container_networks, ssh_key and vxlan_mesh resources

This commit is contained in:
Dmitry Shulyak 2015-08-03 18:04:54 +03:00
parent 88f2ba4725
commit 418066b827
6 changed files with 113 additions and 0 deletions

View File

@ -0,0 +1,22 @@
- hosts: '*'
sudo: yes
gather_facts: false
# this is default variables, they will be overwritten by resource one
vars:
networks:
mgmt:
address: 172.18.10.6
bridge: br-test0
bridge_address: 172.18.10.252/24
interface: eth1
netmask: 255.255.255.0
type: veth
tasks:
- shell: ip l add {{item.value.bridge}} type bridge
with_dict: networks
ignore_errors: true
- shell: ip l set {{item.value.bridge}} up
with_dict: networks
- shell: ip a add dev {{item.value.bridge}} {{item.value.bridge_address}}
with_dict: networks
ignore_errors: true

View File

@ -0,0 +1,17 @@
id: container_networks
handler: ansible_playbook
version: 1.0.0
actions:
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
networks:
schema: {}
value:

View File

@ -0,0 +1,12 @@
- hosts: '*'
sudo: yes
gather_facts: false
# this is default variables, they will be overwritten by resource one
vars:
path: /vagrant/.ssh/id_rsa
passphrase: containers
tasks:
- stat: path={{path}}
register: key
- shell: ssh-keygen -t rsa -f {{path}} -N {{passphrase}}
when: key.stat.exists == False

View File

@ -0,0 +1,23 @@
id: ssh_key
handler: ansible_playbook
version: 1.0.0
actions:
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
path:
schema: str!
value:
pub_path:
schema: str!
value:
passphrase:
schema: str
value: default_passphrase

View File

@ -0,0 +1,16 @@
- hosts: '*'
sudo: yes
vars:
id: 42
group: 239.1.10.2
parent: eth1
master: br-test0
tasks:
- name: add vxlan mesh
shell: ip l add vxlan{{id}} type vxlan id {{id}}
group {{group}} dev {{parent}}
ignore_errors: true
- name: set vxlan master
shell: ip l set vxlan{{id}} master {{master}}
- name: set vxlan tunnel up
shell: ip l set vxlan{{id}} up

View File

@ -0,0 +1,23 @@
id: vxlan_mesh
handler: ansible_playbook
version: 1.0.0
actions:
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
parent:
schema: str!
value:
master:
schema: str!
value:
id:
schema: int!
value: